From a8005d5cec6ed8c1a2fe06e194101f4d832f03e7 Mon Sep 17 00:00:00 2001 From: Alug Date: Mon, 9 Jun 2025 19:22:14 +0200 Subject: [PATCH] fix portals dying due to nummasks being too small and causing an overflow ty hannu! --- src/r_main.cpp | 2 +- src/r_things.cpp | 4 ++-- src/r_things.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/r_main.cpp b/src/r_main.cpp index 80c176ca5..bfbf8781a 100644 --- a/src/r_main.cpp +++ b/src/r_main.cpp @@ -1355,7 +1355,7 @@ static fixed_t viewfov[MAXSPLITSCREENPLAYERS]; void R_RenderPlayerView(player_t *player) { - UINT8 nummasks = 1; + INT32 nummasks = 1; maskcount_t* masks = static_cast(malloc(sizeof(maskcount_t))); const boolean skybox = (skyboxmo[0] && cv_skybox.value); UINT8 i; diff --git a/src/r_things.cpp b/src/r_things.cpp index ba2fa82a5..12286995f 100644 --- a/src/r_things.cpp +++ b/src/r_things.cpp @@ -3016,9 +3016,9 @@ static void R_DrawMaskedList(drawnode_t* head) } } -void R_DrawMasked(maskcount_t* masks, UINT8 nummasks) +void R_DrawMasked(maskcount_t* masks, INT32 nummasks) { - UINT8 i; + INT32 i; drawnode_t *heads; /**< Drawnode lists; as many as number of views/portals. */ heads = static_cast(calloc(nummasks, sizeof(drawnode_t))); diff --git a/src/r_things.h b/src/r_things.h index e042806fa..45f1fc30e 100644 --- a/src/r_things.h +++ b/src/r_things.h @@ -80,7 +80,7 @@ typedef struct sector_t* viewsector; } maskcount_t; -void R_DrawMasked(maskcount_t* masks, UINT8 nummasks); +void R_DrawMasked(maskcount_t* masks, INT32 nummasks); boolean R_ThingVisible(mobj_t *thing); boolean R_ThingWithinDist(mobj_t *thing, INT32 limit_dist);