ref: dea38802d1509f806fafb7d537a413dd520ffc9c
parent: 21f21427c16074276aef29d1d3b1238763d06b77
author: Samuel Villareal <svkaiser@gmail.com>
date: Fri Sep 10 20:17:27 EDT 2010
+ Comments added Subversion-branch: /branches/strife-branch Subversion-revision: 2059
--- a/src/strife/p_dialog.c
+++ b/src/strife/p_dialog.c
@@ -695,9 +695,11 @@
line_t junk;
boolean ok = true;
+ // set quest if mf_givequest flag is set
if(mobjinfo[type].flags & MF_GIVEQUEST)
player->questflags |= 1 << (mobjinfo[type].speed - 1);
+ // check for keys
if(type >= MT_KEY_BASE && type <= MT_NEWKEY5)
{
P_GiveCard(player, type - MT_KEY_BASE);
@@ -704,6 +706,7 @@
return true;
}
+ // check for quest tokens
if(type >= MT_TOKEN_QUEST1 && type <= MT_TOKEN_QUEST31)
{
if(mobjinfo[type].name)
@@ -713,17 +716,21 @@
}
player->questflags |= 1 << (type - MT_TOKEN_QUEST1);
}
+ // check for other types
else switch(type)
{
+ // severed hand
case MT_KEY_HAND:
P_GiveCard(player, key_SeveredHand);
break;
+ // 300 gold
case MT_MONY_300:
for(i = 0; i < 300; i++)
P_GiveInventoryItem(player, SPR_COIN, MT_MONY_1);
break;
+ // ammo refill (at training)
case MT_TOKEN_AMMO:
if(player->ammo[am_bullets] >= 50)
return false;
@@ -731,6 +738,7 @@
player->ammo[am_bullets] = 50;
break;
+ // health refill (at front HQ)
case MT_TOKEN_HEALTH:
// [STRIFE] TODO - add healthamounts array
//if(!P_GiveBody(player, healthamounts[gameskill]))
@@ -737,16 +745,19 @@
// return false;
break;
+ // alarm
case MT_TOKEN_ALARM:
P_NoiseAlert(player->mo, player->mo);
A_AlertSpectreC(dialogtalker);
break;
+ // door special 1
case MT_TOKEN_DOOR1:
junk.tag = 222;
EV_DoDoor(&junk, open);
break;
+ // door special 2
case MT_TOKEN_PRISON_PASS:
junk.tag = 223;
EV_DoDoor(&junk, open);
@@ -754,16 +765,19 @@
P_GiveInventoryItem(player, sprnum, type);
break;
+ // door special 3
case MT_TOKEN_SHOPCLOSE:
junk.tag = 222;
EV_DoDoor(&junk, close);
break;
+ // door special 4
case MT_TOKEN_DOOR3:
junk.tag = 224;
EV_DoDoor(&junk, close);
break;
+ // stamina upgrade
case MT_TOKEN_STAMINA:
if(player->stamina >= 100)
return false;
@@ -772,6 +786,7 @@
P_GiveBody(player, 200);
break;
+ // accuracy upgrade
case MT_TOKEN_NEW_ACCURACY:
if(player->accuracy >= 100)
return false;
@@ -779,158 +794,189 @@
player->accuracy += 10;
break;
+ // slideshow
case MT_SLIDESHOW:
gameaction = ga_victory;
if(gamemap == 10)
P_GiveItemToPlayer(player, SPR_TOKN, MT_TOKEN_QUEST17);
break;
- }
-
- switch(sprnum)
- {
- case SPR_BLIT:
- ok = P_GiveAmmo(player, am_bullets, 1);
+
+ default:
+ // check for sprites if no specific type is found
+ switch(sprnum)
+ {
+ // bullets
+ case SPR_BLIT:
+ ok = P_GiveAmmo(player, am_bullets, 1);
break;
- case SPR_BBOX:
- ok = P_GiveAmmo(player, am_bullets, 5);
+ // box of bullets
+ case SPR_BBOX:
+ ok = P_GiveAmmo(player, am_bullets, 5);
break;
- case SPR_MSSL:
- ok = P_GiveAmmo(player, am_missiles, 1);
+ // missile
+ case SPR_MSSL:
+ ok = P_GiveAmmo(player, am_missiles, 1);
break;
- case SPR_ROKT:
- ok = P_GiveAmmo(player, am_missiles, 5);
+ // box of missiles
+ case SPR_ROKT:
+ ok = P_GiveAmmo(player, am_missiles, 5);
break;
- case SPR_BRY1:
- ok = P_GiveAmmo(player, am_cell, 1);
+ // battery
+ case SPR_BRY1:
+ ok = P_GiveAmmo(player, am_cell, 1);
break;
- case SPR_CPAC:
- ok = P_GiveAmmo(player, am_cell, 5);
+ // cell pack
+ case SPR_CPAC:
+ ok = P_GiveAmmo(player, am_cell, 5);
break;
- case SPR_PQRL:
- ok = P_GiveAmmo(player, am_poisonbolts, 5);
+ // poison bolts
+ case SPR_PQRL:
+ ok = P_GiveAmmo(player, am_poisonbolts, 5);
break;
- case SPR_XQRL:
- ok = P_GiveAmmo(player, am_elecbolts, 5);
+ // electric bolts
+ case SPR_XQRL:
+ ok = P_GiveAmmo(player, am_elecbolts, 5);
break;
- case SPR_GRN1:
- ok = P_GiveAmmo(player, am_hegrenades, 1);
+ // he grenades
+ case SPR_GRN1:
+ ok = P_GiveAmmo(player, am_hegrenades, 1);
break;
- case SPR_GRN2:
- ok = P_GiveAmmo(player, am_wpgrenades, 1);
+ // wp grenades
+ case SPR_GRN2:
+ ok = P_GiveAmmo(player, am_wpgrenades, 1);
break;
- case SPR_BKPK:
- if(!player->backpack)
- {
- for(i = 0; i < NUMAMMO; i++)
- player->maxammo[i] *= 2;
+ // backpack
+ case SPR_BKPK:
+ if(!player->backpack)
+ {
+ for(i = 0; i < NUMAMMO; i++)
+ player->maxammo[i] *= 2;
- player->backpack = true;
- }
- for(i = 0; i < NUMAMMO; i++)
- P_GiveAmmo(player, i, 1);
+ player->backpack = true;
+ }
+ for(i = 0; i < NUMAMMO; i++)
+ P_GiveAmmo(player, i, 1);
break;
- case SPR_COIN:
- P_GiveInventoryItem(player, SPR_COIN, MT_MONY_1);
+ // coin
+ case SPR_COIN:
+ P_GiveInventoryItem(player, SPR_COIN, MT_MONY_1);
break;
- case SPR_CRED:
- for(i = 0; i < 10; i++)
- P_GiveInventoryItem(player, SPR_COIN, MT_MONY_1);
+ // gold 10
+ case SPR_CRED:
+ for(i = 0; i < 10; i++)
+ P_GiveInventoryItem(player, SPR_COIN, MT_MONY_1);
break;
- case SPR_SACK:
- for(i = 0; i < 25; i++)
- P_GiveInventoryItem(player, SPR_COIN, MT_MONY_1);
+ // gold 25
+ case SPR_SACK:
+ for(i = 0; i < 25; i++)
+ P_GiveInventoryItem(player, SPR_COIN, MT_MONY_1);
break;
- case SPR_CHST:
- for(i = 0; i < 50; i++)
- P_GiveInventoryItem(player, SPR_COIN, MT_MONY_1);
+ // gold 50
+ case SPR_CHST:
+ for(i = 0; i < 50; i++)
+ P_GiveInventoryItem(player, SPR_COIN, MT_MONY_1);
break;
- case SPR_HELT:
- P_GiveInventoryItem(player, SPR_HELT, MT_TOKEN_TOUGHNESS);
- P_GiveInventoryItem(player, SPR_GUNT, MT_TOKEN_ACCURACY);
+ // ???
+ case SPR_HELT:
+ P_GiveInventoryItem(player, SPR_HELT, MT_TOKEN_TOUGHNESS);
+ P_GiveInventoryItem(player, SPR_GUNT, MT_TOKEN_ACCURACY);
- // [STRIFE] TODO - verify
- for(i = 0; i < 5 * player->numinventory + 300; i++)
- P_GiveInventoryItem(player, SPR_COIN, MT_MONY_1);
+ // [STRIFE] TODO - verify
+ for(i = 0; i < 5 * player->numinventory + 300; i++)
+ P_GiveInventoryItem(player, SPR_COIN, MT_MONY_1);
break;
- case SPR_ARM1:
- if(!P_GiveArmor(player, -2))
- P_GiveInventoryItem(player, sprnum, type);
+ // metal armor
+ case SPR_ARM1:
+ if(!P_GiveArmor(player, -2))
+ P_GiveInventoryItem(player, sprnum, type);
break;
- case SPR_ARM2:
- if(!P_GiveArmor(player, -1))
- P_GiveInventoryItem(player, sprnum, type);
+ // leather armor
+ case SPR_ARM2:
+ if(!P_GiveArmor(player, -1))
+ P_GiveInventoryItem(player, sprnum, type);
break;
- case SPR_COMM:
- //if(!P_GivePower(player)) // [STRIFE] TODO
- // return false;
+ // communicator
+ case SPR_COMM:
+ //if(!P_GivePower(player)) // [STRIFE] TODO
+ // return false;
break;
- case SPR_PMAP:
- //if(!P_GivePower(player)) // [STRIFE] TODO
- // return false;
+ // map
+ case SPR_PMAP:
+ //if(!P_GivePower(player)) // [STRIFE] TODO
+ // return false;
break;
- case SPR_RIFL:
- if(player->weaponowned[wp_rifle])
- return false;
+ // rifle
+ case SPR_RIFL:
+ if(player->weaponowned[wp_rifle])
+ return false;
- if(!P_GiveWeapon(player, wp_rifle, false))
- return false;
- break;
+ if(!P_GiveWeapon(player, wp_rifle, false))
+ return false;
+ break;
- case SPR_FLAM:
- if(player->weaponowned[wp_flame])
- return false;
+ // flame thrower
+ case SPR_FLAM:
+ if(player->weaponowned[wp_flame])
+ return false;
- if(!P_GiveWeapon(player, wp_flame, false))
- return false;
- break;
+ if(!P_GiveWeapon(player, wp_flame, false))
+ return false;
+ break;
- case SPR_MMSL:
- if(player->weaponowned[wp_missile])
- return false;
+ // missile launcher
+ case SPR_MMSL:
+ if(player->weaponowned[wp_missile])
+ return false;
- if(!P_GiveWeapon(player, wp_missile, false))
- return false;
- break;
+ if(!P_GiveWeapon(player, wp_missile, false))
+ return false;
+ break;
- case SPR_TRPD:
- if(player->weaponowned[wp_mauler])
- return false;
+ // mauler
+ case SPR_TRPD:
+ if(player->weaponowned[wp_mauler])
+ return false;
- if(!P_GiveWeapon(player, wp_mauler, false))
- return false;
- break;
+ if(!P_GiveWeapon(player, wp_mauler, false))
+ return false;
+ break;
- case SPR_CBOW:
- if(player->weaponowned[wp_elecbow])
- return false;
+ // crossbow
+ case SPR_CBOW:
+ if(player->weaponowned[wp_elecbow])
+ return false;
- if(!P_GiveWeapon(player, wp_elecbow, false))
- return false;
- break;
+ if(!P_GiveWeapon(player, wp_elecbow, false))
+ return false;
+ break;
- default:
- if(!P_GiveInventoryItem(player, sprnum, type))
- return false;
+ // misc item
+ default:
+ if(!P_GiveInventoryItem(player, sprnum, type))
+ return false;
+ break;
+ }
+ break;
}
S_StartSound(player->mo, sfx_itemup);