minigen command: Support -m(ultiplier) parameter

Supports values between 1 and 10, with 1 being the default.
If a multiplier greater than 1 is provided, the filename will take the form "MINIMAP-%d.png", where %d is the multiplier.
This commit is contained in:
toaster 2023-01-23 19:59:14 +00:00
parent d7d1fdded3
commit 16d6837112

View file

@ -1752,10 +1752,12 @@ boolean M_ScreenshotResponder(event_t *ev)
void M_MinimapGenerate(void)
{
#ifdef USE_PNG
char *filepath = va(pandf, srb2home, "MINIMAP.png");
char *filepath;
boolean ret = false;
minigen_t *minigen = NULL;
INT32 wh = 100;
size_t option_scale;
INT32 mul = 1;
if (gamestate != GS_LEVEL)
{
@ -1769,6 +1771,36 @@ void M_MinimapGenerate(void)
return;
}
option_scale = COM_CheckPartialParm("-m");
if (option_scale)
{
if (COM_Argc() < option_scale + 2)/* no argument after? */
{
CONS_Alert(CONS_ERROR,
"No multiplier follows parameter '%s'.\n",
COM_Argv(option_scale));
return;
}
mul = atoi(COM_Argv(option_scale + 1));
if (mul < 1 || mul > 10)
{
CONS_Alert(CONS_ERROR,
"Multiplier %d must be within range 1-10.\n",
mul);
return;
}
wh *= mul;
filepath = va("%s" PATHSEP "MINIMAP-%d.png", srb2home, mul);
}
else
{
filepath = va("%s" PATHSEP "MINIMAP.png", srb2home);
}
minigen = AM_MinimapGenerate(wh);
if (minigen == NULL || minigen->buf == NULL)
@ -1784,6 +1816,10 @@ failure:
if (ret)
{
CONS_Printf(M_GetText("%s saved.\nRemember that this is not a complete minimap,\nand must be edited before putting in-game.\n"), filepath);
if (mul != 1)
{
CONS_Printf("You should divide its size by %d!\n", mul);
}
}
else
{