mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-25 11:10:47 +00:00
Savegame: for non-user level, don't write garbage into h.boardfn, allow per-map ART.
git-svn-id: https://svn.eduke32.com/eduke32@5160 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
5683beec3d
commit
5ae6253a30
2 changed files with 13 additions and 15 deletions
|
@ -10436,11 +10436,11 @@ void E_MapArt_Setup(const char *filename)
|
||||||
{
|
{
|
||||||
int32_t i;
|
int32_t i;
|
||||||
|
|
||||||
|
E_MapArt_Clear();
|
||||||
|
|
||||||
if (Bstrlen(filename) + 7 >= sizeof(mapartfilename))
|
if (Bstrlen(filename) + 7 >= sizeof(mapartfilename))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
E_MapArt_Clear();
|
|
||||||
|
|
||||||
Bstrcpy(mapartfilename, filename);
|
Bstrcpy(mapartfilename, filename);
|
||||||
append_ext_UNSAFE(mapartfilename, "_XX.art");
|
append_ext_UNSAFE(mapartfilename, "_XX.art");
|
||||||
mapartfnXXofs = Bstrlen(mapartfilename) - 6;
|
mapartfnXXofs = Bstrlen(mapartfilename) - 6;
|
||||||
|
|
|
@ -293,21 +293,20 @@ int32_t G_LoadPlayer(int32_t spot)
|
||||||
ud.m_level_number = h.levnum;
|
ud.m_level_number = h.levnum;
|
||||||
ud.m_player_skill = h.skill;
|
ud.m_player_skill = h.skill;
|
||||||
|
|
||||||
{
|
// NOTE: Bmemcpy needed for SAVEGAME_MUSIC.
|
||||||
// NOTE: Bmemcpy needed for SAVEGAME_MUSIC.
|
EDUKE32_STATIC_ASSERT(sizeof(boardfilename) == sizeof(h.boardfn));
|
||||||
EDUKE32_STATIC_ASSERT(sizeof(boardfilename) == sizeof(h.boardfn));
|
Bmemcpy(boardfilename, h.boardfn, sizeof(boardfilename));
|
||||||
Bmemcpy(boardfilename, h.boardfn, sizeof(boardfilename));
|
|
||||||
}
|
|
||||||
|
|
||||||
E_MapArt_Setup(h.boardfn); // XXX: Better after the following filename tweaking?
|
const int mapIdx = h.volnum*MAXLEVELS + h.levnum;
|
||||||
|
|
||||||
if (boardfilename[0])
|
if (boardfilename[0])
|
||||||
Bstrcpy(currentboardfilename, boardfilename);
|
Bstrcpy(currentboardfilename, boardfilename);
|
||||||
else if (MapInfo[h.volnum*MAXLEVELS + h.levnum].filename)
|
else if (MapInfo[mapIdx].filename)
|
||||||
Bstrcpy(currentboardfilename, MapInfo[h.volnum*MAXLEVELS + h.levnum].filename);
|
Bstrcpy(currentboardfilename, MapInfo[mapIdx].filename);
|
||||||
|
|
||||||
if (currentboardfilename[0])
|
if (currentboardfilename[0])
|
||||||
{
|
{
|
||||||
|
E_MapArt_Setup(currentboardfilename);
|
||||||
append_ext_UNSAFE(currentboardfilename, ".mhk");
|
append_ext_UNSAFE(currentboardfilename, ".mhk");
|
||||||
loadmaphack(currentboardfilename);
|
loadmaphack(currentboardfilename);
|
||||||
}
|
}
|
||||||
|
@ -1290,13 +1289,12 @@ int32_t sv_saveandmakesnapshot(FILE *fil, int8_t spot, int8_t recdiffsp, int8_t
|
||||||
h.levnum = ud.level_number;
|
h.levnum = ud.level_number;
|
||||||
h.skill = ud.player_skill;
|
h.skill = ud.player_skill;
|
||||||
|
|
||||||
|
const uint32_t BSZ = sizeof(h.boardfn);
|
||||||
|
EDUKE32_STATIC_ASSERT(BSZ == sizeof(currentboardfilename));
|
||||||
|
Bstrncpy(h.boardfn, currentboardfilename, BSZ);
|
||||||
|
|
||||||
if (currentboardfilename[0] != 0 && ud.level_number == 7 && ud.volume_number == 0)
|
if (currentboardfilename[0] != 0 && ud.level_number == 7 && ud.volume_number == 0)
|
||||||
{
|
{
|
||||||
const uint32_t BSZ = sizeof(h.boardfn);
|
|
||||||
EDUKE32_STATIC_ASSERT(BSZ == sizeof(currentboardfilename));
|
|
||||||
|
|
||||||
Bstrncpy(h.boardfn, currentboardfilename, BSZ);
|
|
||||||
|
|
||||||
// Shoehorn currently playing music into last bytes of board name buffer.
|
// Shoehorn currently playing music into last bytes of board name buffer.
|
||||||
// SAVEGAME_MUSIC.
|
// SAVEGAME_MUSIC.
|
||||||
if (g_musicIndex != (0*MAXLEVELS+7) && Bstrlen(h.boardfn) < BSZ-2)
|
if (g_musicIndex != (0*MAXLEVELS+7) && Bstrlen(h.boardfn) < BSZ-2)
|
||||||
|
|
Loading…
Reference in a new issue