Skip to content

Commit

Permalink
If the map has an IoS, increase the game zone margin to 32k
Browse files Browse the repository at this point in the history
  • Loading branch information
viciious committed Jun 9, 2024
1 parent 263155c commit 386432c
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 12 deletions.
2 changes: 1 addition & 1 deletion info.h
Original file line number Diff line number Diff line change
Expand Up @@ -895,7 +895,7 @@ MT_SPIDER,
MT_BABY,
MT_CYBORG,
MT_BOSSBRAIN,
MT_BOSSPIT,
MT_BOSSSPIT,
MT_BOSSTARGET,
MT_SPAWNSHOT,
MT_BARREL,
Expand Down
2 changes: 1 addition & 1 deletion p_mobj.c
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,7 @@ void P_SpawnMapThing (mapthing_t *mthing, int thingid)
if (deathmatch_p < deathmatchstarts + MAXDMSTARTS)
D_memcpy (deathmatch_p, mthing, sizeof(*mthing));
deathmatch_p++;
return;
return NULL;
}

/* check for players specially */
Expand Down
14 changes: 11 additions & 3 deletions p_setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ void P_LoadNodes (int lump)
=================
*/

void P_LoadThings (int lump)
void P_LoadThings (int lump, boolean *havebossspit)
{
byte *data;
int i;
Expand All @@ -357,6 +357,7 @@ void P_LoadThings (int lump)
numthings = W_LumpLength (lump) / sizeof(mapthing_t);
numthingsreal = 0;
numstaticthings = 0;
*havebossspit = false;

mt = (mapthing_t *)data;
for (i=0 ; i<numthings ; i++, mt++)
Expand Down Expand Up @@ -390,6 +391,8 @@ void P_LoadThings (int lump)
case 0:
break;
case 1:
if (mt->type == mobjinfo[MT_BOSSSPIT].doomednum)
*havebossspit = true;
numthingsreal++;
break;
case 2:
Expand Down Expand Up @@ -728,6 +731,8 @@ void P_SetupLevel (const char *lumpname, skill_t skill, int skytexture)
extern int cy;
VINT lumpnum, lumps[ML_BLOCKMAP+1];
lumpinfo_t li[ML_BLOCKMAP+1];
boolean havebossspit = false;
int gamezonemargin;

M_ClearRandom ();

Expand Down Expand Up @@ -787,7 +792,7 @@ D_printf ("P_SetupLevel(%s,%i)\n",lumpname,skill);

bodyqueslot = 0;
deathmatch_p = deathmatchstarts;
P_LoadThings (lumpnum+ML_THINGS);
P_LoadThings (lumpnum+ML_THINGS, &havebossspit);

W_LoadPWAD(PWAD_NONE);

Expand Down Expand Up @@ -832,7 +837,10 @@ extern byte *debugscreen;
skytexturep = R_SkipJagObjHeader(skytexturep, W_LumpLength(skytexture), 256, 128);
skycolormaps = (col2sky > 0 && skytexture >= col2sky) ? dc_colormaps2 : dc_colormaps;

R_SetupLevel();
gamezonemargin = DEFAULT_GAME_ZONE_MARGIN;
if (havebossspit)
gamezonemargin *= 4;
R_SetupLevel(gamezonemargin);

I_SetThreadLocalVar(DOOMTLS_VALIDCOUNT, &validcount[0]);

Expand Down
2 changes: 1 addition & 1 deletion p_sight.c
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ static boolean PS_CheckSight2(mobj_t *t1, mobj_t *t2)
static boolean P_MobjCanSightCheck(mobj_t *mobj)
{
// must be killable or be a monster spawner
if (!(mobj->flags & MF_COUNTKILL) && (mobj->type != MT_BOSSPIT))
if (!(mobj->flags & MF_COUNTKILL) && (mobj->type != MT_BOSSSPIT))
return false;

// must be about to change states
Expand Down
7 changes: 5 additions & 2 deletions r_local.h
Original file line number Diff line number Diff line change
Expand Up @@ -276,8 +276,11 @@ void R_InitData (void);
void R_SetViewportSize(int num);
int R_DefaultViewportSize(void); // returns the viewport id for fullscreen, low detail mode
void R_SetDrawFuncs(void);
void R_SetupLevel(void);
void R_SetupTextureCaches(void);
void R_SetupLevel(int gamezonemargin);

// how much memory should be left free in the main zone after allocating the texture cache
// can be increased for the Icon of Sin
#define DEFAULT_GAME_ZONE_MARGIN 8*1024

typedef void (*drawcol_t)(int, int, int, int, fixed_t, fixed_t, inpixel_t*, int);
typedef void (*drawspan_t)(int, int, int, int, fixed_t, fixed_t, fixed_t, fixed_t, inpixel_t*, int);
Expand Down
8 changes: 4 additions & 4 deletions r_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -378,13 +378,13 @@ D_printf ("Done\n");
=
==============
*/
void R_SetupTextureCaches(void)
void R_SetupTextureCaches(int gamezonemargin)
{
int i, j;
int zonefree;
int cachezonesize;
void *margin;
const int zonemargin = 8*1024;
const int zonemargin = gamezonemargin;
const int flatblocksize = sizeof(memblock_t) + ((sizeof(texcacheblock_t) + 15) & ~15) + 64*64 + 32;

// reset pointers from previous level
Expand Down Expand Up @@ -459,9 +459,9 @@ void R_SetupTextureCaches(void)
R_InitTexCacheZone(&r_texcache, 0);
}

void R_SetupLevel(void)
void R_SetupLevel(int gamezonemargin)
{
R_SetupTextureCaches();
R_SetupTextureCaches(gamezonemargin);

R_SetViewportSize(viewportNum);

Expand Down

0 comments on commit 386432c

Please sign in to comment.