mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-03-21 18:32:08 +00:00
Increase unlockable limits:
- MAXUNLOCKABLES from 32 to 80 - MAXEXTRAEMBLEMS from 16 to 48 - COMPAT_GAMEDATA_ID is used to account for the old values to prevent losing records. - Also fixes linedef actions 319/320.
This commit is contained in:
parent
f1106236ad
commit
1cc870485d
4 changed files with 75 additions and 12 deletions
32
src/g_game.c
32
src/g_game.c
|
@ -4309,6 +4309,12 @@ void G_LoadGameData(gamedata_t *data)
|
|||
// Stop saving, until we successfully load it again.
|
||||
data->loaded = false;
|
||||
|
||||
// Backwards compat stuff
|
||||
INT32 max_emblems = MAXEMBLEMS;
|
||||
INT32 max_extraemblems = MAXEXTRAEMBLEMS;
|
||||
INT32 max_unlockables = MAXUNLOCKABLES;
|
||||
INT32 max_conditionsets = MAXCONDITIONSETS;
|
||||
|
||||
// Clear things so previously read gamedata doesn't transfer
|
||||
// to new gamedata
|
||||
G_ClearRecords(data); // main and nights records
|
||||
|
@ -4325,7 +4331,7 @@ void G_LoadGameData(gamedata_t *data)
|
|||
{
|
||||
// Don't load, but do save. (essentially, reset)
|
||||
data->loaded = true;
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
length = FIL_ReadFile(va(pandf, srb2home, gamedatafilename), &savebuffer);
|
||||
|
@ -4355,6 +4361,14 @@ void G_LoadGameData(gamedata_t *data)
|
|||
I_Error("Game data is from another version of SRB2.\nDelete %s(maybe in %s) and try again.", gamedatafilename, gdfolder);
|
||||
}
|
||||
|
||||
#ifdef COMPAT_GAMEDATA_ID // Account for lower MAXUNLOCKABLES and MAXEXTRAEMBLEMS from older versions
|
||||
if (versionID == COMPAT_GAMEDATA_ID)
|
||||
{
|
||||
max_extraemblems = 16;
|
||||
max_unlockables = 32;
|
||||
}
|
||||
#endif
|
||||
|
||||
data->totalplaytime = READUINT32(save_p);
|
||||
|
||||
#ifdef COMPAT_GAMEDATA_ID
|
||||
|
@ -4393,31 +4407,31 @@ void G_LoadGameData(gamedata_t *data)
|
|||
goto datacorrupt;
|
||||
|
||||
// To save space, use one bit per collected/achieved/unlocked flag
|
||||
for (i = 0; i < MAXEMBLEMS;)
|
||||
for (i = 0; i < max_emblems;)
|
||||
{
|
||||
rtemp = READUINT8(save_p);
|
||||
for (j = 0; j < 8 && j+i < MAXEMBLEMS; ++j)
|
||||
for (j = 0; j < 8 && j+i < max_emblems; ++j)
|
||||
data->collected[j+i] = ((rtemp >> j) & 1);
|
||||
i += j;
|
||||
}
|
||||
for (i = 0; i < MAXEXTRAEMBLEMS;)
|
||||
for (i = 0; i < max_extraemblems;)
|
||||
{
|
||||
rtemp = READUINT8(save_p);
|
||||
for (j = 0; j < 8 && j+i < MAXEXTRAEMBLEMS; ++j)
|
||||
for (j = 0; j < 8 && j+i < max_extraemblems; ++j)
|
||||
data->extraCollected[j+i] = ((rtemp >> j) & 1);
|
||||
i += j;
|
||||
}
|
||||
for (i = 0; i < MAXUNLOCKABLES;)
|
||||
for (i = 0; i < max_unlockables;)
|
||||
{
|
||||
rtemp = READUINT8(save_p);
|
||||
for (j = 0; j < 8 && j+i < MAXUNLOCKABLES; ++j)
|
||||
for (j = 0; j < 8 && j+i < max_unlockables; ++j)
|
||||
data->unlocked[j+i] = ((rtemp >> j) & 1);
|
||||
i += j;
|
||||
}
|
||||
for (i = 0; i < MAXCONDITIONSETS;)
|
||||
for (i = 0; i < max_conditionsets;)
|
||||
{
|
||||
rtemp = READUINT8(save_p);
|
||||
for (j = 0; j < 8 && j+i < MAXCONDITIONSETS; ++j)
|
||||
for (j = 0; j < 8 && j+i < max_conditionsets; ++j)
|
||||
data->achieved[j+i] = ((rtemp >> j) & 1);
|
||||
i += j;
|
||||
}
|
||||
|
|
|
@ -139,8 +139,8 @@ typedef struct
|
|||
// you seriously need to get a life.
|
||||
#define MAXCONDITIONSETS 128
|
||||
#define MAXEMBLEMS 512
|
||||
#define MAXEXTRAEMBLEMS 16
|
||||
#define MAXUNLOCKABLES 32
|
||||
#define MAXEXTRAEMBLEMS 48
|
||||
#define MAXUNLOCKABLES 80
|
||||
|
||||
/** Time attack information, currently a very small structure.
|
||||
*/
|
||||
|
|
48
src/m_menu.c
48
src/m_menu.c
|
@ -728,6 +728,54 @@ static menuitem_t SR_MainMenu[] =
|
|||
{IT_DISABLED, NULL, "", NULL, 0}, // Custom30
|
||||
{IT_DISABLED, NULL, "", NULL, 0}, // Custom31
|
||||
{IT_DISABLED, NULL, "", NULL, 0}, // Custom32
|
||||
{IT_DISABLED, NULL, "", NULL, 0}, // Custom33
|
||||
{IT_DISABLED, NULL, "", NULL, 0}, // Custom34
|
||||
{IT_DISABLED, NULL, "", NULL, 0}, // Custom35
|
||||
{IT_DISABLED, NULL, "", NULL, 0}, // Custom36
|
||||
{IT_DISABLED, NULL, "", NULL, 0}, // Custom37
|
||||
{IT_DISABLED, NULL, "", NULL, 0}, // Custom38
|
||||
{IT_DISABLED, NULL, "", NULL, 0}, // Custom39
|
||||
{IT_DISABLED, NULL, "", NULL, 0}, // Custom40
|
||||
{IT_DISABLED, NULL, "", NULL, 0}, // Custom41
|
||||
{IT_DISABLED, NULL, "", NULL, 0}, // Custom42
|
||||
{IT_DISABLED, NULL, "", NULL, 0}, // Custom43
|
||||
{IT_DISABLED, NULL, "", NULL, 0}, // Custom44
|
||||
{IT_DISABLED, NULL, "", NULL, 0}, // Custom45
|
||||
{IT_DISABLED, NULL, "", NULL, 0}, // Custom46
|
||||
{IT_DISABLED, NULL, "", NULL, 0}, // Custom47
|
||||
{IT_DISABLED, NULL, "", NULL, 0}, // Custom48
|
||||
{IT_DISABLED, NULL, "", NULL, 0}, // Custom49
|
||||
{IT_DISABLED, NULL, "", NULL, 0}, // Custom50
|
||||
{IT_DISABLED, NULL, "", NULL, 0}, // Custom51
|
||||
{IT_DISABLED, NULL, "", NULL, 0}, // Custom52
|
||||
{IT_DISABLED, NULL, "", NULL, 0}, // Custom53
|
||||
{IT_DISABLED, NULL, "", NULL, 0}, // Custom54
|
||||
{IT_DISABLED, NULL, "", NULL, 0}, // Custom55
|
||||
{IT_DISABLED, NULL, "", NULL, 0}, // Custom56
|
||||
{IT_DISABLED, NULL, "", NULL, 0}, // Custom57
|
||||
{IT_DISABLED, NULL, "", NULL, 0}, // Custom58
|
||||
{IT_DISABLED, NULL, "", NULL, 0}, // Custom59
|
||||
{IT_DISABLED, NULL, "", NULL, 0}, // Custom60
|
||||
{IT_DISABLED, NULL, "", NULL, 0}, // Custom61
|
||||
{IT_DISABLED, NULL, "", NULL, 0}, // Custom62
|
||||
{IT_DISABLED, NULL, "", NULL, 0}, // Custom63
|
||||
{IT_DISABLED, NULL, "", NULL, 0}, // Custom64
|
||||
{IT_DISABLED, NULL, "", NULL, 0}, // Custom65
|
||||
{IT_DISABLED, NULL, "", NULL, 0}, // Custom66
|
||||
{IT_DISABLED, NULL, "", NULL, 0}, // Custom67
|
||||
{IT_DISABLED, NULL, "", NULL, 0}, // Custom68
|
||||
{IT_DISABLED, NULL, "", NULL, 0}, // Custom69
|
||||
{IT_DISABLED, NULL, "", NULL, 0}, // Custom70
|
||||
{IT_DISABLED, NULL, "", NULL, 0}, // Custom71
|
||||
{IT_DISABLED, NULL, "", NULL, 0}, // Custom72
|
||||
{IT_DISABLED, NULL, "", NULL, 0}, // Custom73
|
||||
{IT_DISABLED, NULL, "", NULL, 0}, // Custom74
|
||||
{IT_DISABLED, NULL, "", NULL, 0}, // Custom75
|
||||
{IT_DISABLED, NULL, "", NULL, 0}, // Custom76
|
||||
{IT_DISABLED, NULL, "", NULL, 0}, // Custom77
|
||||
{IT_DISABLED, NULL, "", NULL, 0}, // Custom78
|
||||
{IT_DISABLED, NULL, "", NULL, 0}, // Custom79
|
||||
{IT_DISABLED, NULL, "", NULL, 0}, // Custom80
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -190,7 +190,8 @@ UINT32 R_GetSkinAvailabilities(void)
|
|||
// This crash is impossible to trigger as is,
|
||||
// but it could happen if MAXUNLOCKABLES is ever made higher than 32,
|
||||
// and someone makes a mod that has 33+ unlockable characters. :V
|
||||
I_Error("Too many unlockable characters\n");
|
||||
// 2022/03/15: MAXUNLOCKABLES is now higher than 32
|
||||
I_Error("Too many unlockable characters! (maximum is 32)\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue