From e26d9106aad07e836c3cb3c6d32fff34cb47ba9e Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 6 Dec 2022 21:49:04 +0100 Subject: [PATCH] - handle all occurences of tileWidth and tileHeight using spritetypebase::picnum. --- source/core/defparser.cpp | 5 +++-- source/core/gamefuncs.cpp | 3 ++- source/core/psky.cpp | 2 +- source/games/blood/src/actor.cpp | 3 ++- source/games/blood/src/aiunicult.cpp | 6 ++++-- source/games/blood/src/callback.cpp | 14 ++++++++++---- source/games/blood/src/nnexts.cpp | 9 ++++++--- source/games/duke/src/actors_d.cpp | 5 ++++- source/games/duke/src/actors_r.cpp | 6 ++++-- source/games/duke/src/gameexec.cpp | 3 ++- source/games/duke/src/player_d.cpp | 18 ++++++++++++------ source/games/duke/src/player_r.cpp | 15 ++++++++++----- source/games/duke/src/types.h | 4 +++- source/games/duke/src/vmexports.cpp | 3 ++- source/games/exhumed/src/bullet.cpp | 3 ++- source/games/exhumed/src/move.cpp | 3 ++- source/games/sw/src/actor.cpp | 6 ++++-- source/games/sw/src/draw.cpp | 3 ++- source/games/sw/src/game.h | 3 ++- 19 files changed, 77 insertions(+), 37 deletions(-) diff --git a/source/core/defparser.cpp b/source/core/defparser.cpp index 9c096885d..ceb2f4622 100644 --- a/source/core/defparser.cpp +++ b/source/core/defparser.cpp @@ -147,7 +147,8 @@ void processTileImport(const char* cmd, FScriptPosition& pos, TileImport& imp) if (imp.crc32 != INT64_MAX && int(imp.crc32) != tileGetCRC32(imp.tile)) return; - if (imp.sizex != INT_MAX && tileWidth(imp.tile) != imp.sizex && tileHeight(imp.tile) != imp.sizey) + auto tex = tileGetTexture(imp.tile); + if (imp.sizex != INT_MAX && tex->GetTexelWidth() != imp.sizex && tex->GetTexelHeight() != imp.sizey) return; imp.alphacut = clamp(imp.alphacut, 0, 255); @@ -160,7 +161,7 @@ void processTileImport(const char* cmd, FScriptPosition& pos, TileImport& imp) // This is not quite the same as originally, for two reasons: // 1: Since these are texture properties now, there's no need to clear them. // 2: The original code assumed that an imported texture cannot have an offset. But this can import Doom patches and PNGs with grAb, so the situation is very different. - auto tex = tileGetTexture(imp.tile); + tex = tileGetTexture(imp.tile); // this is not the same texture as above anymore! if (imp.xoffset == INT_MAX) imp.xoffset = tex->GetTexelLeftOffset(); else imp.xoffset = clamp(imp.xoffset, -128, 127); diff --git a/source/core/gamefuncs.cpp b/source/core/gamefuncs.cpp index ff1076a03..b133ac230 100644 --- a/source/core/gamefuncs.cpp +++ b/source/core/gamefuncs.cpp @@ -532,7 +532,8 @@ double intersectSprite(DCoreActor* actor, const DVector3& start, const DVector3& if (factor < 0 || factor > maxfactor) return -1; - auto sprwidth = tileWidth(actor->spr.picnum) * actor->spr.scale.X * 0.5; + auto tex = TexMan.GetGameTexture(actor->spr.spritetexture()); + auto sprwidth = tex->GetDisplayWidth() * actor->spr.scale.X * 0.5; auto point = start + direction * factor; // Using proper distance here, Build originally used the sum of x- and y-distance diff --git a/source/core/psky.cpp b/source/core/psky.cpp index db4352b30..77f69c74d 100644 --- a/source/core/psky.cpp +++ b/source/core/psky.cpp @@ -98,7 +98,7 @@ SkyDefinition getSky(int tilenum) result = {}; result.scale = 1.f; } - int w = tileWidth(tilenum); + int w = tileWidth(tilenum); if (result.lognumtiles == 0 || w >= 256) { if (w < 512) result.lognumtiles = 2; diff --git a/source/games/blood/src/actor.cpp b/source/games/blood/src/actor.cpp index 0d24d760f..5f99029dc 100644 --- a/source/games/blood/src/actor.cpp +++ b/source/games/blood/src/actor.cpp @@ -2573,7 +2573,8 @@ static void ConcussSprite(DBloodActor* source, DBloodActor* actor, const DVector if (mass > 0) { - double size = (tileWidth(actor->spr.picnum) * actor->spr.scale.X * tileHeight(actor->spr.picnum) * actor->spr.scale.Y) / 0x20000; + auto tex = TexMan.GetGameTexture(actor->spr.spritetexture()); + double size = (tex->GetDisplayWidth() * actor->spr.scale.X * tex->GetDisplayHeight() * actor->spr.scale.Y) / 0x20000; actor->vel += vect * Scale(damage, size, mass); } } diff --git a/source/games/blood/src/aiunicult.cpp b/source/games/blood/src/aiunicult.cpp index bd4e14571..dab550bdc 100644 --- a/source/games/blood/src/aiunicult.cpp +++ b/source/games/blood/src/aiunicult.cpp @@ -881,9 +881,11 @@ static void unicultThinkChase(DBloodActor* actor) return; } + auto tex1 = TexMan.GetGameTexture(hitactor->spr.spritetexture()); + auto tex2 = TexMan.GetGameTexture(actor->spr.spritetexture()); - double wd1 = tileWidth(hitactor->spr.picnum) * hitactor->spr.scale.X; - double wd2 = tileWidth(actor->spr.picnum) * actor->spr.scale.X; + double wd1 = tex1->GetDisplayWidth() * hitactor->spr.scale.X; + double wd2 = tex2->GetDisplayWidth() * actor->spr.scale.X; if (wd1 < (wd2 * 8)) { //viewSetSystemMessage("OBJ SIZE: %d DUDE SIZE: %d", wd1, wd2); diff --git a/source/games/blood/src/callback.cpp b/source/games/blood/src/callback.cpp index 4e973738f..5b39f0fe5 100644 --- a/source/games/blood/src/callback.cpp +++ b/source/games/blood/src/callback.cpp @@ -41,9 +41,10 @@ void fxFlameLick(DBloodActor* actor, sectortype*) // 0 if (!actor) return; double top, bottom; GetActorExtents(actor, &top, &bottom); + auto tex = TexMan.GetGameTexture(actor->spr.spritetexture()); + double nDist = (actor->spr.scale.X * tex->GetDisplayWidth()) * (1. / 4); for (int i = 0; i < 3; i++) { - double nDist = (actor->spr.scale.X * tileWidth(actor->spr.picnum)) * (1. / 4); DAngle nAngle = RandomAngle(); DVector2 dv = nAngle.ToVector() * nDist; DVector2 pos = actor->spr.pos.XY() + dv; @@ -223,7 +224,8 @@ void fxDynPuff(DBloodActor* actor, sectortype*) // 8 if (!actor) return; if (actor->vel.Z) { - double nDist = (actor->spr.scale.X * tileWidth(actor->spr.picnum)) * (1. / 2); + auto tex = TexMan.GetGameTexture(actor->spr.spritetexture()); + double nDist = (actor->spr.scale.X * tex->GetDisplayWidth()) * (1. / 2); DVector3 pos = actor->spr.pos + (actor->spr.Angles.Yaw - DAngle90).ToVector() * nDist; auto pFX = gFX.fxSpawnActor(FX_7, actor->sector(), pos); if (pFX) @@ -340,9 +342,12 @@ void PlayerBubble(DBloodActor* actor, sectortype*) // 10 return; double top, bottom; GetActorExtents(actor, &top, &bottom); + + auto tex = TexMan.GetGameTexture(actor->spr.spritetexture()); + double nDist = (actor->spr.scale.X * tex->GetDisplayWidth()) * (1. / 2); + for (int i = 0; i < (pPlayer->bubbleTime >> 6); i++) { - double nDist = (actor->spr.scale.X * tileWidth(actor->spr.picnum)) * (1. / 2); DVector2 pos = actor->spr.pos.XY() + actor->spr.Angles.Yaw.ToVector() * nDist; double z = bottom - RandomD(bottom - top, 8); auto pFX = gFX.fxSpawnActor((FX_ID)(FX_23 + Random(3)), actor->sector(), DVector3(pos, z)); @@ -368,10 +373,11 @@ void EnemyBubble(DBloodActor* actor, sectortype*) // 11 if (!actor) return; double top, bottom; GetActorExtents(actor, &top, &bottom); + auto tex = TexMan.GetGameTexture(actor->spr.spritetexture()); + double nDist = (actor->spr.scale.X * tex->GetDisplayWidth()) * (1. / 2); for (int i = 0; i < int(abs(actor->vel.Z) * 0.25); i++) { auto nAngle = RandomAngle(); - double nDist = (actor->spr.scale.X * tileWidth(actor->spr.picnum)) * (1. / 2); DVector2 pos = actor->spr.pos.XY() + nAngle.ToVector() * nDist; double z = bottom - RandomD(bottom - top, 8); diff --git a/source/games/blood/src/nnexts.cpp b/source/games/blood/src/nnexts.cpp index c80d17762..d88469d73 100644 --- a/source/games/blood/src/nnexts.cpp +++ b/source/games/blood/src/nnexts.cpp @@ -1557,7 +1557,8 @@ void debrisConcuss(DBloodActor* owneractor, int listIndex, const DVector3& pos, dmg = int(dmg * (0x4000 / (0x4000 + dv.LengthSquared()))); bool thing = (actor->spr.type >= kThingBase && actor->spr.type < kThingMax); - double size = (tileWidth(actor->spr.picnum) * actor->spr.scale.X * tileHeight(actor->spr.picnum) * actor->spr.scale.Y) * 2048; + auto tex = TexMan.GetGameTexture(actor->spr.spritetexture()); + double size = (tex->GetDisplayWidth() * actor->spr.scale.X * tex->GetDisplayHeight() * actor->spr.scale.Y) * 2048; if (actor->xspr.physAttr & kPhysDebrisExplode) { if (actor->spriteMass.mass > 0) @@ -1588,9 +1589,11 @@ void debrisBubble(DBloodActor* actor) { double top, bottom; GetActorExtents(actor, &top, &bottom); - for (unsigned int i = 0; i < 1 + Random(5); i++) { - double nDist = actor->spr.scale.X * tileWidth(actor->spr.picnum) * 0.5; // original code ended with * 8 which is 1/2 map unit. + auto tex = TexMan.GetGameTexture(actor->spr.spritetexture()); + double nDist = (actor->spr.scale.X * tex->GetDisplayWidth()) * (1. / 2); + for (unsigned int i = 0; i < 1 + Random(5); i++) + { DAngle nAngle = RandomAngle(); DVector3 pos; pos.XY() = actor->spr.pos.XY() + nAngle.ToVector() * nDist; diff --git a/source/games/duke/src/actors_d.cpp b/source/games/duke/src/actors_d.cpp index e2f849e3d..b8850354b 100644 --- a/source/games/duke/src/actors_d.cpp +++ b/source/games/duke/src/actors_d.cpp @@ -39,6 +39,7 @@ This file contains parts of DukeGDX by Alexander Makarov-[M210] (m210-2007@mail. #include "names_d.h" #include "serializer.h" #include "dukeactor.h" +#include "texturemanager.h" BEGIN_DUKE_NS @@ -406,7 +407,9 @@ int movesprite_ex_d(DDukeActor* actor, const DVector3& change, unsigned int clip auto dasectp = actor->sector(); auto ppos = actor->spr.pos; - ppos.Z -= (tileHeight(actor->spr.picnum) * actor->spr.scale.Y) * 0.5; + + auto tex = TexMan.GetGameTexture(actor->spr.spritetexture()); + ppos.Z -= tex->GetDisplayHeight() * actor->spr.scale.Y * 0.5; if (bg) { diff --git a/source/games/duke/src/actors_r.cpp b/source/games/duke/src/actors_r.cpp index 4bea43634..1873a86da 100644 --- a/source/games/duke/src/actors_r.cpp +++ b/source/games/duke/src/actors_r.cpp @@ -326,7 +326,8 @@ int movesprite_ex_r(DDukeActor* actor, const DVector3& change, unsigned int clip auto dasectp = actor->sector(); auto ppos = actor->spr.pos; - ppos.Z -= (tileHeight(actor->spr.picnum) * actor->spr.scale.Y) * 0.5; + auto tex = TexMan.GetGameTexture(actor->spr.spritetexture()); + ppos.Z -= tex->GetDisplayHeight() * actor->spr.scale.Y * 0.5; if (bg) { @@ -996,7 +997,8 @@ static void rrra_specialstats() else if (enemysizecheat == 2) { act->spr.scale *= 0.5; - act->clipdist = act->spr.scale.X, tileHeight(act->spr.picnum) * 0.125; + auto tex = TexMan.GetGameTexture(act->spr.spritetexture()); + act->clipdist = act->spr.scale.X, tex->GetDisplayHeight() * 0.125; } break; } diff --git a/source/games/duke/src/gameexec.cpp b/source/games/duke/src/gameexec.cpp index 7a90f1b55..9f8596082 100644 --- a/source/games/duke/src/gameexec.cpp +++ b/source/games/duke/src/gameexec.cpp @@ -1748,7 +1748,8 @@ int ParseState::parse(void) insptr++; auto scale = g_ac->spr.scale.Y; - if ((g_ac->isPlayer() && scale < 0.5626) || *insptr * REPEAT_SCALE < scale || (scale * (tileHeight(g_ac->spr.picnum) + 8)) < g_ac->floorz - g_ac->ceilingz) + auto tex = TexMan.GetGameTexture(g_ac->spr.spritetexture()); + if ((g_ac->isPlayer() && scale < 0.5626) || *insptr * REPEAT_SCALE < scale || (scale * (tex->GetDisplayHeight() + 8)) < g_ac->floorz - g_ac->ceilingz) { siz = ((*insptr) * REPEAT_SCALE - g_ac->spr.scale.Y); g_ac->spr.scale.Y = (clamp(g_ac->spr.scale.Y + Sgn(siz) * REPEAT_SCALE, 0., 4.)); diff --git a/source/games/duke/src/player_d.cpp b/source/games/duke/src/player_d.cpp index 5b0ce030c..08089b2ff 100644 --- a/source/games/duke/src/player_d.cpp +++ b/source/games/duke/src/player_d.cpp @@ -331,7 +331,8 @@ static void shootweapon(DDukeActor *actor, int p, DVector3 pos, DAngle ang, int if (aimed) { - double dal = ((aimed->spr.scale.X * tileHeight(aimed->spr.picnum)) * 0.5) + 5; + auto tex = TexMan.GetGameTexture(aimed->spr.spritetexture()); + double dal = ((aimed->spr.scale.X * tex->GetDisplayHeight()) * 0.5) + 5; switch (aimed->spr.picnum) { case DTILE_GREENSLIME: @@ -584,7 +585,8 @@ static void shootstuff(DDukeActor* actor, int p, DVector3 pos, DAngle ang, int a if (aimed) { - double dal = ((aimed->spr.scale.X * tileHeight(aimed->spr.picnum)) * 0.5) - 12; + auto tex = TexMan.GetGameTexture(aimed->spr.spritetexture()); + double dal = ((aimed->spr.scale.X * tex->GetDisplayHeight()) * 0.5) - 12; double dist = (ps[p].GetActor()->spr.pos.XY() - aimed->spr.pos.XY()).Length(); zvel = ((aimed->spr.pos.Z - pos.Z - dal) * vel) / dist; @@ -671,7 +673,8 @@ static void shootrpg(DDukeActor *actor, int p, DVector3 pos, DAngle ang, int atw aimed = aim(actor, AUTO_AIM_ANGLE); if (aimed) { - double dal = ((aimed->spr.scale.X * tileHeight(aimed->spr.picnum)) * 0.5) + 8; + auto tex = TexMan.GetGameTexture(aimed->spr.spritetexture()); + double dal = ((aimed->spr.scale.X * tex->GetDisplayHeight()) * 0.5) + 8; double dist = (ps[p].GetActor()->spr.pos.XY() - aimed->spr.pos.XY()).Length(); zvel = ((aimed->spr.pos.Z - pos.Z - dal) * vel) / dist; if (!actorflag(aimed, SFLAG2_SPECIALAUTOAIM)) @@ -896,7 +899,8 @@ static void shootgrowspark(DDukeActor* actor, int p, DVector3 pos, DAngle ang) auto aimed = aim(actor, AUTO_AIM_ANGLE); if (aimed) { - double dal = ((aimed->spr.scale.X * tileHeight(aimed->spr.picnum)) * 0.5) + 5; + auto tex = TexMan.GetGameTexture(aimed->spr.spritetexture()); + double dal = ((aimed->spr.scale.X * tex->GetDisplayHeight()) * 0.5) + 5; switch (aimed->spr.picnum) { case DTILE_GREENSLIME: @@ -999,7 +1003,8 @@ static void shootshrinker(DDukeActor* actor, int p, const DVector3& pos, DAngle auto aimed = isNamWW2GI() ? nullptr : aim(actor, AUTO_AIM_ANGLE); if (aimed) { - double dal = ((aimed->spr.scale.X * tileHeight(aimed->spr.picnum)) * 0.5); + auto tex = TexMan.GetGameTexture(aimed->spr.spritetexture()); + double dal = ((aimed->spr.scale.X * tex->GetDisplayHeight()) * 0.5); double dist = (ps[p].GetActor()->spr.pos.XY() - aimed->spr.pos.XY()).Length(); zvel = ((aimed->spr.pos.Z - pos.Z - dal - 4) * 48) / dist; ang = (aimed->spr.pos.XY() - pos.XY()).Angle(); @@ -1051,7 +1056,8 @@ void shoot_d(DDukeActor* actor, int atwith, PClass *cls) else { p = -1; - spos = actor->spr.pos.plusZ(-(actor->spr.scale.Y * tileHeight(actor->spr.picnum) * 0.5) + 4); + auto tex = TexMan.GetGameTexture(actor->spr.spritetexture()); + spos = actor->spr.pos.plusZ(-(actor->spr.scale.Y * tex->GetDisplayHeight() * 0.5) + 4); if (actor->spr.picnum != DTILE_ROTATEGUN) { diff --git a/source/games/duke/src/player_r.cpp b/source/games/duke/src/player_r.cpp index 7dfc8ac54..5a5c17b6c 100644 --- a/source/games/duke/src/player_r.cpp +++ b/source/games/duke/src/player_r.cpp @@ -213,7 +213,8 @@ static void shootweapon(DDukeActor* actor, int p, DVector3 pos, DAngle ang, int auto aimed = aim(actor, AUTO_AIM_ANGLE); if (aimed) { - double dal = ((aimed->spr.scale.X * tileHeight(aimed->spr.picnum)) * 0.5) + 5; + auto tex = TexMan.GetGameTexture(aimed->spr.spritetexture()); + double dal = ((aimed->spr.scale.X * tex->GetDisplayHeight()) * 0.5) + 5; double dist = (ps[p].GetActor()->spr.pos.XY() - aimed->spr.pos.XY()).Length(); zvel = ((aimed->spr.pos.Z - pos.Z - dal) * 16) / dist; ang = (aimed->spr.pos - pos).Angle(); @@ -495,7 +496,8 @@ static void shootstuff(DDukeActor* actor, int p, DVector3 pos, DAngle ang, int a if (aimed) { - double dal = ((aimed->spr.scale.X * tileHeight(aimed->spr.picnum)) * 0.5) - 12; + auto tex = TexMan.GetGameTexture(aimed->spr.spritetexture()); + double dal = ((aimed->spr.scale.X * tex->GetDisplayHeight()) * 0.5) - 12; double dist = (ps[p].GetActor()->spr.pos.XY() - aimed->spr.pos.XY()).Length(); zvel = ((aimed->spr.pos.Z - pos.Z - dal) * vel) / dist; @@ -581,7 +583,8 @@ static void shootrpg(DDukeActor* actor, int p, DVector3 pos, DAngle ang, int atw else act90 = aimed; } - double dal = ((aimed->spr.scale.X * tileHeight(aimed->spr.picnum)) * 0.5) + 8; + auto tex = TexMan.GetGameTexture(aimed->spr.spritetexture()); + double dal = ((aimed->spr.scale.X * tex->GetDisplayHeight()) * 0.5) + 8; double dist = (ps[p].GetActor()->spr.pos.XY() - aimed->spr.pos.XY()).Length(); zvel = ((aimed->spr.pos.Z - pos.Z - dal) * vel) / dist; if (!actorflag(aimed, SFLAG2_SPECIALAUTOAIM)) @@ -703,7 +706,8 @@ static void shootwhip(DDukeActor* actor, int p, DVector3 pos, DAngle ang, int at if (aimed) { - double dal = ((aimed->spr.scale.X * tileHeight(aimed->spr.picnum)) * 0.5) -12; + auto tex = TexMan.GetGameTexture(aimed->spr.spritetexture()); + double dal = ((aimed->spr.scale.X * tex->GetDisplayHeight()) * 0.5) - 12; double dist = (ps[p].GetActor()->spr.pos.XY() - aimed->spr.pos.XY()).Length(); zvel = ((aimed->spr.pos.Z - pos.Z - dal) * vel) / dist; ang = (aimed->spr.pos.XY() - pos.XY()).Angle(); @@ -792,7 +796,8 @@ void shoot_r(DDukeActor* actor, int atwith, PClass* cls) else { p = -1; - spos = actor->spr.pos.plusZ(-(actor->spr.scale.Y * tileHeight(actor->spr.picnum) * 0.5) - 3); + auto tex = TexMan.GetGameTexture(actor->spr.spritetexture()); + spos = actor->spr.pos.plusZ(-(actor->spr.scale.Y * tex->GetDisplayHeight() * 0.5) - 3); if (badguy(actor)) { diff --git a/source/games/duke/src/types.h b/source/games/duke/src/types.h index 870d696b1..9856f1351 100644 --- a/source/games/duke/src/types.h +++ b/source/games/duke/src/types.h @@ -4,6 +4,7 @@ #include "packet.h" #include "d_net.h" #include "gameinput.h" +#include "texturemanager.h" BEGIN_DUKE_NS @@ -125,7 +126,8 @@ public: void setClipDistFromTile() { - clipdist = spr.scale.X * tileWidth(spr.picnum) * 0.125; + auto tex = TexMan.GetGameTexture(spr.spritetexture()); + clipdist = spr.scale.X * tex->GetDisplayWidth() * 0.125; } }; diff --git a/source/games/duke/src/vmexports.cpp b/source/games/duke/src/vmexports.cpp index fe1e69a15..5f6b31010 100644 --- a/source/games/duke/src/vmexports.cpp +++ b/source/games/duke/src/vmexports.cpp @@ -628,7 +628,8 @@ DEFINE_ACTION_FUNCTION_NATIVE(DDukeActor, checkhitsprite, DukeActor_checkhitspri int duke_spw(DDukeActor* act) { - return tileWidth(act->spr.picnum); + auto tex = TexMan.GetGameTexture(act->spr.spritetexture()); + return (int)tex->GetDisplayWidth(); } DEFINE_ACTION_FUNCTION_NATIVE(DDukeActor, spritewidth, duke_spw) diff --git a/source/games/exhumed/src/bullet.cpp b/source/games/exhumed/src/bullet.cpp index 6652f1081..3ec551ce9 100644 --- a/source/games/exhumed/src/bullet.cpp +++ b/source/games/exhumed/src/bullet.cpp @@ -183,7 +183,8 @@ void IgniteSprite(DExhumedActor* pActor) { pAnimActor->pTarget = pActor; ChangeActorStat(pAnimActor, kStatIgnited); - pAnimActor->spr.scale.Y = (max(1, (tileHeight(pAnimActor->spr.picnum) * 32) / nFlameHeight) * REPEAT_SCALE); + auto tex = TexMan.GetGameTexture(pAnimActor->spr.spritetexture()); + pAnimActor->spr.scale.Y = (max(1.f, (tex->GetDisplayHeight() * 32) / nFlameHeight) * REPEAT_SCALE); } } diff --git a/source/games/exhumed/src/move.cpp b/source/games/exhumed/src/move.cpp index c5073217a..b96095163 100644 --- a/source/games/exhumed/src/move.cpp +++ b/source/games/exhumed/src/move.cpp @@ -402,7 +402,8 @@ Collision movespritez(DExhumedActor* pActor, double z, double height, double cli double GetActorHeight(DExhumedActor* actor) { - return tileHeight(actor->spr.picnum) * actor->spr.scale.Y; + auto tex = TexMan.GetGameTexture(actor->spr.spritetexture()); + return tex->GetDisplayHeight() * actor->spr.scale.Y; } DExhumedActor* insertActor(sectortype* s, int st) diff --git a/source/games/sw/src/actor.cpp b/source/games/sw/src/actor.cpp index e39735272..2517730f2 100644 --- a/source/games/sw/src/actor.cpp +++ b/source/games/sw/src/actor.cpp @@ -711,7 +711,8 @@ int DoActorJump(DSWActor* actor) actor->spr.pos.Z += actor->user.jump_speed * ACTORMOVETICS * JUMP_FACTOR; // if player gets to close the ceiling while jumping - double minh = actor->user.hiz + tileHeight(actor->spr.picnum); + auto tex = TexMan.GetGameTexture(actor->spr.spritetexture()); + double minh = actor->user.hiz + tex->GetDisplayHeight(); if (actor->spr.pos.Z < minh) { // put player at the ceiling @@ -905,7 +906,8 @@ int DoJump(DSWActor* actor) actor->spr.pos.Z += actor->user.jump_speed * ACTORMOVETICS * JUMP_FACTOR; // if player gets to close the ceiling while jumping - double minh = actor->user.hiz + tileHeight(actor->spr.picnum); + auto tex = TexMan.GetGameTexture(actor->spr.spritetexture()); + double minh = actor->user.hiz + tex->GetDisplayHeight(); if (actor->spr.pos.Z < minh) { // put player at the ceiling diff --git a/source/games/sw/src/draw.cpp b/source/games/sw/src/draw.cpp index cac6cc5c3..aa47086ff 100644 --- a/source/games/sw/src/draw.cpp +++ b/source/games/sw/src/draw.cpp @@ -302,7 +302,8 @@ void DoShadows(tspriteArray& tsprites, tspritetype* tsp, double viewz) if (tsp->scale.Y > 0.25) { - double sizey = tileHeight(tsp->picnum) * tsp->scale.Y; + auto tex = TexMan.GetGameTexture(tsp->spritetexture()); + double sizey = tex->GetDisplayHeight() * tsp->scale.Y; scale.Y = (tsp->scale.Y * 0.25) - (sizey / 2048.); scale.X = tsp->scale.X; } diff --git a/source/games/sw/src/game.h b/source/games/sw/src/game.h index 823deccaf..e262fa995 100644 --- a/source/games/sw/src/game.h +++ b/source/games/sw/src/game.h @@ -2045,7 +2045,8 @@ inline DVector3 ActorVectOfMiddle(DSWActor* actor) inline double ActorSizeZ(DSWActor* actor) { - return (tileHeight(actor->spr.picnum) * actor->spr.scale.Y); + auto tex = TexMan.GetGameTexture(actor->spr.spritetexture()); + return (tex->GetDisplayHeight() * actor->spr.scale.Y); } inline double ActorUpperZ(DSWActor* actor)