Fix portals

- Resetting portalcullsector fixes the major visual glitches

- Using 32 bits for nummasks and i fixes crashes when rendering lots of portals
This commit is contained in:
Hannu Hanhi 2022-01-25 04:53:09 +02:00
parent 93512ae9f9
commit ba04b045e6
4 changed files with 5 additions and 5 deletions

View file

@ -1450,7 +1450,7 @@ static void Mask_Post (maskcount_t* m)
void R_RenderPlayerView(player_t *player)
{
UINT8 nummasks = 1;
INT32 nummasks = 1;
maskcount_t* masks = malloc(sizeof(maskcount_t));
if (cv_homremoval.value && player == &players[displayplayer]) // if this is display player 1
@ -1515,7 +1515,6 @@ void R_RenderPlayerView(player_t *player)
R_ClipSprites(drawsegs, NULL);
PS_STOP_TIMING(ps_sw_spritecliptime);
// Add skybox portals caused by sky visplanes.
if (cv_skybox.value && skyboxmo[0])
Portal_AddSkyboxPortals();

View file

@ -132,6 +132,7 @@ static portal_t* Portal_Add (const INT16 x1, const INT16 x2)
void Portal_Remove (portal_t* portal)
{
portalcullsector = NULL;
portal_base = portal->next;
Z_Free(portal->ceilingclip);
Z_Free(portal->floorclip);

View file

@ -3168,10 +3168,10 @@ static void R_DrawMaskedList (drawnode_t* head)
}
}
void R_DrawMasked(maskcount_t* masks, UINT8 nummasks)
void R_DrawMasked(maskcount_t* masks, INT32 nummasks)
{
drawnode_t *heads; /**< Drawnode lists; as many as number of views/portals. */
SINT8 i;
INT32 i;
heads = calloc(nummasks, sizeof(drawnode_t));

View file

@ -100,7 +100,7 @@ typedef struct
sector_t* viewsector;
} maskcount_t;
void R_DrawMasked(maskcount_t* masks, UINT8 nummasks);
void R_DrawMasked(maskcount_t* masks, INT32 nummasks);
// ----------
// VISSPRITES