From 0e1e29d768cfeb1d814c704ef9c280e306541023 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 1 Nov 2021 10:59:10 +0100 Subject: [PATCH] - ChemBomb stuff. --- source/games/sw/src/jweapon.cpp | 32 ++++++++++++++------------------ source/games/sw/src/skull.cpp | 6 +++--- 2 files changed, 17 insertions(+), 21 deletions(-) diff --git a/source/games/sw/src/jweapon.cpp b/source/games/sw/src/jweapon.cpp index 895521fef..ff623ed32 100644 --- a/source/games/sw/src/jweapon.cpp +++ b/source/games/sw/src/jweapon.cpp @@ -1315,14 +1315,12 @@ int DoRadiationCloud(DSWActor* actor) // Inventory Chemical Bombs // ////////////////////////////////////////////// -int -PlayerInitChemBomb(PLAYERp pp) +int PlayerInitChemBomb(PLAYERp pp) { - USERp u = User[pp->PlayerSprite].Data(); + USERp u = pp->Actor()->u(); USERp wu; SPRITEp wp; int nx, ny, nz; - short w; short oclipdist; @@ -1337,11 +1335,11 @@ PlayerInitChemBomb(PLAYERp pp) // Spawn a shot // Inserting and setting up variables - w = SpawnSprite(STAT_MISSILE, CHEMBOMB, s_ChemBomb, pp->cursectnum, + auto actorNew = SpawnActor(STAT_MISSILE, CHEMBOMB, s_ChemBomb, pp->cursectnum, nx, ny, nz, pp->angle.ang.asbuild(), CHEMBOMB_VELOCITY); - wp = &sprite[w]; - wu = User[w].Data(); + wp = &actorNew->s(); + wu = actorNew->u(); // don't throw it as far if crawling if (TEST(pp->Flags, PF_CRAWLING)) @@ -1353,7 +1351,7 @@ PlayerInitChemBomb(PLAYERp pp) // NewStateGroup_(w, &sg_ChemBomb); SET(wu->Flags, SPR_XFLIP_TOGGLE); - SetOwner(pp->PlayerSprite, w); + SetOwner(pp->Actor(), actorNew); wp->yrepeat = 32; wp->xrepeat = 32; wp->shade = -15; @@ -1382,7 +1380,7 @@ PlayerInitChemBomb(PLAYERp pp) // HelpMissileLateral(w, 800); // wp->ang = NORM_ANGLE(wp->ang + 512); - MissileSetPos(w, DoChemBomb, 1000); + MissileSetPos(actorNew->GetSpriteIndex(), DoChemBomb, 1000); pp->SpriteP->clipdist = uint8_t(oclipdist); wp->clipdist = 80L >> 2; @@ -1401,14 +1399,12 @@ PlayerInitChemBomb(PLAYERp pp) return 0; } -int -InitSpriteChemBomb(int16_t SpriteNum) +int InitSpriteChemBomb(DSWActor* actor) { - USERp u = User[SpriteNum].Data(); + USERp u = actor->u(); USERp wu; - SPRITEp sp = &sprite[SpriteNum], wp; + SPRITEp sp = &actor->s(), wp; int nx, ny, nz; - short w; PlaySound(DIGI_THROW, sp, v3df_dontpan | v3df_doppler); @@ -1419,15 +1415,15 @@ InitSpriteChemBomb(int16_t SpriteNum) // Spawn a shot // Inserting and setting up variables - w = SpawnSprite(STAT_MISSILE, CHEMBOMB, s_ChemBomb, sp->sectnum, + auto actorNew = SpawnActor(STAT_MISSILE, CHEMBOMB, s_ChemBomb, sp->sectnum, nx, ny, nz, sp->ang, CHEMBOMB_VELOCITY); - wp = &sprite[w]; - wu = User[w].Data(); + wp = &actorNew->s(); + wu = actorNew->u(); SET(wu->Flags, SPR_XFLIP_TOGGLE); - SetOwner(SpriteNum, w); + SetOwner(actor, actorNew); wp->yrepeat = 32; wp->xrepeat = 32; wp->shade = -15; diff --git a/source/games/sw/src/skull.cpp b/source/games/sw/src/skull.cpp index 5b930afb1..9784087e2 100644 --- a/source/games/sw/src/skull.cpp +++ b/source/games/sw/src/skull.cpp @@ -35,7 +35,7 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms BEGIN_SW_NS int InitSpriteGrenade(DSWActor* actor); -int InitSpriteChemBomb(short SpriteNum); +int InitSpriteChemBomb(DSWActor*); int InitFlashBomb(DSWActor* actor); int InitCaltrops(short SpriteNum); int InitPhosphorus(int16_t SpriteNum); @@ -304,7 +304,7 @@ DoSkullBeginDeath(DSWActor* actor) for (i=0; iang = NORM_ANGLE(sp->ang+(i*1024)); - InitSpriteChemBomb(SpriteNum); + InitSpriteChemBomb(actor); } break; @@ -721,7 +721,7 @@ DoBettyBeginDeath(DSWActor* actor) for (i=0; iang = NORM_ANGLE(sp->ang+(i*1024)); - InitSpriteChemBomb(SpriteNum); + InitSpriteChemBomb(actor); } break;