Skip to content

Commit

Permalink
For Strife (WIP)
Browse files Browse the repository at this point in the history
Working, but needs pixel perfection.
  • Loading branch information
JNechaevsky committed Apr 22, 2024
1 parent 24bb661 commit 23eb674
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions src/strife/m_menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

#include <stdlib.h>
#include <ctype.h>
#include <time.h> // [crispy] strftime, localtime


#include "doomdef.h"
Expand Down Expand Up @@ -851,6 +852,40 @@ void M_DoNameChar(int choice)
M_ClearMenus(0);
}

// [crispy] print "modified" (or created initially) time of savegame file
// [JN] TODOs:
// - Move both Save and Load menus higher, so file date will be drawn
// one line above map name.
// - Possibly shift file date slightly right? So it will be centered
// by file slots, not by the center of the screen.
static void M_DrawSaveLoadBottomLine(void)
{
const int y = 161;

// [crispy] force status bar refresh
// [JN] TODO: probably not needed, we not drawing anything on status bar buffer.
inhelpscreens = true;

if (LoadMenu[itemOn].status)
{
struct stat st;
char filedate[32];

stat(P_SaveGameFile(itemOn), &st);

// [FG] suppress the most useless compiler warning ever
#if defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-y2k"
#endif
strftime(filedate, sizeof(filedate), "%x %X", localtime(&st.st_mtime));
#if defined(__GNUC__)
#pragma GCC diagnostic pop
#endif
M_WriteText(ORIGWIDTH/2-M_StringWidth(filedate)/2, y, filedate);
}
}

//
// M_LoadGame & Cie.
//
Expand All @@ -866,6 +901,8 @@ void M_DrawLoad(void)
M_DrawSaveLoadBorder(LoadDef.x,LoadDef.y+LINEHEIGHT*i);
M_WriteText(LoadDef.x,LoadDef.y+LINEHEIGHT*i,savegamestrings[i]);
}

M_DrawSaveLoadBottomLine();
}


Expand Down Expand Up @@ -951,6 +988,8 @@ void M_DrawSave(void)
i = M_StringWidth(savegamestrings[quickSaveSlot]);
M_WriteText(LoadDef.x + i,LoadDef.y+LINEHEIGHT*quickSaveSlot,"_");
}

M_DrawSaveLoadBottomLine();
}

//
Expand Down

0 comments on commit 23eb674

Please sign in to comment.