From 64d77945f9703dd8f4233b90dc557134c9ff71d4 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 31 Oct 2021 00:01:08 +0200 Subject: [PATCH] - DoFindGroundPoint This removes the last SpriteNum occurence in actpr.cpp --- source/games/sw/src/actor.cpp | 6 +----- source/games/sw/src/coolg.cpp | 4 ++-- source/games/sw/src/eel.cpp | 4 ++-- source/games/sw/src/hornet.cpp | 2 +- source/games/sw/src/skull.cpp | 4 ++-- source/games/sw/src/weapon.cpp | 20 ++++++++++---------- source/games/sw/src/weapon.h | 2 +- 7 files changed, 19 insertions(+), 23 deletions(-) diff --git a/source/games/sw/src/actor.cpp b/source/games/sw/src/actor.cpp index 21ea7e1e6..9f8241bb1 100644 --- a/source/games/sw/src/actor.cpp +++ b/source/games/sw/src/actor.cpp @@ -712,9 +712,6 @@ int DoActorJump(DSWActor* actor) // reverse your speed to falling u->jump_speed = -u->jump_speed; - //DSPRINTF(ds,"Jump: sp_num %d, hi_num %d, hi_sect %d",SpriteNum, u->hi_sp - sprite, u->hi_sectp - sector); - MONO_PRINT(ds); - // Change sprites state to falling DoActorBeginFall(actor); } @@ -823,7 +820,6 @@ int DoActorStopFall(DSWActor* actor) int DoActorDeathMove(DSWActor* actor) { USER* u = actor->u(); - int SpriteNum = u->SpriteNum; SPRITEp sp = &actor->s(); int nx, ny; @@ -843,7 +839,7 @@ int DoActorDeathMove(DSWActor* actor) move_actor(actor, nx, ny, 0); // only fall on top of floor sprite or sector - DoFindGroundPoint(SpriteNum); + DoFindGroundPoint(actor); return 0; } diff --git a/source/games/sw/src/coolg.cpp b/source/games/sw/src/coolg.cpp index 8d24ba315..fdf9c1f2f 100644 --- a/source/games/sw/src/coolg.cpp +++ b/source/games/sw/src/coolg.cpp @@ -792,7 +792,7 @@ int DoCoolgDeath(DSWActor* actor) } else { - DoFindGroundPoint(SpriteNum); + DoFindGroundPoint(actor); u->floor_dist = 0; DoBeginFall(actor); } @@ -805,7 +805,7 @@ int DoCoolgDeath(DSWActor* actor) ny = MulScale(sp->xvel, bsin(sp->ang), 14); u->ret = move_sprite(SpriteNum, nx, ny, 0L, u->ceiling_dist, u->floor_dist, CLIPMASK_MISSILE, ACTORMOVETICS); - DoFindGroundPoint(SpriteNum); + DoFindGroundPoint(actor); // on the ground if (sp->z >= u->loz) diff --git a/source/games/sw/src/eel.cpp b/source/games/sw/src/eel.cpp index 0b91de3d6..42738feb7 100644 --- a/source/games/sw/src/eel.cpp +++ b/source/games/sw/src/eel.cpp @@ -542,7 +542,7 @@ DoEelDeath(DSWActor* actor) } else { - DoFindGroundPoint(SpriteNum); + DoFindGroundPoint(actor); u->floor_dist = 0; DoBeginFall(actor); } @@ -555,7 +555,7 @@ DoEelDeath(DSWActor* actor) ny = MulScale(sp->xvel, bsin(sp->ang), 14); u->ret = move_sprite(SpriteNum, nx, ny, 0L, u->ceiling_dist, u->floor_dist, CLIPMASK_MISSILE, ACTORMOVETICS); - DoFindGroundPoint(SpriteNum); + DoFindGroundPoint(actor); // on the ground if (sp->z >= u->loz) diff --git a/source/games/sw/src/hornet.cpp b/source/games/sw/src/hornet.cpp index 24db533ca..016a36a43 100644 --- a/source/games/sw/src/hornet.cpp +++ b/source/games/sw/src/hornet.cpp @@ -528,7 +528,7 @@ DoHornetDeath(DSWActor* actor) u->jump_speed = 0; u->floor_dist = 0; DoBeginFall(actor); - DoFindGroundPoint(SpriteNum); + DoFindGroundPoint(actor); u->zclip = u->loz; } diff --git a/source/games/sw/src/skull.cpp b/source/games/sw/src/skull.cpp index 5615d5aa6..1079b25b7 100644 --- a/source/games/sw/src/skull.cpp +++ b/source/games/sw/src/skull.cpp @@ -275,7 +275,7 @@ DoSkullMove(DSWActor* actor) u->ret = move_missile(SpriteNum, dax, day, daz, Z(16), Z(16), CLIPMASK_MISSILE, ACTORMOVETICS); - DoFindGroundPoint(SpriteNum); + DoFindGroundPoint(actor); return 0; } @@ -696,7 +696,7 @@ DoBettyMove(DSWActor* actor) u->ret = move_missile(SpriteNum, dax, day, daz, Z(16), Z(16), CLIPMASK_MISSILE, ACTORMOVETICS); - DoFindGroundPoint(SpriteNum); + DoFindGroundPoint(actor); return 0; } diff --git a/source/games/sw/src/weapon.cpp b/source/games/sw/src/weapon.cpp index 7cda2b470..102365a9a 100644 --- a/source/games/sw/src/weapon.cpp +++ b/source/games/sw/src/weapon.cpp @@ -3910,7 +3910,7 @@ DoVomit(DSWActor* actor) else { ChangeState(actor, s_VomitSplash); - DoFindGroundPoint(SpriteNum); + DoFindGroundPoint(actor); MissileWaterAdjust(SpriteNum); sp->z = u->loz; u->WaitTics = 60; @@ -12016,11 +12016,10 @@ DoFindGround(int16_t SpriteNum) return false; } -int -DoFindGroundPoint(int16_t SpriteNum) +int DoFindGroundPoint(DSWActor* actor) { - SPRITEp sp = &sprite[SpriteNum], hsp; - USERp u = User[SpriteNum].Data(); + SPRITEp sp = &actor->s(), hsp; + USERp u = actor->u(); int ceilhit, florhit; short save_cstat; short bak_cstat; @@ -12054,7 +12053,7 @@ DoFindGroundPoint(int16_t SpriteNum) // recursive bak_cstat = hsp->cstat; RESET(hsp->cstat, CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN); - DoFindGroundPoint(SpriteNum); + DoFindGroundPoint(actor); hsp->cstat = bak_cstat; } @@ -12146,7 +12145,7 @@ DoNapalm(DSWActor* actor) explosion = SpawnSprite(STAT_MISSILE, NAP_EXP, s_NapExp, sp->sectnum, sp->x, sp->y, sp->z, sp->ang, 0); - + auto expActor = &swActors[explosion]; exp = &sprite[explosion]; eu = User[explosion].Data(); @@ -12163,7 +12162,7 @@ DoNapalm(DSWActor* actor) RESET(exp->cstat, CSTAT_SPRITE_TRANSLUCENT); eu->Radius = 1500; - DoFindGroundPoint(explosion); + DoFindGroundPoint(expActor); MissileWaterAdjust(explosion); exp->z = eu->loz; exp->backupz(); @@ -16814,6 +16813,7 @@ int DoCoolgDrip(DSWActor* actor) int InitCoolgDrip(short SpriteNum) { + auto actor = &swActors[SpriteNum]; SPRITEp sp = &sprite[SpriteNum], wp; USERp wu; int nx, ny, nz; @@ -16839,7 +16839,7 @@ InitCoolgDrip(short SpriteNum) wu->floor_dist = Z(4); SET(wp->cstat, CSTAT_SPRITE_YCENTER); - DoFindGroundPoint(SpriteNum); + DoFindGroundPoint(actor); return w; } @@ -16889,7 +16889,7 @@ GenerateDrips(DSWActor* actor) if (TEST_BOOL1(sp)) wu->spal = wp->pal = PALETTE_BLUE_LIGHTING; - DoFindGroundPoint(SpriteNum); + DoFindGroundPoint(actor); } return w; } diff --git a/source/games/sw/src/weapon.h b/source/games/sw/src/weapon.h index d72869145..efa5beb21 100644 --- a/source/games/sw/src/weapon.h +++ b/source/games/sw/src/weapon.h @@ -215,7 +215,7 @@ int InitTurretMgun(SECTOR_OBJECTp sop); int InitVulcanBoulder(DSWActor* actor); int DoBladeDamage(short SpriteNum); int DoFindGround(int16_t SpriteNum); -int DoFindGroundPoint(int16_t SpriteNum); +int DoFindGroundPoint(DSWActor* actor); void SpriteQueueDelete(short SpriteNum); int HelpMissileLateral(int16_t Weapon,int dist); int AddSpriteToSectorObject(short SpriteNum,SECTOR_OBJECTp sop);