From 3d867963b99484595fddc3b91baa57b196730141 Mon Sep 17 00:00:00 2001 From: terminx Date: Mon, 11 Dec 2006 04:38:10 +0000 Subject: [PATCH] Support for a version string to stick in the lower right hand corner of the OSD git-svn-id: https://svn.eduke32.com/eduke32@403 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/build/include/osd.h | 3 +++ polymer/build/src/osd.c | 20 +++++++++++++++++--- polymer/eduke32/source/astub.c | 1 + polymer/eduke32/source/game.c | 2 ++ polymer/eduke32/source/jmact/_control.h | 6 +++++- polymer/eduke32/source/osdfuncs.h | 3 +-- 6 files changed, 29 insertions(+), 6 deletions(-) diff --git a/polymer/build/include/osd.h b/polymer/build/include/osd.h index 120a0cb64..e4c17b940 100644 --- a/polymer/build/include/osd.h +++ b/polymer/build/include/osd.h @@ -54,6 +54,9 @@ void OSD_ResizeDisplay(int w,int h); // captures and frees osd input void OSD_CaptureInput(int cap); +// sets the console version string +void OSD_SetVersionString(const char *version); + // shows or hides the onscreen display void OSD_ShowDisplay(int onf); diff --git a/polymer/build/src/osd.c b/polymer/build/src/osd.c index 23589fd4d..eed6112e7 100644 --- a/polymer/build/src/osd.c +++ b/polymer/build/src/osd.c @@ -42,6 +42,8 @@ static void _internal_onshowosd(int); // history display static char osdtext[TEXTSIZE]; +static char osdversionstring[32]; +static int osdversionstringlen; static int osdpos=0; // position next character will be written at static int osdlines=1; // # lines of text in the buffer static int osdrows=20; // # lines of the buffer that are visible @@ -102,7 +104,6 @@ static void (*clearbackground)(int,int) = _internal_clearbackground; static int (*gettime)(void) = _internal_gettime; static void (*onshowosd)(int) = _internal_onshowosd; - static void _internal_drawosdchar(int x, int y, char ch, int shade, int pal) { int i,j,k; @@ -729,7 +730,10 @@ void OSD_Draw(void) begindrawing(); clearbackground(osdcols,osdrowscur+1); - + + if (osdversionstring[0]) + drawosdstr(osdcols-osdversionstringlen,osdrowscur,osdversionstring,osdcols,0,2); + for (; lines>0; lines--, row--) { drawosdstr(0,row,osdtext+topoffs,osdcols,osdtextshade,osdtextpal); topoffs+=osdcols; @@ -744,7 +748,7 @@ void OSD_Draw(void) drawosdchar(3+x,osdrowscur,osdeditbuf[osdeditwinstart+x],osdeditshade,osdeditpal); drawosdcursor(3+osdeditcursor-osdeditwinstart,osdrowscur,osdovertype,keytime); - + enddrawing(); } @@ -1003,6 +1007,16 @@ int OSD_RegisterFunction(const char *name, const char *help, int (*func)(const o return 0; } +// +// OSD_SetVersionString() +// +void OSD_SetVersionString(const char *version) +{ + if (!osdinited) OSD_Init(); + + strcpy(osdversionstring,version); + osdversionstringlen = strlen(osdversionstring); +} // // addnewsymbol() -- Allocates space for a new symbol and attaches it diff --git a/polymer/eduke32/source/astub.c b/polymer/eduke32/source/astub.c index a17cf93ef..349dd6907 100644 --- a/polymer/eduke32/source/astub.c +++ b/polymer/eduke32/source/astub.c @@ -4298,6 +4298,7 @@ int ExtPreInit(int *argc,char ***argv) wm_setapptitle("Mapster32"VERSION); OSD_SetLogFile("mapster32.log"); + OSD_SetVersionString("Mapster32"VERSION); initprintf("Mapster32"VERSION" ("__DATE__" "__TIME__")\n"); initprintf("Copyright (c) 2006 EDuke32 team\n\n"); return 0; diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index 9c9d43482..8caca01d3 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -9931,6 +9931,8 @@ void app_main(int argc,char **argv) GAME_onshowosd ); OSD_SetParameters(0,2, 0,0, 4,0); + OSD_SetVersionString(HEAD2); + OSD_ResizeDisplay(ScreenWidth,ScreenHeight); registerosdcommands(); initprintf("Checking music inits...\n"); diff --git a/polymer/eduke32/source/jmact/_control.h b/polymer/eduke32/source/jmact/_control.h index b4e92f337..a917566dc 100644 --- a/polymer/eduke32/source/jmact/_control.h +++ b/polymer/eduke32/source/jmact/_control.h @@ -94,12 +94,16 @@ extern "C" { // Number of JOY axes -#define MAXJOYAXES 8 +#define MAXJOYAXES 6 // Number of GamePad axes #define MAXGAMEPADAXES 2 +// Number of axes + +#define MAXAXES 6 + // NORMAL axis scale #define NORMALAXISSCALE (65536) diff --git a/polymer/eduke32/source/osdfuncs.h b/polymer/eduke32/source/osdfuncs.h index 4f1ddaac1..e9c6d58c5 100644 --- a/polymer/eduke32/source/osdfuncs.h +++ b/polymer/eduke32/source/osdfuncs.h @@ -4,5 +4,4 @@ void GAME_drawosdcursor(int x, int y, int type, int lastkeypress); int GAME_getcolumnwidth(int w); int GAME_getrowheight(int w); void GAME_clearbackground(int c, int r); -void GAME_onshowosd(int shown); - +void GAME_onshowosd(int shown);