diff --git a/source/games/whaven/src/aigoblin.cpp b/source/games/whaven/src/aigoblin.cpp index eeeb034f2..57fa5672b 100644 --- a/source/games/whaven/src/aigoblin.cpp +++ b/source/games/whaven/src/aigoblin.cpp @@ -360,8 +360,6 @@ static void goblinWar(PLAYER& plr, DWHActor* actor) { SPRITE& spr = actor->s(); - short k; - if (spr.lotag > 256) { spr.lotag = 100; spr.extra = 0; @@ -405,8 +403,7 @@ static void goblinWar(PLAYER& plr, DWHActor* actor) } case 1: // chase { - k = spr.owner; - auto owneractor = &whActors[k]; + auto owneractor = &whActors[spr.owner]; auto ownerspr = owneractor->s(); auto moveStat = aimove(actor); @@ -419,7 +416,7 @@ static void goblinWar(PLAYER& plr, DWHActor* actor) } else if (moveStat.type == kHitSprite) { int sprnum = moveStat.actor->GetSpriteIndex(); - if (sprnum != k) { + if (sprnum != spr.owner) { spr.extra = 3; spr.ang = (short)((spr.ang + (krand() & 256 - 128)) & 2047); spr.lotag = 60; @@ -443,8 +440,7 @@ static void goblinWar(PLAYER& plr, DWHActor* actor) } case 2: // attack { - k = spr.owner; - auto owneractor = &whActors[k]; + auto owneractor = &whActors[spr.owner]; auto& ownerspr = owneractor->s(); if (checkdist(actor, ownerspr.x, ownerspr.y, ownerspr.z)) { if ((krand() & 1) != 0) { diff --git a/source/games/whaven/src/aikatie.cpp b/source/games/whaven/src/aikatie.cpp index fb3b8949b..e5e72e49d 100644 --- a/source/games/whaven/src/aikatie.cpp +++ b/source/games/whaven/src/aikatie.cpp @@ -256,7 +256,6 @@ static void castkatie(PLAYER& plr, DWHActor* actor) static void diekatie(PLAYER& plr, DWHActor* actor) { - int i = actor->GetSpriteIndex(); SPRITE& spr = actor->s(); spr.lotag -= TICSPERFRAME; diff --git a/source/games/whaven/src/aikobold.cpp b/source/games/whaven/src/aikobold.cpp index 9ac9859da..ccaf1bd66 100644 --- a/source/games/whaven/src/aikobold.cpp +++ b/source/games/whaven/src/aikobold.cpp @@ -7,7 +7,6 @@ static void checkexplkobold(PLAYER& plr, DWHActor* actor); static void chasekobold(PLAYER& plr, DWHActor* actor) { - int i = actor->GetSpriteIndex(); SPRITE& spr = actor->s(); spr.lotag -= TICSPERFRAME; @@ -203,7 +202,6 @@ static void fleekobold(PLAYER& plr, DWHActor* actor) static void attackkobold(PLAYER& plr, DWHActor* actor) { - int i = actor->GetSpriteIndex(); SPRITE& spr = actor->s(); getzrange(spr.x, spr.y, spr.z - 1, spr.sectnum, (spr.clipdist) << 2, CLIPMASK0); @@ -255,8 +253,6 @@ static void resurectkobold(PLAYER& plr, DWHActor* actor) static void searchkobold(PLAYER& plr, DWHActor* actor) { - int i = actor->GetSpriteIndex(); - if ((krand() % 100) > 98) spritesound(S_KSNARL1 + (krand() % 4), actor); aisearch(plr, actor, false); @@ -328,7 +324,6 @@ static void skirmishkobold(PLAYER& plr, DWHActor* actor) static void checkexplkobold(PLAYER& plr, DWHActor* actor) { - int i = actor->GetSpriteIndex(); SPRITE& spr = actor->s(); WHSectIterator it(spr.sectnum); diff --git a/source/games/whaven/src/aikurt.cpp b/source/games/whaven/src/aikurt.cpp index d8008aef6..17bd3ffda 100644 --- a/source/games/whaven/src/aikurt.cpp +++ b/source/games/whaven/src/aikurt.cpp @@ -32,7 +32,6 @@ static void nukedkurt(PLAYER& plr, DWHActor* actor) static void kurtExplo(PLAYER& plr, DWHActor* actor) { - int i = actor->GetSpriteIndex(); SPRITE& spr = actor->s(); spr.lotag -= TICSPERFRAME; diff --git a/source/games/whaven/src/aiminotaur.cpp b/source/games/whaven/src/aiminotaur.cpp index 44cf74fc7..a48b2fe03 100644 --- a/source/games/whaven/src/aiminotaur.cpp +++ b/source/games/whaven/src/aiminotaur.cpp @@ -205,7 +205,6 @@ static void faceminotaur(PLAYER& plr, DWHActor* actor) static void attackminotaur(PLAYER& plr, DWHActor* actor) { - int i = actor->GetSpriteIndex(); SPRITE& spr = actor->s(); getzrange(spr.x, spr.y, spr.z - 1, spr.sectnum, (spr.clipdist) << 2, CLIPMASK0); @@ -322,7 +321,6 @@ static void searchminotaur(PLAYER& plr, DWHActor* actor) static void checkexplminotaur(PLAYER& plr, DWHActor* actor) { - int i = actor->GetSpriteIndex(); SPRITE& spr = actor->s(); WHSectIterator it(spr.sectnum); diff --git a/source/games/whaven/src/ainewguy.cpp b/source/games/whaven/src/ainewguy.cpp index ec4616d94..fe178d3e7 100644 --- a/source/games/whaven/src/ainewguy.cpp +++ b/source/games/whaven/src/ainewguy.cpp @@ -3,7 +3,7 @@ BEGIN_WH_NS -static void newguyarrow(short s, PLAYER& plr); +static void newguyarrow(DWHActor* s, PLAYER& plr); static void standnewguy(PLAYER& plr, DWHActor* actor) { @@ -259,7 +259,6 @@ static void fleenewguy(PLAYER& plr, DWHActor* actor) static void attacknewguy(PLAYER& plr, DWHActor* actor) { - int i = actor->GetSpriteIndex(); SPRITE& spr = actor->s(); getzrange(spr.x, spr.y, spr.z - 1, spr.sectnum, (spr.clipdist) << 2, CLIPMASK0); @@ -335,7 +334,6 @@ static void dienewguy(PLAYER& plr, DWHActor* actor) static void castnewguy(PLAYER& plr, DWHActor* actor) { - int i = actor->GetSpriteIndex(); SPRITE& spr = actor->s(); spr.lotag -= TICSPERFRAME; @@ -355,41 +353,42 @@ static void castnewguy(PLAYER& plr, DWHActor* actor) spr.extra--; spr.picnum = NEWGUY; spritesound(S_PLRWEAPON3, actor); - newguyarrow(i, plr); + newguyarrow(actor, plr); SetNewStatus(actor, CHASE); } checksector6(actor); } -static void newguyarrow(short s, PLAYER& plr) { - auto spawnedactor = InsertActor(sprite[s].sectnum, JAVLIN); - auto& spr = spawnedactor->s(); +static void newguyarrow(DWHActor* actor, PLAYER& plr) { + auto& spr = actor->s(); + auto spawnedactor = InsertActor(spr.sectnum, JAVLIN); + auto& spawned = spawnedactor->s(); - spr.x = sprite[s].x; - spr.y = sprite[s].y; - spr.z = sprite[s].z - (40 << 8); + spawned.x = spr.x; + spawned.y = spr.y; + spawned.z = spr.z - (40 << 8); - spr.cstat = 21; + spawned.cstat = 21; - spr.picnum = WALLARROW; - spr.ang = (short)(((sprite[s].ang + 2048 + 96) - 512) & 2047); - spr.xrepeat = 24; - spr.yrepeat = 24; - spr.clipdist = 32; + spawned.picnum = WALLARROW; + spawned.ang = (short)(((spr.ang + 2048 + 96) - 512) & 2047); + spawned.xrepeat = 24; + spawned.yrepeat = 24; + spawned.clipdist = 32; - spr.extra = sprite[s].ang; - spr.shade = -15; - spr.xvel = (short)((krand() & 256) - 128); - spr.yvel = (short)((krand() & 256) - 128); + spawned.extra = spr.ang; + spawned.shade = -15; + spawned.xvel = (short)((krand() & 256) - 128); + spawned.yvel = (short)((krand() & 256) - 128); - spr.zvel = (short)(((plr.z + (8 << 8) - sprite[s].z) << 7) / ksqrt((plr.x - sprite[s].x) * (plr.x - sprite[s].x) + (plr.y - sprite[s].y) * (plr.y - sprite[s].y))); + spawned.zvel = (short)(((plr.z + (8 << 8) - spr.z) << 7) / ksqrt((plr.x - spr.x) * (plr.x - spr.x) + (plr.y - spr.y) * (plr.y - spr.y))); - spr.zvel += ((krand() % 256) - 128); + spawned.zvel += ((krand() % 256) - 128); - spr.owner = s; - spr.lotag = 1024; - spr.hitag = 0; - spr.pal = 0; + spawned.owner = actor->GetSpriteIndex(); + spawned.lotag = 1024; + spawned.hitag = 0; + spawned.pal = 0; spr.backuploc(); } diff --git a/source/games/whaven/src/airat.cpp b/source/games/whaven/src/airat.cpp index bbb78256c..6feb0268b 100644 --- a/source/games/whaven/src/airat.cpp +++ b/source/games/whaven/src/airat.cpp @@ -32,7 +32,6 @@ static void dierat(PLAYER& plr, DWHActor* actor) static void fleerat(PLAYER& plr, DWHActor* actor) { - int i = actor->GetSpriteIndex(); SPRITE& spr = actor->s(); spr.lotag -= TICSPERFRAME; diff --git a/source/games/whaven/src/aiskeleton.cpp b/source/games/whaven/src/aiskeleton.cpp index 0a98e684d..fe98a8f2c 100644 --- a/source/games/whaven/src/aiskeleton.cpp +++ b/source/games/whaven/src/aiskeleton.cpp @@ -211,7 +211,6 @@ static void standskeleton(PLAYER& plr, DWHActor* actor) static void attackskeleton(PLAYER& plr, DWHActor* actor) { - int i = actor->GetSpriteIndex(); SPRITE& spr = actor->s(); getzrange(spr.x, spr.y, spr.z - 1, spr.sectnum, (spr.clipdist) << 2, CLIPMASK0); @@ -346,7 +345,6 @@ void skeletonChill(PLAYER& plr, DWHActor* actor) static void checkexplskeleton(PLAYER& plr, DWHActor* actor) { - int i = actor->GetSpriteIndex(); SPRITE& spr = actor->s(); WHSectIterator it(spr.sectnum); diff --git a/source/games/whaven/src/aiskully.cpp b/source/games/whaven/src/aiskully.cpp index 1781b78b1..2ce31e360 100644 --- a/source/games/whaven/src/aiskully.cpp +++ b/source/games/whaven/src/aiskully.cpp @@ -204,7 +204,6 @@ static void fleeskully(PLAYER& plr, DWHActor* actor) static void castskully(PLAYER& plr, DWHActor* actor) { - int i = actor->GetSpriteIndex(); SPRITE& spr = actor->s(); spr.lotag -= TICSPERFRAME; @@ -224,7 +223,6 @@ static void castskully(PLAYER& plr, DWHActor* actor) static void dieskully(PLAYER& plr, DWHActor* actor) { - int i = actor->GetSpriteIndex(); SPRITE& spr = actor->s(); spr.lotag -= TICSPERFRAME; diff --git a/source/games/whaven/src/aispider.cpp b/source/games/whaven/src/aispider.cpp index 1cac5a051..e092a5f44 100644 --- a/source/games/whaven/src/aispider.cpp +++ b/source/games/whaven/src/aispider.cpp @@ -184,7 +184,6 @@ static void facespider(PLAYER& plr, DWHActor* actor) static void attackspider(PLAYER& plr, DWHActor* actor) { - int i = actor->GetSpriteIndex(); SPRITE& spr = actor->s(); getzrange(spr.x, spr.y, spr.z - 1, spr.sectnum, (spr.clipdist) << 2, CLIPMASK0); @@ -288,7 +287,6 @@ static void diespider(PLAYER& plr, DWHActor* actor) static void checkexplspider(PLAYER& plr, DWHActor* actor) { - int i = actor->GetSpriteIndex(); SPRITE& spr = actor->s(); WHSectIterator it(spr.sectnum); diff --git a/source/games/whaven/src/aiwillow.cpp b/source/games/whaven/src/aiwillow.cpp index da56001b5..85e90b02e 100644 --- a/source/games/whaven/src/aiwillow.cpp +++ b/source/games/whaven/src/aiwillow.cpp @@ -263,7 +263,6 @@ void willowProcess(PLAYER& plr) static void willowDrain(PLAYER& plr, DWHActor* actor) { - int i = actor->GetSpriteIndex(); SPRITE& spr = actor->s(); spr.lotag -= TICSPERFRAME; diff --git a/source/games/whaven/src/wh.h b/source/games/whaven/src/wh.h index b2400a2ac..b9a0c4165 100644 --- a/source/games/whaven/src/wh.h +++ b/source/games/whaven/src/wh.h @@ -553,7 +553,6 @@ struct GameInterface : public ::GameInterface inline void SetNewStatus(DWHActor* actor, const int seq) { - void newstatus(short sn, int seq); newstatus(actor->GetSpriteIndex(), seq); }