From e79cd8d87fd9f7646a9f6b14f85194145574a713 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 4 Dec 2021 00:34:20 +0100 Subject: [PATCH] - don't store sprite indices in walltype::portalnum --- source/core/rendering/scene/hw_walls.cpp | 5 +++-- source/games/sw/src/draw.cpp | 5 ++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/source/core/rendering/scene/hw_walls.cpp b/source/core/rendering/scene/hw_walls.cpp index c4db42858..c9374d2c4 100644 --- a/source/core/rendering/scene/hw_walls.cpp +++ b/source/core/rendering/scene/hw_walls.cpp @@ -39,6 +39,7 @@ #include "flatvertices.h" #include "glbackend/glbackend.h" +DCoreActor* wall_to_sprite_actors[8]; // gets updated each frame. Todo: Encapsulate this better without having to permanently store actors in the wall object. //========================================================================== // @@ -589,8 +590,8 @@ void HWWall::PutPortal(HWDrawInfo *di, int ptype, int plane) case PORTALTYPE_LINETOSPRITE: // These are also unique. - assert(seg->portalnum >= 0 && seg->portalnum < MAXSPRITES); - portal = new HWLineToSpritePortal(&portalState, seg, &::sprite[seg->portalnum]); + assert(seg->portalnum >= 0 && seg->portalnum < 8); + portal = new HWLineToSpritePortal(&portalState, seg, &wall_to_sprite_actors[seg->portalnum]->s()); di->Portals.Push(portal); portal->AddLine(this); break; diff --git a/source/games/sw/src/draw.cpp b/source/games/sw/src/draw.cpp index ff7e4217f..e9413d736 100644 --- a/source/games/sw/src/draw.cpp +++ b/source/games/sw/src/draw.cpp @@ -59,6 +59,8 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms #include "razefont.h" EXTERN_CVAR(Bool, testnewrenderer) +extern DCoreActor* wall_to_sprite_actors[8]; + BEGIN_SW_NS int display_mirror; @@ -1366,7 +1368,8 @@ void UpdateWallPortalState() if (!TEST_BOOL1(sp)) { wal->portalflags = PORTAL_WALL_TO_SPRITE; - wal->portalnum = mirror[i].cameraActor->GetSpriteIndex(); + wal->portalnum = i; + wall_to_sprite_actors[i] = mirror[i].cameraActor; } } }