diff --git a/source/games/sw/src/game.h b/source/games/sw/src/game.h index 5a466d2bf..67542e53b 100644 --- a/source/games/sw/src/game.h +++ b/source/games/sw/src/game.h @@ -2149,7 +2149,7 @@ void LoadCustomInfoFromScript(const char *filename); // scrip2.c int PlayerInitChemBomb(PLAYERp pp); // jweapon.c int PlayerInitFlashBomb(PLAYERp pp); // jweapon.c int PlayerInitCaltrops(PLAYERp pp); // jweapon.c -int InitPhosphorus(int16_t SpriteNum); // jweapon.c +int InitPhosphorus(DSWActor*); // jweapon.c void SpawnFloorSplash(DSWActor*); // jweapon.c int SaveGame(short save_num); // save.c diff --git a/source/games/sw/src/jweapon.cpp b/source/games/sw/src/jweapon.cpp index 4d7fc954f..e13c7afc3 100644 --- a/source/games/sw/src/jweapon.cpp +++ b/source/games/sw/src/jweapon.cpp @@ -1813,14 +1813,13 @@ int PlayerInitCaltrops(PLAYERp pp) return 0; } -int InitCaltrops(int16_t SpriteNum) +int InitCaltrops(DSWActor* actor) { - SPRITEp sp = &sprite[SpriteNum]; - USERp u = User[SpriteNum].Data(); + SPRITEp sp = &actor->s(); + USERp u = actor->u(); USERp wu; SPRITEp wp; int nx, ny, nz; - short w; PlaySound(DIGI_THROW, sp, v3df_dontpan | v3df_doppler); @@ -1831,16 +1830,15 @@ int InitCaltrops(int16_t SpriteNum) // Spawn a shot // Inserting and setting up variables - w = SpawnSprite(STAT_DEAD_ACTOR, CALTROPS, s_Caltrops, sp->sectnum, + auto spawnedActor = SpawnActor(STAT_DEAD_ACTOR, CALTROPS, s_Caltrops, sp->sectnum, nx, ny, nz, sp->ang, CHEMBOMB_VELOCITY / 2); - auto spawnedActor = &swActors[w]; - wp = &sprite[w]; - wu = User[w].Data(); + wp = &spawnedActor->s(); + wu = spawnedActor->u(); SET(wu->Flags, SPR_XFLIP_TOGGLE); - SetOwner(SpriteNum, w); + SetOwner(actor, spawnedActor); wp->yrepeat = 64; wp->xrepeat = 64; wp->shade = -15; @@ -1864,15 +1862,13 @@ int InitCaltrops(int16_t SpriteNum) return 0; } -int -InitPhosphorus(int16_t SpriteNum) +int InitPhosphorus(DSWActor* actor) { - SPRITEp sp = &sprite[SpriteNum]; - USERp u = User[SpriteNum].Data(); + SPRITEp sp = &actor->s(); + USERp u = actor->u(); USERp wu; SPRITEp wp; int nx, ny, nz; - short w; short daang; @@ -1886,11 +1882,11 @@ InitPhosphorus(int16_t SpriteNum) // Spawn a shot // Inserting and setting up variables - w = SpawnSprite(STAT_SKIP4, FIREBALL1, s_Phosphorus, sp->sectnum, + auto actorNew = SpawnActor(STAT_SKIP4, FIREBALL1, s_Phosphorus, sp->sectnum, nx, ny, nz, daang, CHEMBOMB_VELOCITY/3); - wp = &sprite[w]; - wu = User[w].Data(); + wp = &actorNew->s(); + wu = actorNew->u(); wp->hitag = LUMINOUS; // Always full brightness SET(wu->Flags, SPR_XFLIP_TOGGLE); diff --git a/source/games/sw/src/skull.cpp b/source/games/sw/src/skull.cpp index 9784087e2..5876e1b3b 100644 --- a/source/games/sw/src/skull.cpp +++ b/source/games/sw/src/skull.cpp @@ -37,7 +37,7 @@ BEGIN_SW_NS int InitSpriteGrenade(DSWActor* actor); int InitSpriteChemBomb(DSWActor*); int InitFlashBomb(DSWActor* actor); -int InitCaltrops(short SpriteNum); +int InitCaltrops(DSWActor* actor); int InitPhosphorus(int16_t SpriteNum); bool SpriteOverlapZ(int16_t, int16_t, int); @@ -316,7 +316,7 @@ DoSkullBeginDeath(DSWActor* actor) for (i=0; iang = NORM_ANGLE(RandomRange(2048)); - InitCaltrops(SpriteNum); + InitCaltrops(actor); } break; @@ -341,7 +341,7 @@ DoSkullBeginDeath(DSWActor* actor) for (i=0; i<3; i++) { sp->ang = NORM_ANGLE(RandomRange(2048)); - InitPhosphorus(SpriteNum); + InitPhosphorus(actor); } break; } @@ -733,7 +733,7 @@ DoBettyBeginDeath(DSWActor* actor) for (i=0; iang = NORM_ANGLE(RandomRange(2048)); - InitCaltrops(SpriteNum); + InitCaltrops(actor); } break; @@ -756,7 +756,7 @@ DoBettyBeginDeath(DSWActor* actor) for (i=0; i<5; i++) { sp->ang = NORM_ANGLE(RandomRange(2048)); - InitPhosphorus(SpriteNum); + InitPhosphorus(actor); SpawnMineExp(SpriteNum); } break; diff --git a/source/games/sw/src/weapon.cpp b/source/games/sw/src/weapon.cpp index 066932830..1e38602ed 100644 --- a/source/games/sw/src/weapon.cpp +++ b/source/games/sw/src/weapon.cpp @@ -3505,7 +3505,7 @@ AutoShrap: size = ep->xrepeat; ep->xrepeat = ep->yrepeat = size + shrap_delta_size; - InitPhosphorus(spnum); + InitPhosphorus(&swActors[spnum]); return false; } @@ -8950,7 +8950,7 @@ DoGrenade(DSWActor* actor) for (i=0; i<5; i++) { sp->ang = NORM_ANGLE(RandomRange(2048)); - InitPhosphorus(Weapon); + InitPhosphorus(actor); } } SpawnGrenadeExp(Weapon); @@ -9022,7 +9022,7 @@ DoGrenade(DSWActor* actor) for (i=0; i<5; i++) { sp->ang = NORM_ANGLE(RandomRange(2048)); - InitPhosphorus(Weapon); + InitPhosphorus(actor); } } SpawnGrenadeExp(Weapon); @@ -9065,7 +9065,7 @@ DoGrenade(DSWActor* actor) for (i=0; i<5; i++) { sp->ang = NORM_ANGLE(RandomRange(2048)); - InitPhosphorus(Weapon); + InitPhosphorus(actor); } } //WeaponMoveHit(Weapon);