Merge branch 'nightsattackfixes' into 'master'
NiGHTS attack fixes Closes #205 See merge request STJr/SRB2Internal!319
This commit is contained in:
commit
9041a399c6
|
@ -2957,6 +2957,17 @@ static void readunlockable(MYFILE *f, INT32 num)
|
||||||
Z_Free(s);
|
Z_Free(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const char NIGHTSGRADE_LIST[] = {
|
||||||
|
'F', // GRADE_F
|
||||||
|
'E', // GRADE_E
|
||||||
|
'D', // GRADE_D
|
||||||
|
'C', // GRADE_C
|
||||||
|
'B', // GRADE_B
|
||||||
|
'A', // GRADE_A
|
||||||
|
'S', // GRADE_S
|
||||||
|
'\0'
|
||||||
|
};
|
||||||
|
|
||||||
#define PARAMCHECK(n) do { if (!params[n]) { deh_warning("Too few parameters, need %d", n); return; }} while (0)
|
#define PARAMCHECK(n) do { if (!params[n]) { deh_warning("Too few parameters, need %d", n); return; }} while (0)
|
||||||
static void readcondition(UINT8 set, UINT32 id, char *word2)
|
static void readcondition(UINT8 set, UINT32 id, char *word2)
|
||||||
{
|
{
|
||||||
|
@ -3058,7 +3069,21 @@ static void readcondition(UINT8 set, UINT32 id, char *word2)
|
||||||
PARAMCHECK(2); // one optional one
|
PARAMCHECK(2); // one optional one
|
||||||
|
|
||||||
ty = UC_NIGHTSSCORE + offset;
|
ty = UC_NIGHTSSCORE + offset;
|
||||||
re = atoi(params[2 + !!(params[3])]);
|
i = (params[3] ? 3 : 2);
|
||||||
|
if (fastncmp("GRADE_",params[i],6))
|
||||||
|
{
|
||||||
|
char *p = params[i]+6;
|
||||||
|
for (re = 0; NIGHTSGRADE_LIST[re]; re++)
|
||||||
|
if (*p == NIGHTSGRADE_LIST[re])
|
||||||
|
break;
|
||||||
|
if (!NIGHTSGRADE_LIST[re])
|
||||||
|
{
|
||||||
|
deh_warning("Invalid NiGHTS grade %s\n", params[i]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
re = atoi(params[i]);
|
||||||
|
|
||||||
// Convert to map number if it appears to be one
|
// Convert to map number if it appears to be one
|
||||||
if (params[1][0] >= 'A' && params[1][0] <= 'Z')
|
if (params[1][0] >= 'A' && params[1][0] <= 'Z')
|
||||||
|
@ -8445,15 +8470,6 @@ struct {
|
||||||
{"LF2_NOVISITNEEDED",LF2_NOVISITNEEDED},
|
{"LF2_NOVISITNEEDED",LF2_NOVISITNEEDED},
|
||||||
{"LF2_WIDEICON",LF2_WIDEICON},
|
{"LF2_WIDEICON",LF2_WIDEICON},
|
||||||
|
|
||||||
// NiGHTS grades
|
|
||||||
{"GRADE_F",GRADE_F},
|
|
||||||
{"GRADE_E",GRADE_E},
|
|
||||||
{"GRADE_D",GRADE_D},
|
|
||||||
{"GRADE_C",GRADE_C},
|
|
||||||
{"GRADE_B",GRADE_B},
|
|
||||||
{"GRADE_A",GRADE_A},
|
|
||||||
{"GRADE_S",GRADE_S},
|
|
||||||
|
|
||||||
// Emeralds
|
// Emeralds
|
||||||
{"EMERALD1",EMERALD1},
|
{"EMERALD1",EMERALD1},
|
||||||
{"EMERALD2",EMERALD2},
|
{"EMERALD2",EMERALD2},
|
||||||
|
@ -9275,6 +9291,19 @@ static fixed_t find_const(const char **rword)
|
||||||
free(word);
|
free(word);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
else if (fastncmp("GRADE_",word,6))
|
||||||
|
{
|
||||||
|
char *p = word+6;
|
||||||
|
for (i = 0; NIGHTSGRADE_LIST[i]; i++)
|
||||||
|
if (*p == NIGHTSGRADE_LIST[i])
|
||||||
|
{
|
||||||
|
free(word);
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
const_warning("NiGHTS grade",word);
|
||||||
|
free(word);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
for (i = 0; INT_CONST[i].n; i++)
|
for (i = 0; INT_CONST[i].n; i++)
|
||||||
if (fastcmp(word,INT_CONST[i].n)) {
|
if (fastcmp(word,INT_CONST[i].n)) {
|
||||||
free(word);
|
free(word);
|
||||||
|
@ -9723,6 +9752,18 @@ static inline int lib_getenum(lua_State *L)
|
||||||
if (mathlib) return luaL_error(L, "skincolor '%s' could not be found.\n", word);
|
if (mathlib) return luaL_error(L, "skincolor '%s' could not be found.\n", word);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
else if (fastncmp("GRADE_",word,6))
|
||||||
|
{
|
||||||
|
p = word+6;
|
||||||
|
for (i = 0; NIGHTSGRADE_LIST[i]; i++)
|
||||||
|
if (*p == NIGHTSGRADE_LIST[i])
|
||||||
|
{
|
||||||
|
lua_pushinteger(L, i);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
if (mathlib) return luaL_error(L, "NiGHTS grade '%s' could not be found.\n", word);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
else if (fastncmp("MN_",word,3)) {
|
else if (fastncmp("MN_",word,3)) {
|
||||||
p = word+3;
|
p = word+3;
|
||||||
for (i = 0; i < NUMMENUTYPES; i++)
|
for (i = 0; i < NUMMENUTYPES; i++)
|
||||||
|
|
|
@ -8479,8 +8479,8 @@ static void M_NightsAttack(INT32 choice)
|
||||||
M_PatchSkinNameTable();
|
M_PatchSkinNameTable();
|
||||||
|
|
||||||
G_SetGamestate(GS_TIMEATTACK); // do this before M_SetupNextMenu so that menu meta state knows that we're switching
|
G_SetGamestate(GS_TIMEATTACK); // do this before M_SetupNextMenu so that menu meta state knows that we're switching
|
||||||
M_SetupNextMenu(&SP_NightsAttackDef);
|
|
||||||
titlemapinaction = TITLEMAP_OFF; // Nope don't give us HOMs please
|
titlemapinaction = TITLEMAP_OFF; // Nope don't give us HOMs please
|
||||||
|
M_SetupNextMenu(&SP_NightsAttackDef);
|
||||||
if (!M_CanShowLevelInList(cv_nextmap.value-1, -1) && levelselect.rows[0].maplist[0])
|
if (!M_CanShowLevelInList(cv_nextmap.value-1, -1) && levelselect.rows[0].maplist[0])
|
||||||
CV_SetValue(&cv_nextmap, levelselect.rows[0].maplist[0]);
|
CV_SetValue(&cv_nextmap, levelselect.rows[0].maplist[0]);
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue