Skip to content

Commit

Permalink
Minor tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
bradharding committed Dec 20, 2024
1 parent 63f3fef commit 2b6034b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
9 changes: 6 additions & 3 deletions src/r_data.c
Original file line number Diff line number Diff line change
Expand Up @@ -1093,13 +1093,16 @@ int R_TextureNumForName(const char *name)
// to avoid using alloca(), and to improve performance.
void R_PrecacheLevel(void)
{
bool *hitlist = calloc(MAX(numtextures, numflats), sizeof(bool));
bool *hitlist = calloc(MAX(MAX(numsectors, numflats), MAX(numsides, numtextures)), sizeof(bool));

// Precache flats.
for (int i = 0; i < numsectors; i++)
{
hitlist[sectors[i].floorpic] = true;
hitlist[sectors[i].ceilingpic] = true;
if (sectors[i].floorpic > -1)
hitlist[sectors[i].floorpic] = true;

if (sectors[i].ceilingpic > -1)
hitlist[sectors[i].ceilingpic] = true;
}

for (int i = 0; i < numflats; i++)
Expand Down
8 changes: 4 additions & 4 deletions src/r_sky.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ static void PrepareFirePixels(fire_t *fire)

static void SpreadFire(void)
{
for (int x = 0; x < FIREWIDTH; ++x)
for (int y = 1; y < FIREHEIGHT; ++y)
for (int x = 0; x < FIREWIDTH; x++)
for (int y = 1; y < FIREHEIGHT; y++)
{
const int src = y * FIREWIDTH + x;
const int index = fireindices[src];
Expand Down Expand Up @@ -179,8 +179,6 @@ void R_UpdateSky(void)

void R_InitSkyMap(void)
{
InitSkyDefs();

skyflatnum = R_FlatNumForName(SKYFLATNAME);
terraintypes[skyflatnum] = SKY;
skytexture = P_GetMapSky1Texture(gameepisode, gamemap);
Expand Down Expand Up @@ -240,6 +238,8 @@ void R_InitSkyMap(void)
}
}

InitSkyDefs();

skyscrolldelta = (vanilla ? 0 : (int)(P_GetMapSky1ScrollDelta(gameepisode, gamemap) * FRACUNIT));

if (canfreelook)
Expand Down
2 changes: 1 addition & 1 deletion src/wi_interlvl.c
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ interlevel_t *WI_ParseInterlevel(const char *lumpname)
cJSON *js_layer = NULL;
interlevellayer_t *layers = NULL;

if (!(json = cJSON_ParseWithLength(W_CacheLumpNum(lumpnum), W_LumpLength(lumpnum)))
if (!(json = cJSON_ParseWithLength(W_CacheLumpNum(lumpnum), W_LumpLength(lumpnum)))
|| !cJSON_IsObject((data = cJSON_GetObjectItemCaseSensitive(json, "data")))
|| !cJSON_IsString((music = cJSON_GetObjectItemCaseSensitive(data, "music")))
|| !cJSON_IsString((backgroundimage = cJSON_GetObjectItemCaseSensitive(data, "backgroundimage"))))
Expand Down

0 comments on commit 2b6034b

Please sign in to comment.