diff --git a/source/games/sw/src/game.h b/source/games/sw/src/game.h index 39da59c9e..46e15a311 100644 --- a/source/games/sw/src/game.h +++ b/source/games/sw/src/game.h @@ -1718,14 +1718,14 @@ void RefreshInfoLine(PLAYER* pp); void DoAnim(int numtics); void AnimDelete(int animtype, int animindex, DSWActor*); short AnimGetGoal(int animtype, int animindex, DSWActor*); -int AnimSet(int animtype, int animindex, DSWActor* animactor, int thegoal, int thevel); -int AnimSet(int animtype, sectortype* animindex, int thegoal, int thevel) +int AnimSet(int animtype, int animindex, DSWActor* animactor, double thegoal, int thevel); +int AnimSet(int animtype, sectortype* animindex, double thegoal, int thevel) { return AnimSet(animtype, sectnum(animindex), nullptr, thegoal, thevel); } short AnimSetCallback(short anim_ndx, ANIM_CALLBACKp call, SECTOR_OBJECT* data); -short AnimSetVelAdj(short anim_ndx, short vel_adj); +short AnimSetVelAdj(short anim_ndx, double vel_adj); void EnemyDefaults(DSWActor* actor, ACTOR_ACTION_SET* action, PERSONALITY* person); @@ -2232,8 +2232,8 @@ struct ANIM { int animtype, animindex; double goal; - int vel; - short vel_adj; + double vel; + double vel_adj; TObjPtr animactor; ANIM_CALLBACKp callback; SECTOR_OBJECT* callbackdata; // only gets used in one place for this so having a proper type makes serialization easier. @@ -2243,15 +2243,15 @@ struct ANIM switch (animtype) { case ANIM_Floorz: - return sector[animindex].int_floorz(); + return sector[animindex].floorz; case ANIM_SopZ: - return SectorObject[animindex].int_pmid().Z; + return SectorObject[animindex].pmid.Z; case ANIM_Spritez: if (animactor == nullptr) return 0; - return animactor->spr.int_pos().Z; + return animactor->spr.pos.Z; case ANIM_Userz: if (animactor == nullptr) return 0; - return animactor->user.int_upos().Z; + return animactor->user.pos.Z; case ANIM_SUdepth: return sector[animindex].depth_fixed; default: @@ -2264,18 +2264,17 @@ struct ANIM switch (animtype) { case ANIM_Floorz: - sector[animindex].set_int_floorz(value); + sector[animindex].setfloorz(value); break; case ANIM_SopZ: - SectorObject[animindex].pmid.Z = value * zinttoworld; - break; + SectorObject[animindex].pmid.Z = value; + break; case ANIM_Spritez: if (animactor == nullptr) return; - animactor->set_int_z(value); - break; + animactor->spr.pos.Z = value; case ANIM_Userz: if (animactor == nullptr) return; - animactor->user.pos.Z = value * inttoworld; + animactor->user.pos.Z = value; break; case ANIM_SUdepth: sector[animindex].depth_fixed = value; diff --git a/source/games/sw/src/sector.cpp b/source/games/sw/src/sector.cpp index d4a626aaf..88f1050fd 100644 --- a/source/games/sw/src/sector.cpp +++ b/source/games/sw/src/sector.cpp @@ -640,10 +640,7 @@ void DoSpringBoardDown(void) { if ((sbp->TimeOut -= synctics) <= 0) { - int destz; - - destz = nextsectorneighborzptr(sbp->sectp, sbp->sectp->int_floorz(), Find_FloorDown | Find_Safe)->int_floorz(); - + auto destz = nextsectorneighborzptr(sbp->sectp, sbp->sectp->int_floorz(), Find_FloorDown | Find_Safe)->floorz; AnimSet(ANIM_Floorz, sbp->sectp, destz, 256); sbp->sectp->lotag = TAG_SPRING_BOARD; @@ -2440,7 +2437,7 @@ void DoAnim(int numtics) if (animval < Anim[i].goal) { // move it - animval += (numtics * PIXZ(Anim[i].vel)); + animval += numtics * (Anim[i].vel); Anim[i].vel += Anim[i].vel_adj * numtics; @@ -2452,7 +2449,7 @@ void DoAnim(int numtics) // if GREATER THAN goal if (animval > Anim[i].goal) { - animval -= (numtics * PIXZ(Anim[i].vel)); + animval -= numtics * (Anim[i].vel); Anim[i].vel += Anim[i].vel_adj * numtics; @@ -2534,7 +2531,7 @@ void AnimDelete(int animtype, int animindex, DSWActor* animactor) } -int AnimSet(int animtype, int animindex, DSWActor* animactor, fixed_t thegoal, int thevel) +int AnimSet(int animtype, int animindex, DSWActor* animactor, double thegoal, int thevel) { int i, j; @@ -2556,7 +2553,7 @@ int AnimSet(int animtype, int animindex, DSWActor* animactor, fixed_t thegoal, i Anim[j].animindex = animindex; Anim[j].animactor = animactor; Anim[j].goal = thegoal; - Anim[j].vel = Z(thevel); + Anim[j].vel = thevel; Anim[j].vel_adj = 0; Anim[j].callback = nullptr; Anim[j].callbackdata = nullptr; @@ -2580,7 +2577,7 @@ short AnimSetCallback(short anim_ndx, ANIM_CALLBACKp call, SECTOR_OBJECT* data) return anim_ndx; } -short AnimSetVelAdj(short anim_ndx, short vel_adj) +short AnimSetVelAdj(short anim_ndx, double vel_adj) { ASSERT(anim_ndx < AnimCnt); diff --git a/source/games/sw/src/track.cpp b/source/games/sw/src/track.cpp index 91a99cb36..cd530aa00 100644 --- a/source/games/sw/src/track.cpp +++ b/source/games/sw/src/track.cpp @@ -2049,7 +2049,7 @@ void MoveZ(SECTOR_OBJECT* sop) { for (i = 0, sectp = &sop->sectp[0]; *sectp; sectp++, i++) { - AnimSet(ANIM_Floorz, *sectp, sop->zorig_floor[i] + sop->z_tgt, sop->z_rate); + AnimSet(ANIM_Floorz, *sectp, (sop->zorig_floor[i] + sop->z_tgt) * zinttoworld, sop->z_rate); } sop->flags &= ~(SOBJ_ZDOWN); @@ -2058,7 +2058,7 @@ void MoveZ(SECTOR_OBJECT* sop) { for (i = 0, sectp = &sop->sectp[0]; *sectp; sectp++, i++) { - AnimSet(ANIM_Floorz, *sectp, sop->zorig_floor[i] + sop->z_tgt, sop->z_rate); + AnimSet(ANIM_Floorz, *sectp, (sop->zorig_floor[i] + sop->z_tgt) * zinttoworld, sop->z_rate); } sop->flags &= ~(SOBJ_ZUP); @@ -2111,7 +2111,7 @@ void CallbackSOsink(ANIM* ap, void *data) { if (§ == destsect) { - ndx = AnimSet(ANIM_SUdepth, destsect, IntToFixed(tgt_depth), (ap->vel << 8) >> 8); + ndx = AnimSet(ANIM_SUdepth, destsect, IntToFixed(tgt_depth), ap->vel); AnimSetVelAdj(ndx, ap->vel_adj); found = true; break; @@ -2127,7 +2127,7 @@ void CallbackSOsink(ANIM* ap, void *data) continue; // move sprite WAY down in water - ndx = AnimSet(ANIM_Userz, 0, actor, -actor->user.int_upos().Z - int_ActorSizeZ(actor) - Z(100), ap->vel>>8); + ndx = AnimSet(ANIM_Userz, 0, actor, -actor->user.pos.Z - ActorSizeZ(actor) - 100, ap->vel / 256); AnimSetVelAdj(ndx, ap->vel_adj); } @@ -2375,9 +2375,9 @@ void DoTrack(SECTOR_OBJECT* sop, short locktics, int *nx, int *ny) if (sop->sectp[i]->hasU() && (sop->sectp[i]->flags & SECTFU_SO_DONT_SINK)) continue; - ndx = AnimSet(ANIM_Floorz, *sectp, dest_sector->int_floorz(), tpoint->tag_high); + ndx = AnimSet(ANIM_Floorz, *sectp, dest_sector->floorz, tpoint->tag_high); AnimSetCallback(ndx, CallbackSOsink, sop); - AnimSetVelAdj(ndx, 6); + AnimSetVelAdj(ndx, 6 * zmaptoworld); } break; @@ -2395,7 +2395,7 @@ void DoTrack(SECTOR_OBJECT* sop, short locktics, int *nx, int *ny) { if ((*sectp) && (*sectp)->stag == SECT_SO_FORM_WHIRLPOOL) { - AnimSet(ANIM_Floorz, *sectp, (*sectp)->int_floorz() + Z((*sectp)->height), 128); + AnimSet(ANIM_Floorz, *sectp, (*sectp)->floorz + (*sectp)->height, 128); (*sectp)->floorshade += (*sectp)->height / 6; (*sectp)->extra &= ~(SECTFX_NO_RIDE); @@ -2421,7 +2421,7 @@ void DoTrack(SECTOR_OBJECT* sop, short locktics, int *nx, int *ny) tpoint = Track[sop->track].TrackPoint + sop->point; // set anim - AnimSet(ANIM_SopZ, int(sop-SectorObject), nullptr, tpoint->z, zr); + AnimSet(ANIM_SopZ, int(sop-SectorObject), nullptr, tpoint->z * zinttoworld, zr); // move back to current point by reversing direction sop->dir *= -1; @@ -2516,14 +2516,14 @@ void DoTrack(SECTOR_OBJECT* sop, short locktics, int *nx, int *ny) if ((sop->flags & SOBJ_SPRITE_OBJ)) { // only modify zmid for sprite_objects - AnimSet(ANIM_SopZ, int(sop - SectorObject), nullptr, dz, sop->z_rate); + AnimSet(ANIM_SopZ, int(sop - SectorObject), nullptr, dz * zinttoworld, sop->z_rate); } else { // churn through sectors setting their new z values for (i = 0; sop->sectp[i] != nullptr; i++) { - AnimSet(ANIM_Floorz, sop->sectp[i], dz - (sop->mid_sector->int_floorz() - sop->sectp[i]->int_floorz()), sop->z_rate); + AnimSet(ANIM_Floorz, sop->sectp[i], dz * zinttoworld - (sop->mid_sector->floorz - sop->sectp[i]->floorz), sop->z_rate); } } }