From dfef246198170fc7efdc5df3a8a7287ded30672d Mon Sep 17 00:00:00 2001 From: Samuel Villareal Date: Thu, 9 Sep 2010 03:12:23 +0000 Subject: + More codepointers implemented + Converted some while loops to for loops in dialog functions Subversion-branch: /branches/strife-branch Subversion-revision: 2049 --- src/strife/info.c | 8 ++-- src/strife/p_dialog.c | 15 +++--- src/strife/p_enemy.c | 123 +++++++++++++++++++++++++++++++++++++++++++++++--- 3 files changed, 127 insertions(+), 19 deletions(-) diff --git a/src/strife/info.c b/src/strife/info.c index fd12f05d..af62a5cf 100644 --- a/src/strife/info.c +++ b/src/strife/info.c @@ -143,7 +143,7 @@ void A_EntityDeath(); void A_SpawnZombie(); void A_ZombieInSpecialSector(); void A_CrystalExplode(); -void A_DeathMsg(); +void A_QuestMsg(); void A_ExtraLightOff(); void A_CrystalRadiusAtk(); void A_DeathExplode5(); @@ -1360,7 +1360,7 @@ state_t states[NUMSTATES] = /*S_PSTN_01*/ { SPR_PSTN, 1, 8, { NULL }, S_PSTN_00 }, //1159 /*S_PSTN_02*/ { SPR_PSTN, 32768, 4, { A_Scream }, S_PSTN_03 }, //1160 /*S_PSTN_03*/ { SPR_PSTN, 32769, 4, { A_Fall }, S_PSTN_04 }, //1161 -/*S_PSTN_04*/ { SPR_PSTN, 32770, 4, { A_DeathMsg }, S_PSTN_05 }, //1162 +/*S_PSTN_04*/ { SPR_PSTN, 32770, 4, { A_QuestMsg }, S_PSTN_05 }, //1162 /*S_PSTN_05*/ { SPR_PSTN, 32771, 4, { A_SpawnSparkPuff }, S_PSTN_06 }, //1163 /*S_PSTN_06*/ { SPR_PSTN, 32772, 4, { A_BodyParts }, S_PSTN_07 }, //1164 /*S_PSTN_07*/ { SPR_PSTN, 32773, 4, { NULL }, S_PSTN_08 }, //1165 @@ -1373,7 +1373,7 @@ state_t states[NUMSTATES] = /*S_SECR_03*/ { SPR_SECR, 32771, 4, { NULL }, S_SECR_00 }, //1172 /*S_SECR_04*/ { SPR_SECR, 32772, 5, { A_SpawnSparkPuff }, S_SECR_05 }, //1173 /*S_SECR_05*/ { SPR_SECR, 32773, 5, { A_Fall }, S_SECR_06 }, //1174 -/*S_SECR_06*/ { SPR_SECR, 32774, 5, { A_DeathMsg }, S_SECR_07 }, //1175 +/*S_SECR_06*/ { SPR_SECR, 32774, 5, { A_QuestMsg }, S_SECR_07 }, //1175 /*S_SECR_07*/ { SPR_SECR, 32775, 5, { A_BodyParts }, S_SECR_08 }, //1176 /*S_SECR_08*/ { SPR_SECR, 32776, 5, { A_SpawnSparkPuff }, S_SECR_09 }, //1177 /*S_SECR_09*/ { SPR_SECR, 9, 5, { NULL }, S_SECR_10 }, //1178 @@ -1390,7 +1390,7 @@ state_t states[NUMSTATES] = /*S_EARS_00*/ { SPR_EARS, 0, -1, { NULL }, S_NULL }, //1189 /*S_COMM_00*/ { SPR_COMM, 0, -1, { NULL }, S_NULL }, //1190 /*S_BOOM_00*/ { SPR_BOOM, 32768, 1, { A_CrystalRadiusAtk }, S_BOOM_01 }, //1191 -/*S_BOOM_01*/ { SPR_BOOM, 32769, 3, { A_DeathMsg }, S_BOOM_02 }, //1192 +/*S_BOOM_01*/ { SPR_BOOM, 32769, 3, { A_QuestMsg }, S_BOOM_02 }, //1192 /*S_BOOM_02*/ { SPR_BOOM, 32770, 2, { A_CrystalExplode }, S_BOOM_03 }, //1193 /*S_BOOM_03*/ { SPR_BOOM, 32771, 3, { A_SpawnSparkPuff }, S_BOOM_04 }, //1194 /*S_BOOM_04*/ { SPR_BOOM, 32772, 3, { NULL }, S_BOOM_05 }, //1195 diff --git a/src/strife/p_dialog.c b/src/strife/p_dialog.c index ce52ee05..f9491b43 100644 --- a/src/strife/p_dialog.c +++ b/src/strife/p_dialog.c @@ -800,16 +800,15 @@ void P_DialogDoChoice(int choice) currentchoice = &(currentdialog->choices[choice]); // I_StartVoice(0); -- verify (should stop previous voice I believe) - do + // villsa 09/08/10: converted into for loop + for(i = 0; i < MDLG_MAXITEMS; i++) { if(P_PlayerHasItem(dialogplayer, currentchoice->needitems[i]) < currentchoice->needamounts[i]) { candochoice = false; // nope, missing something } - ++i; } - while(i < 3); if(choice != dialogmenu.numitems - 1 && candochoice) { @@ -827,14 +826,13 @@ void P_DialogDoChoice(int choice) { // if successful, take needed items int count = 0; - do + // villsa 09/08/10: converted into for loop + for(count = 0; count < MDLG_MAXITEMS; count++) { P_TakeDialogItem(dialogplayer, currentchoice->needitems[count], currentchoice->needamounts[count]); - ++count; } - while(count < 3); } else message = "You seem to have enough!"; @@ -945,16 +943,15 @@ void P_DialogStart(player_t *player) if(currentdialog->jumptoconv == 0) break; - do + // villsa 09/08/10: converted into for loop + for(i = 0; i < MDLG_MAXITEMS; i++) { // if the item is non-zero, the player must have at least one in his // or her inventory if(currentdialog->checkitem[i] != 0 && P_PlayerHasItem(dialogplayer, currentdialog->checkitem[i]) < 1) break; - ++i; } - while(i < MDLG_MAXITEMS); if(i < MDLG_MAXITEMS) // didn't find them all? this is our dialog! break; diff --git a/src/strife/p_enemy.c b/src/strife/p_enemy.c index c7c793d0..6cdc4d86 100644 --- a/src/strife/p_enemy.c +++ b/src/strife/p_enemy.c @@ -2540,14 +2540,60 @@ void A_SpawnZombie(mobj_t* actor) P_SpawnMobj(actor->x, actor->y, actor->z, MT_ZOMBIE); } +// +// A_ZombieInSpecialSector +// +// villsa [STRIFE] new codepointer +// void A_ZombieInSpecialSector(mobj_t* actor) { - // STRIFE-TODO + sector_t* sector; + fixed_t force; + angle_t angle; + int tagval; + + sector = actor->subsector->sector; + if(actor->z != sector->floorheight) // [STRIFE] TODO - verify + return; + + if(sector->special <= 15) + P_DamageMobj(actor, NULL, NULL, 999); + else if(sector->special == 18) + { + tagval = sector->tag - 100; + force = (tagval % 10) << 12; + angle = (tagval / 10) << 29; + P_ThrustMobj(actor, angle, force); // inlined in asm + } } +// +// A_CrystalExplode +// +// villsa [STRIFE] new codepointer +// void A_CrystalExplode(mobj_t* actor) { - // STRIFE-TODO + sector_t* sector; + mobj_t* rubble; + int i; + int r; + + sector = actor->subsector->sector; + sector->lightlevel = 0; + sector->floorheight = P_FindLowestFloorSurrounding(sector); + + // spawn rubble + for(i = 0; i < 8; i++) + { + rubble = P_SpawnMobj(actor->x, actor->y, actor->z, MT_RUBBLE1 + i); + r = P_Random(); + rubble->momx = ((r & 0x0f) - (P_Random() & 7)) << FRACBITS; + r = P_Random(); + rubble->momy = ((r & 7) - (P_Random() & 7)) << FRACBITS; + rubble->momz = ((P_Random() & 3) << FRACBITS) + (7*FRACUNIT); + + } } // [STRIFE] New static global - buffer used for various player messages. @@ -2595,9 +2641,30 @@ void P_DestroyConverter(void) } } -void A_DeathMsg(mobj_t* actor) +// +// A_QuestMsg +// +// villsa [STRIFE] new codepointer +// Displays text based on quest item's name +// Quest item is based on actor's speed +// +void A_QuestMsg(mobj_t* actor) { - // STRIFE-TODO + char* name; + int quest; + int i; + + // get name + name = mobjinfo[(MT_TOKEN_QUEST1 - 1) + actor->info->speed].name; + strcpy(pmsgbuffer, name); // inlined in asm + + // give quest and display message to players + for(i = 0; i < MAXPLAYERS; i++) + { + quest = 1 << ((actor->info->speed) - 1); + players[i].message = pmsgbuffer; + players[i].questflags |= quest; + } } // @@ -2912,9 +2979,24 @@ void A_ClearSoundTarget(mobj_t* actor) actor->subsector->sector->soundtarget = NULL; } +// +// A_DropBurnFlesh +// +// villsa [STRIFE] new codepointer +// void A_DropBurnFlesh(mobj_t* actor) { - // STRIFE-TODO + mobj_t* mo; + mobjtype_t type; + + type = actor->type; + + mo = P_SpawnMobj(actor->x, actor->y, actor->z + (24*FRACUNIT), MT_BURNDROP); + mo->momz = -FRACUNIT; + + actor->type = MT_SFIREBALL; + P_RadiusAttack(actor, actor, 64); + actor->type = type; } // @@ -2929,8 +3011,37 @@ void A_FlameDeath(mobj_t* actor) actor->momz = (P_Random() & 3) << FRACBITS; } +// +// A_ClearForceField +// +// villsa [STRIFE] new codepointer +// check for all matching lines in the sector +// and disable blocking/midtextures +// void A_ClearForceField(mobj_t* actor) { - // STRIFE-TODO + int i; + sector_t *sec; + line_t *secline; + + actor->flags &= ~(MF_SOLID|MF_SPECIAL); + sec = actor->subsector->sector; + + if(!sec->linecount) + return; + + for(i = 0; i < sec->linecount; i++) + { + secline = sec->lines[i]; + if(!(secline->flags & ML_TWOSIDED)) + continue; + if(secline->special != 148) + continue; + + secline->flags &= ~ML_BLOCKING; + secline->special = 0; + sides[secline->sidenum[0]].midtexture = 0; + sides[secline->sidenum[1]].midtexture = 0; + } } -- cgit v1.2.3