- don't store sprite indices in walltype::portalnum

This commit is contained in:
Christoph Oelckers 2021-12-04 00:34:20 +01:00
parent f855b1020f
commit e79cd8d87f
2 changed files with 7 additions and 3 deletions

View file

@ -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;

View file

@ -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;
}
}
}