Commit f54d7961 authored by Dino Bollinger's avatar Dino Bollinger
Browse files

Duke3D: Fix viewscreens being permanently deactivated after loading a save

Also decreases MAXUSERTILES to (MAXTILES - 256) to ensure the tilespace
used by the viewscreens isn't encroached on by user tiles.
parent d9877e86
......@@ -92,7 +92,7 @@ enum rendmode_t {
#define MAXWALLSB ((MAXWALLS>>2)+(MAXWALLS>>3))
#define MAXTILES 30720
#define MAXUSERTILES (MAXTILES-16) // reserve 16 tiles at the end
#define MAXUSERTILES (MAXTILES-256) // reserve 256 tiles at the end
#define MAXVOXELS 1024
#define MAXSTATUS 1024
......
......@@ -108,7 +108,7 @@ enum {
// Reserved: TILE_VIEWSCR_1 (MAXTILES-6)
// Reserved: TILE_VIEWSCR_2 (MAXTILES-7)
// Reserved: (MAXTILES-8) to (MAXTILES-196) for additional Viewscreen tilespace
//EDUKE32_STATIC_ASSERT(4 + (3 * MAX_ACTIVE_VIEWSCREENS) <= MAXTILES-MAXUSERTILES);
EDUKE32_STATIC_ASSERT(4 + (3 * MAX_ACTIVE_VIEWSCREENS) <= MAXTILES-MAXUSERTILES);
// sprites with these statnums should be considered for fixing
#define ROTFIXSPR_STATNUMP(k) ((k)==STAT_DEFAULT || (k)==STAT_STANDABLE || (k)==STAT_FX || \
......
......@@ -929,7 +929,10 @@ static void P_PrepForNewLevel(int playerNum, int gameMode)
g_interpolationCnt = 0;
for (int vscrIndex = 0; vscrIndex < MAX_ACTIVE_VIEWSCREENS; vscrIndex++)
{
g_activeVscrSprite[vscrIndex] = -1;
g_activeVscrTile[vscrIndex] = -1;
}
randomseed = 1996;
screenpeek = myconnectindex;
......@@ -1710,7 +1713,10 @@ void G_ResetTimers(bool saveMoveCnt)
for (int vscrIndex = 0; vscrIndex < MAX_ACTIVE_VIEWSCREENS; vscrIndex++)
{
if (g_activeVscrSprite[vscrIndex] >= 0)
{
actor[g_activeVscrSprite[vscrIndex]].t_data[0] = 0;
actor[g_activeVscrSprite[vscrIndex]].t_data[1] = -1;
}
}
}
......
......@@ -636,6 +636,11 @@ int32_t G_LoadPlayer(savebrief_t & sv)
sjson_destroy_context(ctx);
for (int vscrIndex = 0; vscrIndex < MAX_ACTIVE_VIEWSCREENS; vscrIndex++)
{
g_activeVscrSprite[vscrIndex] = -1;
g_activeVscrTile[vscrIndex] = -1;
}
if (G_EnterLevel(MODE_GAME|MODE_EOL))
G_BackToMenu();
......@@ -645,7 +650,6 @@ int32_t G_LoadPlayer(savebrief_t & sv)
// sv_postudload();
VM_OnEvent(EVENT_LOADGAME, g_player[screenpeek].ps->i, screenpeek);
return 0;
......@@ -725,6 +729,12 @@ int32_t G_LoadPlayer(savebrief_t & sv)
Bmemcpy(currentboardfilename, boardfilename, BMAX_PATH);
for (int vscrIndex = 0; vscrIndex < MAX_ACTIVE_VIEWSCREENS; vscrIndex++)
{
g_activeVscrSprite[vscrIndex] = -1;
g_activeVscrTile[vscrIndex] = -1;
}
if (status == 2)
G_NewGame_EnterLevel();
else if ((status = sv_loadsnapshot(fil, 0, &h))) // read the rest...
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment