From 03da70b3b95edab2616d00aaf5d151f73afead64 Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Thu, 30 Dec 2021 23:29:01 +1100 Subject: [PATCH] - SW: Replace `PLAYERstruct` `si*` variables with a vector. --- source/games/sw/src/draw.cpp | 18 +++++++++--------- source/games/sw/src/game.h | 2 +- source/games/sw/src/player.cpp | 6 +++--- source/games/sw/src/save.cpp | 6 +++--- wadsrc/static/zscript/games/sw/swgame.zs | 1 - 5 files changed, 16 insertions(+), 17 deletions(-) diff --git a/source/games/sw/src/draw.cpp b/source/games/sw/src/draw.cpp index 4daa51282..37b53da7e 100644 --- a/source/games/sw/src/draw.cpp +++ b/source/games/sw/src/draw.cpp @@ -345,7 +345,7 @@ void DoShadows(tspritetype* tsprite, int& spritesortcnt, tspritetype* tsp, int v else if (!testnewrenderer) { // Alter the shadow's position so that it appears behind the sprite itself. - int look = getangle(tSpr->pos.X - Player[screenpeek].six, tSpr->pos.Y - Player[screenpeek].siy); + int look = getangle(tSpr->pos.X - Player[screenpeek].si.X, tSpr->pos.Y - Player[screenpeek].si.Y); tSpr->pos.X += bcos(look, -9); tSpr->pos.Y += bsin(look, -9); } @@ -776,16 +776,16 @@ void analyzesprites(tspritetype* tsprite, int& spritesortcnt, int viewx, int vie { // move sprite forward some so he looks like he's // climbing - tsp->pos.X = pp->six + MOVEx(128 + 80, tsp->ang); - tsp->pos.Y = pp->siy + MOVEy(128 + 80, tsp->ang); + tsp->pos.X = pp->si.X + MOVEx(128 + 80, tsp->ang); + tsp->pos.Y = pp->si.Y + MOVEy(128 + 80, tsp->ang); } else { - tsp->pos.X = pp->six; - tsp->pos.Y = pp->siy; + tsp->pos.X = pp->si.X; + tsp->pos.Y = pp->si.Y; } - tsp->pos.Z = tsp->pos.Z + pp->siz; + tsp->pos.Z = tsp->pos.Z + pp->si.Z; tsp->ang = pp->siang; //continue; } @@ -1445,9 +1445,9 @@ void drawscreen(PLAYERp pp, double smoothratio) updatesectorz(tx, ty, tz, &tsect); } - pp->six = tx; - pp->siy = ty; - pp->siz = tz - pp->pos.Z; + pp->si.X = tx; + pp->si.Y = ty; + pp->si.Z = tz - pp->pos.Z; pp->siang = tang.asbuild(); QuakeViewChange(camerapp, &quake_z, &quake_x, &quake_y, &quake_ang); diff --git a/source/games/sw/src/game.h b/source/games/sw/src/game.h index 8af1526d7..24ad1f76f 100644 --- a/source/games/sw/src/game.h +++ b/source/games/sw/src/game.h @@ -628,7 +628,7 @@ struct PLAYERstruct SECTORp hi_sectp, lo_sectp; int circle_camera_dist; - int six,siy,siz; // save player interp position for PlayerSprite + vec3_t si; // save player interp position for PlayerSprite int16_t siang; int xvect, yvect; diff --git a/source/games/sw/src/player.cpp b/source/games/sw/src/player.cpp index b84cc4578..8ddaf89ae 100644 --- a/source/games/sw/src/player.cpp +++ b/source/games/sw/src/player.cpp @@ -7082,9 +7082,9 @@ DEFINE_FIELD_X(SWPlayer, PLAYERstruct, loz) DEFINE_FIELD_X(SWPlayer, PLAYERstruct, ceiling_dist) DEFINE_FIELD_X(SWPlayer, PLAYERstruct, floor_dist) DEFINE_FIELD_X(SWPlayer, PLAYERstruct, circle_camera_dist) -DEFINE_FIELD_X(SWPlayer, PLAYERstruct, six) -DEFINE_FIELD_X(SWPlayer, PLAYERstruct, siy) -DEFINE_FIELD_X(SWPlayer, PLAYERstruct, siz) +//DEFINE_FIELD_X(SWPlayer, PLAYERstruct, six) +//DEFINE_FIELD_X(SWPlayer, PLAYERstruct, siy) +//DEFINE_FIELD_X(SWPlayer, PLAYERstruct, siz) DEFINE_FIELD_X(SWPlayer, PLAYERstruct, siang) DEFINE_FIELD_X(SWPlayer, PLAYERstruct, xvect) DEFINE_FIELD_X(SWPlayer, PLAYERstruct, yvect) diff --git a/source/games/sw/src/save.cpp b/source/games/sw/src/save.cpp index eda29f755..4693ac5a7 100644 --- a/source/games/sw/src/save.cpp +++ b/source/games/sw/src/save.cpp @@ -461,9 +461,9 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, PLAYERstruct& w, P ("lo_sp", w.lowActor) ("last_camera_sp", w.last_camera_act) ("circle_camera_dist", w.circle_camera_dist) - ("six", w.six) - ("siy", w.siy) - ("siz", w.siz) + ("six", w.si.X) + ("siy", w.si.Y) + ("siz", w.si.Z) ("siang", w.siang) ("xvect", w.xvect) ("yvect", w.yvect) diff --git a/wadsrc/static/zscript/games/sw/swgame.zs b/wadsrc/static/zscript/games/sw/swgame.zs index b4b8a84f0..4f56c2498 100644 --- a/wadsrc/static/zscript/games/sw/swgame.zs +++ b/wadsrc/static/zscript/games/sw/swgame.zs @@ -194,7 +194,6 @@ struct SWPlayer native native int hiz,loz; native int ceiling_dist,floor_dist; native int circle_camera_dist; - native int six,siy,siz; // save player interp position for PlayerSprite native int16 siang; native int xvect, yvect;