From 1a64d18349ae29254a09a75e575890a164d0b1f7 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 12 Sep 2022 21:26:17 +0200 Subject: [PATCH] - floatified RR hitscan teleporter stuff and other minor things. --- source/games/duke/src/actors_d.cpp | 2 +- source/games/duke/src/actors_r.cpp | 2 +- source/games/duke/src/gameexec.cpp | 4 ++-- source/games/duke/src/player_r.cpp | 24 ++++++++++++------------ 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/source/games/duke/src/actors_d.cpp b/source/games/duke/src/actors_d.cpp index 8e6e67544..f6b118eae 100644 --- a/source/games/duke/src/actors_d.cpp +++ b/source/games/duke/src/actors_d.cpp @@ -3469,7 +3469,7 @@ void moveeffectors_d(void) //STATNUM 3 auto sc = act->sector(); if (sc->wallnum != 4) continue; auto wal = sc->firstWall() + 2; - if (wal->nextSector()) alignflorslope(act->sector(), wal->wall_int_pos().X, wal->wall_int_pos().Y, wal->nextSector()->int_floorz()); + if (wal->nextSector()) alignflorslope(act->sector(), DVector3(wal->pos, wal->nextSector()->floorz)); } } diff --git a/source/games/duke/src/actors_r.cpp b/source/games/duke/src/actors_r.cpp index 17441b676..e11950a88 100644 --- a/source/games/duke/src/actors_r.cpp +++ b/source/games/duke/src/actors_r.cpp @@ -3428,7 +3428,7 @@ void moveeffectors_r(void) //STATNUM 3 auto sc = act->sector(); if (sc->wallnum != 4) continue; auto wal = sc->firstWall() + 2; - alignflorslope(act->sector(), wal->wall_int_pos().X, wal->wall_int_pos().Y, wal->nextSector()->int_floorz()); + if (wal->nextSector()) alignflorslope(act->sector(), DVector3(wal->pos, wal->nextSector()->floorz)); } } diff --git a/source/games/duke/src/gameexec.cpp b/source/games/duke/src/gameexec.cpp index d6cd760de..8201a0bee 100644 --- a/source/games/duke/src/gameexec.cpp +++ b/source/games/duke/src/gameexec.cpp @@ -953,10 +953,10 @@ void DoWall(bool bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor, i switch (lLabelID) { case WALL_X: - if (!bSet) SetGameVarID(lVar2, wallp->wall_int_pos().X, sActor, sPlayer); + if (!bSet) SetGameVarID(lVar2, wallp->pos.X / maptoworld, sActor, sPlayer); break; case WALL_Y: - if (bSet) SetGameVarID(lVar2, wallp->wall_int_pos().Y, sActor, sPlayer); + if (!bSet) SetGameVarID(lVar2, wallp->pos.Y / maptoworld, sActor, sPlayer); break; case WALL_POINT2: if (!bSet) SetGameVarID(lVar2, wallp->point2, sActor, sPlayer); diff --git a/source/games/duke/src/player_r.cpp b/source/games/duke/src/player_r.cpp index fdae2da6f..35df62a09 100644 --- a/source/games/duke/src/player_r.cpp +++ b/source/games/duke/src/player_r.cpp @@ -114,18 +114,18 @@ static void shootmelee(DDukeActor *actor, int p, int sx, int sy, int sz, int sa, if (effector->sector() == hit.hitSector && effector->spr.picnum == SECTOREFFECTOR && effector->GetOwner() && effector->spr.lotag == SE_7_TELEPORT) { - int nx, ny, nz; - nx = hit.int_hitpos().X + (effector->GetOwner()->int_pos().X - effector->int_pos().X); - ny = hit.int_hitpos().Y + (effector->GetOwner()->int_pos().Y - effector->int_pos().Y); + DVector3 npos; + npos.XY() = hit.hitpos.XY() + (effector->GetOwner()->spr.pos.XY() - effector->spr.pos.XY()); if (hit.hitSector->lotag == 161) { - nz = effector->GetOwner()->sector()->int_floorz(); + npos.Z = effector->GetOwner()->sector()->floorz; } else { - nz = effector->GetOwner()->sector()->int_ceilingz(); + npos.Z = effector->GetOwner()->sector()->ceilingz; } - hitscan(vec3_t( nx, ny, nz ), effector->GetOwner()->sector(), { bcos(sa), bsin(sa), zvel << 6 }, hit, CLIPMASK1); + auto ang = DAngle::fromBuild(sa); + hitscan(npos, effector->GetOwner()->sector(), DVector3(ang.ToVector() * 1024, zvel * 0.25), hit, CLIPMASK1); break; } } @@ -269,18 +269,18 @@ static void shootweapon(DDukeActor* actor, int p, int sx, int sy, int sz, int sa if (effector->sector() == hit.hitSector && effector->spr.picnum == SECTOREFFECTOR && effector->GetOwner() && effector->spr.lotag == SE_7_TELEPORT) { - int nx, ny, nz; - nx = hit.int_hitpos().X + (effector->GetOwner()->int_pos().X - effector->int_pos().X); - ny = hit.int_hitpos().Y + (effector->GetOwner()->int_pos().Y - effector->int_pos().Y); + DVector3 npos; + npos.XY() = hit.hitpos.XY() + (effector->GetOwner()->spr.pos.XY() - effector->spr.pos.XY()); if (hit.hitSector->lotag == 161) { - nz = effector->GetOwner()->sector()->int_floorz(); + npos.Z = effector->GetOwner()->sector()->floorz; } else { - nz = effector->GetOwner()->sector()->int_ceilingz(); + npos.Z = effector->GetOwner()->sector()->ceilingz; } - hitscan(vec3_t( nx, ny, nz ), effector->GetOwner()->sector(), { bcos(sa), bsin(sa), zvel << 6 }, hit, CLIPMASK1); + auto ang = DAngle::fromBuild(sa); + hitscan(npos, effector->GetOwner()->sector(), DVector3(ang.ToVector() * 1024, zvel * 0.25), hit, CLIPMASK1); break; } }