fix automap reset when switching resolutions (#1351)

This commit is contained in:
Roman Fomin 2023-12-24 21:00:29 +07:00 committed by GitHub
parent 7c1b648d46
commit b12994bccc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 34 additions and 26 deletions

View File

@ -588,6 +588,29 @@ void AM_enableSmoothLines(void)
AM_drawFline = map_smooth_lines ? AM_drawFline_Smooth : AM_drawFline_Vanilla; AM_drawFline = map_smooth_lines ? AM_drawFline_Smooth : AM_drawFline_Vanilla;
} }
static void AM_initScreenSize(void)
{
// killough 2/7/98: get rid of finit_ vars
// to allow runtime setting of width/height
//
// killough 11/98: ... finally add hires support :)
f_w = video.width;
if (automapoverlay && scaledviewheight == SCREENHEIGHT)
f_h = video.height;
else
f_h = video.height - ((ST_HEIGHT * video.yscale) >> FRACBITS);
}
void AM_ResetScreenSize(void)
{
AM_saveScaleAndLoc();
AM_initScreenSize();
AM_restoreScaleAndLoc();
}
// //
// AM_LevelInit() // AM_LevelInit()
// //
@ -606,16 +629,7 @@ static void AM_LevelInit(void)
f_x = f_y = 0; f_x = f_y = 0;
// killough 2/7/98: get rid of finit_ vars AM_initScreenSize();
// to allow runtime setting of width/height
//
// killough 11/98: ... finally add hires support :)
f_w = video.width;
if (automapoverlay && scaledviewheight == SCREENHEIGHT)
f_h = video.height;
else
f_h = video.height - ((ST_HEIGHT * video.yscale) >> FRACBITS);
AM_enableSmoothLines(); AM_enableSmoothLines();
@ -898,11 +912,7 @@ boolean AM_Responder
default: togglemsg("%s", s_AMSTR_OVERLAYOFF); break; default: togglemsg("%s", s_AMSTR_OVERLAYOFF); break;
} }
if (automapoverlay && scaledviewheight == SCREENHEIGHT) AM_initScreenSize();
f_h = video.height;
else
f_h = video.height - ((ST_HEIGHT * video.yscale) >> FRACBITS);
AM_activateNewScale(); AM_activateNewScale();
} }
else if (M_InputActivated(input_map_rotate)) else if (M_InputActivated(input_map_rotate))

View File

@ -54,6 +54,8 @@ extern void AM_initVariables(void);
void AM_SetMapCenter(fixed_t x, fixed_t y); void AM_SetMapCenter(fixed_t x, fixed_t y);
void AM_ResetScreenSize(void);
typedef struct typedef struct
{ {
int64_t x,y; int64_t x,y;

View File

@ -1047,6 +1047,9 @@ static void ResetResolution(int height)
R_InitVisplanesRes(); R_InitVisplanesRes();
setsizeneeded = true; // run R_ExecuteSetViewSize setsizeneeded = true; // run R_ExecuteSetViewSize
if (automapactive)
AM_ResetScreenSize();
I_InitDiskFlash(); I_InitDiskFlash();
I_Printf(VB_DEBUG, "ResetResolution: %dx%d", video.width, video.height); I_Printf(VB_DEBUG, "ResetResolution: %dx%d", video.width, video.height);
@ -1530,9 +1533,6 @@ void I_ResetScreen(void)
ResetResolution(CurrentResolutionMode()); ResetResolution(CurrentResolutionMode());
ResetLogicalSize(); ResetLogicalSize();
if (automapactive)
AM_Start(); // Reset automap dimensions
ST_Start(); // Reset palette ST_Start(); // Reset palette
if (gamestate == GS_INTERMISSION) if (gamestate == GS_INTERMISSION)

View File

@ -562,13 +562,6 @@ void R_ExecuteSetViewSize (void)
// [crispy] forcefully initialize the status bar backing screen // [crispy] forcefully initialize the status bar backing screen
ST_refreshBackground(true); ST_refreshBackground(true);
// [FG] reinitialize Automap
if (automapactive)
AM_Start();
// [FG] spectre drawing mode
R_SetFuzzColumnMode();
pspr_interp = false; pspr_interp = false;
} }
@ -584,6 +577,9 @@ void R_Init (void)
R_InitLightTables(); R_InitLightTables();
R_InitSkyMap(); R_InitSkyMap();
R_InitTranslationTables(); R_InitTranslationTables();
// [FG] spectre drawing mode
R_SetFuzzColumnMode();
} }
// //