# Conflicts:
#	src/f_finale.c
This commit is contained in:
toaster 2021-12-02 17:42:50 +00:00
commit 71f2d638e6
4 changed files with 24 additions and 12 deletions

View file

@ -591,7 +591,6 @@ void DEH_UpdateMaxFreeslots(void)
}
// TODO: Figure out how to do undolines for this....
// TODO: Warnings for running out of freeslots
static void readfreeslots(MYFILE *f)
{
char *s = Z_Malloc(MAXLINELEN, PU_STATIC, NULL);
@ -625,10 +624,12 @@ static void readfreeslots(MYFILE *f)
break;
// TODO: Check for existing freeslot mobjs/states/etc. and make errors.
// TODO: Out-of-slots warnings/errors.
// TODO: Name too long (truncated) warnings.
if (fastcmp(type, "SFX"))
{
CONS_Printf("Sound sfx_%s allocated.\n",word);
S_AddSoundFx(word, false, 0, false);
}
else if (fastcmp(type, "SPR"))
{
for (i = SPR_FIRSTFREESLOT; i <= SPR_LASTFREESLOT; i++)
@ -642,29 +643,40 @@ static void readfreeslots(MYFILE *f)
// Found a free slot!
strncpy(sprnames[i],word,4);
//sprnames[i][4] = 0;
CONS_Printf("Sprite SPR_%s allocated.\n",word);
used_spr[(i-SPR_FIRSTFREESLOT)/8] |= 1<<(i%8); // Okay, this sprite slot has been named now.
break;
}
if (i > SPR_LASTFREESLOT)
I_Error("Out of Sprite Freeslots while allocating \"%s\"\nLoad less addons to fix this.", word);
}
else if (fastcmp(type, "S"))
{
for (i = 0; i < NUMSTATEFREESLOTS; i++)
if (!FREE_STATES[i]) {
CONS_Printf("State S_%s allocated.\n",word);
FREE_STATES[i] = Z_Malloc(strlen(word)+1, PU_STATIC, NULL);
strcpy(FREE_STATES[i],word);
freeslotusage[0][0]++;
break;
}
if (i == NUMSTATEFREESLOTS)
I_Error("Out of State Freeslots while allocating \"%s\"\nLoad less addons to fix this.", word);
}
else if (fastcmp(type, "MT"))
{
for (i = 0; i < NUMMOBJFREESLOTS; i++)
if (!FREE_MOBJS[i]) {
CONS_Printf("MobjType MT_%s allocated.\n",word);
FREE_MOBJS[i] = Z_Malloc(strlen(word)+1, PU_STATIC, NULL);
strcpy(FREE_MOBJS[i],word);
freeslotusage[1][0]++;
break;
}
if (i == NUMMOBJFREESLOTS)
I_Error("Out of Mobj Freeslots while allocating \"%s\"\nLoad less addons to fix this.", word);
}
else
deh_warning("Freeslots: unknown enum class '%s' for '%s_%s'", type, type, word);
@ -9266,7 +9278,7 @@ static inline int lib_freeslot(lua_State *L)
lua_pushinteger(L, sfx);
r++;
} else
return r;
I_Error("Out of Sfx Freeslots while allocating \"%s\"\nLoad less addons to fix this.", word); //Should never get here since S_AddSoundFx was changed to throw I_Error when it can't allocate
}
else if (fastcmp(type, "SPR"))
{
@ -9293,7 +9305,7 @@ static inline int lib_freeslot(lua_State *L)
break;
}
if (j > SPR_LASTFREESLOT)
return r;
I_Error("Out of Sprite Freeslots while allocating \"%s\"\nLoad less addons to fix this.", word);
}
else if (fastcmp(type, "S"))
{
@ -9309,7 +9321,7 @@ static inline int lib_freeslot(lua_State *L)
break;
}
if (i == NUMSTATEFREESLOTS)
return r;
I_Error("Out of State Freeslots while allocating \"%s\"\nLoad less addons to fix this.", word);
}
else if (fastcmp(type, "MT"))
{
@ -9325,7 +9337,7 @@ static inline int lib_freeslot(lua_State *L)
break;
}
if (i == NUMMOBJFREESLOTS)
return r;
I_Error("Out of Mobj Freeslots while allocating \"%s\"\nLoad less addons to fix this.", word);
}
Z_Free(s);
lua_remove(L, 1);

View file

@ -444,9 +444,9 @@ static const char *credits[] = {
"\"ZarroTsu\"",
"",
"\1Support Programming",
"James R.",
"\"Lat\'\"",
"\"Monster Iestyn\"",
"James Robert Roman",
"\"Shuffle\"",
"\"SteelT\"",
"",

View file

@ -2879,7 +2879,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
break;
case 432: // Enable 2D Mode (Disable if noclimb)
if (mo->player)
if (mo && mo->player)
{
if (line->flags & ML_NOCLIMB)
mo->flags2 &= ~MF2_TWOD;
@ -2905,7 +2905,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
break;
case 434: // Custom Power
if (mo->player)
if (mo && mo->player)
{
mobj_t *dummy = P_SpawnMobj(mo->x, mo->y, mo->z, MT_NULL);
@ -2985,7 +2985,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
break;
case 437: // Disable Player Controls
if (mo->player)
if (mo && mo->player)
{
UINT16 fractime = (UINT16)(sides[line->sidenum[0]].textureoffset>>FRACBITS);
if (fractime < 1)

View file

@ -1035,7 +1035,7 @@ sfxenum_t S_AddSoundFx(const char *name, boolean singular, INT32 flags, boolean
return i;
}
}
CONS_Alert(CONS_WARNING, M_GetText("No more free sound slots\n"));
I_Error("Out of Sound Freeslots while allocating \"%s\"\nLoad less addons to fix this.", name);
return 0;
}