From dc6ea409110ce26121fbc0910b591e931c0c574b Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 29 Oct 2021 23:38:21 +0200 Subject: [PATCH] - DoFall --- source/games/sw/src/actor.cpp | 10 +++++----- source/games/sw/src/bunny.cpp | 2 +- source/games/sw/src/misc.h | 2 +- source/games/sw/src/player.cpp | 4 ++-- source/games/sw/src/ripper.cpp | 13 +++++++------ source/games/sw/src/ripper2.cpp | 13 +++++++------ source/games/sw/src/skull.cpp | 4 ++-- source/games/sw/src/weapon.cpp | 10 +++++----- 8 files changed, 30 insertions(+), 28 deletions(-) diff --git a/source/games/sw/src/actor.cpp b/source/games/sw/src/actor.cpp index 50c51ab4f..c11f8e3a5 100644 --- a/source/games/sw/src/actor.cpp +++ b/source/games/sw/src/actor.cpp @@ -874,16 +874,16 @@ int DoBeginJump(DSWActor* actor) // set up individual actor jump gravity u->jump_grav = ACTOR_GRAVITY; - DoJump(u->SpriteNum); + DoJump(actor); return 0; } -int -DoJump(short SpriteNum) +int DoJump(DSWActor* actor) { - USERp u = User[SpriteNum].Data(); - SPRITEp sp = User[SpriteNum]->SpriteP; + USERp u = actor->u(); + SPRITEp sp = &actor->s(); + int SpriteNum = actor->GetSpriteIndex(); int jump_adj; diff --git a/source/games/sw/src/bunny.cpp b/source/games/sw/src/bunny.cpp index e1eef1c2f..cb212184f 100644 --- a/source/games/sw/src/bunny.cpp +++ b/source/games/sw/src/bunny.cpp @@ -880,7 +880,7 @@ DoBunnyBeginJumpAttack(DSWActor* actor) // if I didn't do this here they get stuck in the air sometimes DoActorZrange(SpriteNum); - DoJump(SpriteNum); + DoJump(actor); return 0; } diff --git a/source/games/sw/src/misc.h b/source/games/sw/src/misc.h index ab644aecc..fec6ca243 100644 --- a/source/games/sw/src/misc.h +++ b/source/games/sw/src/misc.h @@ -81,7 +81,7 @@ void SetSlidorActive(short SpriteNum); void DoSlidorInterp(short, INTERP_FUNC); int DoBeginJump(DSWActor* actor); -int DoJump(short SpriteNum); +int DoJump(DSWActor* actor); int DoBeginFall(short SpriteNum); int DoFall(short SpriteNum); void KeepActorOnFloor(DSWActor* actor); diff --git a/source/games/sw/src/player.cpp b/source/games/sw/src/player.cpp index 2f2e59075..d2089b4d4 100644 --- a/source/games/sw/src/player.cpp +++ b/source/games/sw/src/player.cpp @@ -6398,7 +6398,7 @@ void DoPlayerDeathFlip(PLAYERp pp) DoPlayerDeathJump(pp); DoPlayerDeathHoriz(pp, PLAYER_DEATH_HORIZ_UP_VALUE, 2); if (MoveSkip2 == 0) - DoJump(pp->PlayerSprite); + DoJump(pp->Actor()); } if (TEST(pp->Flags,PF_FALLING)) @@ -6435,7 +6435,7 @@ void DoPlayerDeathDrown(PLAYERp pp) DoPlayerDeathJump(pp); DoPlayerDeathHoriz(pp, PLAYER_DEATH_HORIZ_UP_VALUE, 2); if (MoveSkip2 == 0) - DoJump(pp->PlayerSprite); + DoJump(pp->Actor()); } if (TEST(pp->Flags,PF_FALLING)) diff --git a/source/games/sw/src/ripper.cpp b/source/games/sw/src/ripper.cpp index ed67d3228..e3b371c3a 100644 --- a/source/games/sw/src/ripper.cpp +++ b/source/games/sw/src/ripper.cpp @@ -993,7 +993,7 @@ InitRipperHang(DSWActor* actor) // set up individual actor jump gravity u->jump_grav = 8; - DoJump(SpriteNum); + DoJump(actor); return 0; } @@ -1063,7 +1063,7 @@ DoRipperHangJF(DSWActor* actor) if (TEST(u->Flags, SPR_JUMPING | SPR_FALLING)) { if (TEST(u->Flags, SPR_JUMPING)) - DoJump(SpriteNum); + DoJump(actor); else DoFall(SpriteNum); } @@ -1117,7 +1117,7 @@ DoRipperBeginJumpAttack(DSWActor* actor) // if I didn't do this here they get stuck in the air sometimes DoActorZrange(SpriteNum); - DoJump(SpriteNum); + DoJump(actor); return 0; } @@ -1131,7 +1131,7 @@ DoRipperMoveJump(DSWActor* actor) if (TEST(u->Flags, SPR_JUMPING | SPR_FALLING)) { if (TEST(u->Flags, SPR_JUMPING)) - DoJump(SpriteNum); + DoJump(actor); else DoFall(SpriteNum); } @@ -1253,6 +1253,7 @@ void RipperHatch(short Weapon) for (i = 0; i < MAX_RIPPERS; i++) { New = COVERinsertsprite(wp->sectnum, STAT_DEFAULT); + auto actorNew = &swActors[New]; np = &sprite[New]; memset(np,0,sizeof(SPRITE)); np->sectnum = wp->sectnum; @@ -1284,7 +1285,7 @@ void RipperHatch(short Weapon) // if I didn't do this here they get stuck in the air sometimes DoActorZrange(New); - DoJump(New); + DoJump(actorNew); } } @@ -1302,7 +1303,7 @@ DoRipperMove(DSWActor* actor) if (TEST(u->Flags, SPR_JUMPING | SPR_FALLING)) { if (TEST(u->Flags, SPR_JUMPING)) - DoJump(SpriteNum); + DoJump(actor); else DoFall(SpriteNum); } diff --git a/source/games/sw/src/ripper2.cpp b/source/games/sw/src/ripper2.cpp index 5cfea64b3..000e43564 100644 --- a/source/games/sw/src/ripper2.cpp +++ b/source/games/sw/src/ripper2.cpp @@ -990,7 +990,7 @@ InitRipper2Hang(DSWActor* actor) // set up individual actor jump gravity u->jump_grav = 8; - DoJump(SpriteNum); + DoJump(actor); return 0; } @@ -1068,7 +1068,7 @@ DoRipper2HangJF(DSWActor* actor) if (TEST(u->Flags, SPR_JUMPING | SPR_FALLING)) { if (TEST(u->Flags, SPR_JUMPING)) - DoJump(SpriteNum); + DoJump(actor); else DoFall(SpriteNum); } @@ -1129,7 +1129,7 @@ DoRipper2BeginJumpAttack(DSWActor* actor) // if I didn't do this here they get stuck in the air sometimes DoActorZrange(SpriteNum); - DoJump(SpriteNum); + DoJump(actor); return 0; } @@ -1143,7 +1143,7 @@ DoRipper2MoveJump(DSWActor* actor) if (TEST(u->Flags, SPR_JUMPING | SPR_FALLING)) { if (TEST(u->Flags, SPR_JUMPING)) - DoJump(SpriteNum); + DoJump(actor); else DoFall(SpriteNum); } @@ -1266,6 +1266,7 @@ void Ripper2Hatch(short Weapon) for (i = 0; i < MAX_RIPPER2S; i++) { New = COVERinsertsprite(wp->sectnum, STAT_DEFAULT); + auto actorNew = &swActors[New]; np = &sprite[New]; memset(np,0,sizeof(SPRITE)); np->sectnum = wp->sectnum; @@ -1298,7 +1299,7 @@ void Ripper2Hatch(short Weapon) // if I didn't do this here they get stuck in the air sometimes DoActorZrange(New); - DoJump(New); + DoJump(actorNew); } } @@ -1320,7 +1321,7 @@ DoRipper2Move(DSWActor* actor) if (TEST(u->Flags, SPR_JUMPING | SPR_FALLING)) { if (TEST(u->Flags, SPR_JUMPING)) - DoJump(SpriteNum); + DoJump(actor); else DoFall(SpriteNum); } diff --git a/source/games/sw/src/skull.cpp b/source/games/sw/src/skull.cpp index 0cf07e331..505ac5615 100644 --- a/source/games/sw/src/skull.cpp +++ b/source/games/sw/src/skull.cpp @@ -381,7 +381,7 @@ int DoSkullJump(DSWActor* actor) if (TEST(u->Flags,SPR_JUMPING)) { - DoJump(SpriteNum); + DoJump(actor); } else if (TEST(u->Flags,SPR_FALLING)) { @@ -800,7 +800,7 @@ int DoBettyJump(DSWActor* actor) if (TEST(u->Flags,SPR_JUMPING)) { - DoJump(SpriteNum); + DoJump(actor); } else if (TEST(u->Flags,SPR_FALLING)) { diff --git a/source/games/sw/src/weapon.cpp b/source/games/sw/src/weapon.cpp index 3cfac7eff..648d82f86 100644 --- a/source/games/sw/src/weapon.cpp +++ b/source/games/sw/src/weapon.cpp @@ -3895,8 +3895,8 @@ DoVomit(DSWActor* actor) sp->yrepeat = u->sy + MulScale(12, bsin(u->Counter), 14); if (TEST(u->Flags, SPR_JUMPING)) { - DoJump(SpriteNum); - DoJump(SpriteNum); + DoJump(actor); + DoJump(actor); DoShrapMove(SpriteNum); } else if (TEST(u->Flags, SPR_FALLING)) @@ -4030,7 +4030,7 @@ DoShrapDamage(DSWActor* actor) if (TEST(u->Flags, SPR_JUMPING)) { - DoJump(SpriteNum); + DoJump(actor); DoShrapMove(SpriteNum); } else if (TEST(u->Flags, SPR_FALLING)) @@ -4750,7 +4750,7 @@ DoFireballFlames(DSWActor* actor) { if (TEST(u->Flags, SPR_JUMPING)) { - DoJump(SpriteNum); + DoJump(actor); jumping = true; //u->ret = move_missile(SpriteNum, dax, day, daz, Z(16), Z(16), CLIPMASK_MISSILE, MISSILEMOVETICS); } @@ -4826,7 +4826,7 @@ DoBreakFlames(DSWActor* actor) if (TEST(u->Flags, SPR_JUMPING)) { - DoJump(SpriteNum); + DoJump(actor); jumping = true; } else if (TEST(u->Flags, SPR_FALLING))