OSD (console) cleanup

git-svn-id: https://svn.eduke32.com/eduke32@6297 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2017-06-27 02:24:14 +00:00
parent 6aa1d36f99
commit c25aa4a790
20 changed files with 961 additions and 1042 deletions

View file

@ -144,6 +144,7 @@
<ClInclude Include="..\..\source\build\include\lz4.h" />
<ClInclude Include="..\..\source\build\include\rawinput.h" />
<ClInclude Include="..\..\source\build\include\renderlayer.h" />
<ClInclude Include="..\..\source\build\include\scancodes.h" />
<ClInclude Include="..\..\source\build\include\scriptfile.h" />
<ClInclude Include="..\..\source\build\include\sdlayer.h" />
<ClInclude Include="..\..\source\build\include\sdl_inc.h" />

View file

@ -540,6 +540,9 @@
<ClInclude Include="..\..\source\build\include\renderlayer.h">
<Filter>build\headers</Filter>
</ClInclude>
<ClInclude Include="..\..\source\build\include\scancodes.h">
<Filter>build\headers</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\source\build\src\a-c.cpp">

View file

@ -50,10 +50,10 @@ extern int32_t nofog;
void calc_ylookup(int32_t bpl, int32_t lastyidx);
#ifdef USE_OPENGL
extern int32_t (*baselayer_osdcmd_vidmode_func)(const osdfuncparm_t *parm);
extern int32_t (*baselayer_osdcmd_vidmode_func)(osdfuncparm_t const * const parm);
void fullscreen_tint_gl(uint8_t r, uint8_t g, uint8_t b, uint8_t f);
extern int32_t osdcmd_glinfo(const osdfuncparm_t *parm);
extern int32_t osdcmd_glinfo(osdfuncparm_t const * const parm);
struct glinfo_t {
const char *vendor;

View file

@ -77,6 +77,14 @@
# define UNREFERENCED_PARAMETER(x) (x) = (x)
#endif
#ifndef UNREFERENCED_CONST_PARAMETER
# ifdef _MSC_VER
# define UNREFERENCED_CONST_PARAMETER(x) (x)
# else
# define UNREFERENCED_CONST_PARAMETER(x)
# endif
#endif
#ifdef __GNUC__
# define UNUSED(x) UNUSED_ ## x __attribute__((unused))
# define PRINTF_FORMAT(stringindex, firstargindex) __attribute__((format (printf, stringindex, firstargindex)))

View file

@ -228,7 +228,7 @@ extern int32_t mousyplc;
#define M32_LOCAL_ARRAY_ID 0
#define M32_PRINTERROR(Text, ...) OSD_Printf(OSD_ERROR "Line %d, %s: " Text "\n", g_errorLineNum, keyw[g_tw], ## __VA_ARGS__)
#define M32_PRINTERROR(Text, ...) OSD_Printf("%sLine %d, %s: " Text "\n", osd->draw.errorfmt, g_errorLineNum, keyw[g_tw], ## __VA_ARGS__)
#define M32_ERROR(Text, ...) do { M32_PRINTERROR(Text, ## __VA_ARGS__); vm.flags |= VMFLAG_ERROR; } while (0)

View file

@ -18,7 +18,7 @@ typedef struct {
const char *raw;
} osdfuncparm_t;
const char *OSD_StripColors(char *out, const char *in);
const char *OSD_StripColors(char *outBuf, const char *inBuf);
#define OSDDEFAULTMAXLINES 128
#define OSDEDITLENGTH 512
@ -38,7 +38,7 @@ enum cvartype_t
CVAR_BOOL = 0x00000008,
CVAR_STRING = 0x00000010,
CVAR_DOUBLE = 0x00000020,
CVAR_LOCKED = 0x00000040,
CVAR_READONLY = 0x00000040,
CVAR_MULTI = 0x00000080,
CVAR_NOSAVE = 0x00000100,
CVAR_FUNCPTR = 0x00000200,
@ -46,6 +46,8 @@ enum cvartype_t
CVAR_INVALIDATEALL = 0x00000800,
CVAR_INVALIDATEART = 0x00001000,
CVAR_MODIFIED = 0x00002000,
CVAR_TYPEMASK = CVAR_FLOAT | CVAR_DOUBLE | CVAR_INT | CVAR_UINT | CVAR_BOOL | CVAR_STRING
};
typedef struct _symbol
@ -54,31 +56,42 @@ typedef struct _symbol
struct _symbol *next;
const char *help;
int32_t(*func)(const osdfuncparm_t *);
} symbol_t;
int32_t(*func)(osdfuncparm_t const * const);
} osdsymbol_t;
typedef struct
{
const char *name;
const char *desc;
void *vptr;
int32_t type; // see cvartype_t
int32_t min;
int32_t max; // for string, is the length
} cvar_t;
union
{
void * ptr;
int32_t * i32;
uint32_t * u32;
float * f;
double * d;
char *const string;
};
uint32_t flags; // see cvartype_t
int32_t const min;
int32_t const max; // for string, is the length
} osdcvardata_t;
typedef struct
{
cvar_t c;
osdcvardata_t *pData;
// default value for cvar, assigned when var is registered
union
{
int32_t i;
uint32_t uint;
int32_t i32;
uint32_t u32;
float f;
double d;
} dval;
} defaultValue;
} osdcvar_t;
// version string
@ -128,14 +141,17 @@ typedef struct
// active display parameters
typedef struct
{
char const *errorfmt;
char const *highlight;
int32_t promptshade, promptpal;
int32_t editshade, editpal;
int32_t textshade, textpal;
int32_t mode;
int32_t rows; // # lines of the buffer that are visible
int32_t cols; // width of onscreen display in text columns
int32_t head; // topmost visible line number
uint16_t head; // topmost visible line number
int8_t scrolling;
} osddraw_t;
typedef struct
@ -152,13 +168,14 @@ typedef struct
osdedit_t editor;
osdhist_t history;
osddraw_t draw;
osdstr_t verstr;
osdstr_t version;
uint32_t flags; // controls initialization, etc
osdcvar_t *cvars;
uint32_t numcvars;
symbol_t *symbptrs[OSDMAXSYMBOLS];
osdsymbol_t *symbptrs[OSDMAXSYMBOLS];
int32_t numsymbols;
int32_t execdepth; // keeps track of nested execution
mutex_t mutex;
@ -195,7 +212,7 @@ int32_t OSD_OSDKey(void);
int32_t OSD_GetTextMode(void);
void OSD_SetTextMode(int32_t mode);
int32_t OSD_Exec(const char *szScript);
int OSD_Exec(const char *szScript);
// Get shade and pal index from the OSD format buffer.
void OSD_GetShadePal(const char *ch, int32_t *shadeptr, int32_t *palptr);
@ -214,30 +231,25 @@ void OSD_Cleanup(void);
void OSD_SetLogFile(const char *fn);
// sets the functions the OSD will call to interrogate the environment
void OSD_SetFunctions(
void (*drawchar)(int32_t,int32_t,char,int32_t,int32_t),
void OSD_SetFunctions(void (*drawchar)(int32_t, int32_t, char, int32_t, int32_t),
void (*drawstr)(int32_t, int32_t, const char *, int32_t, int32_t, int32_t),
void (*drawcursor)(int32_t, int32_t, int32_t, int32_t),
int32_t (*colwidth)(int32_t),
int32_t (*rowheight)(int32_t),
void (*clearbg)(int32_t, int32_t),
int32_t (*gettime)(void),
void (*onshow)(int32_t)
);
void (*onshow)(int32_t));
// sets the parameters for presenting the text
void OSD_SetParameters(
int32_t promptshade, int32_t promptpal,
int32_t editshade, int32_t editpal,
int32_t textshade, int32_t textpal
);
void OSD_SetParameters(int32_t promptShade, int32_t promptPal, int32_t editShade, int32_t editPal, int32_t textShade, int32_t textPal,
char const *const errorStr, char const *const highlight);
// sets the scancode for the key which activates the onscreen display
void OSD_CaptureKey(int32_t sc);
void OSD_CaptureKey(uint8_t scanCode);
// handles keyboard input when capturing input. returns 0 if key was handled
// or the scancode if it should be handled by the game.
int32_t OSD_HandleScanCode(int32_t sc, int32_t press);
int OSD_HandleScanCode(uint8_t scanCode, int keyDown);
int32_t OSD_HandleChar(char ch);
// handles the readjustment when screen resolution changes
@ -247,7 +259,7 @@ void OSD_ResizeDisplay(int32_t w,int32_t h);
void OSD_CaptureInput(int32_t cap);
// sets the console version string
void OSD_SetVersion(const char *gameVersion, int osdShade, int osdPal);
void OSD_SetVersion(const char *pszVersion, int osdShade, int osdPal);
// shows or hides the onscreen display
void OSD_ShowDisplay(int32_t onf);
@ -271,10 +283,10 @@ int32_t OSD_Dispatch(const char *cmd);
// name = name of the function
// help = a short help string
// func = the entry point to the function
int32_t OSD_RegisterFunction(const char *name, const char *help, int32_t (*func)(const osdfuncparm_t*));
int32_t OSD_RegisterFunction(const char *pszName, const char *pszDesc, int32_t (*func)(const osdfuncparm_t *));
int32_t osdcmd_cvar_set(const osdfuncparm_t *parm);
int32_t OSD_RegisterCvar(const cvar_t *cvar);
int32_t osdcmd_cvar_set(osdfuncparm_t const * const parm);
void OSD_RegisterCvar(osdcvardata_t * const cvar, int32_t (*func)(osdfuncparm_t const * const));
void OSD_WriteAliases(FILE *fp);
void OSD_WriteCvars(FILE *fp);
@ -284,28 +296,7 @@ static inline void OSD_SetHistory(int32_t histIdx, const char *src)
Bstrncpyz(osd->history.buf[histIdx], src, OSDEDITLENGTH);
}
// these correspond to the Duke palettes, so they shouldn't really be here
// ...but I don't care
#define OSDTEXT_BLUE "^00"
#define OSDTEXT_GOLD "^07"
#define OSDTEXT_DARKRED "^10"
#define OSDTEXT_GREEN "^11"
#define OSDTEXT_GRAY "^12"
#define OSDTEXT_DARKGRAY "^13"
#define OSDTEXT_DARKGREEN "^14"
#define OSDTEXT_BROWN "^15"
#define OSDTEXT_DARKBLUE "^16"
#define OSDTEXT_RED "^21"
#define OSDTEXT_YELLOW "^23"
#define OSDTEXT_BRIGHT "^S0"
#define OSD_ERROR OSDTEXT_DARKRED OSDTEXT_BRIGHT
extern int32_t osdcmd_restartvid(const osdfuncparm_t *parm);
extern int32_t osdcmd_restartvid(osdfuncparm_t const * const parm);
extern void M32RunScript(const char *s);

View file

@ -119,7 +119,17 @@
#define asc_Enter 13
#define asc_Escape 27
#define asc_Ctrl_A 1
#define asc_Ctrl_B 2
#define asc_Ctrl_C 3
#define asc_Ctrl_E 5
#define asc_Ctrl_F 6
#define asc_BackSpace 8
#define asc_Tab 9
#define asc_Ctrl_K 11
#define asc_Ctrl_L 12
#define asc_Ctrl_N 14
#define asc_Ctrl_P 16
#define asc_Ctrl_U 21
#define asc_Ctrl_W 23
#define asc_Space 32

View file

@ -324,9 +324,9 @@ int32_t flushlogwindow = 1;
#ifdef USE_OPENGL
// Used to register the game's / editor's osdcmd_vidmode() functions here.
int32_t (*baselayer_osdcmd_vidmode_func)(const osdfuncparm_t *parm);
int32_t (*baselayer_osdcmd_vidmode_func)(osdfuncparm_t const * const parm);
static int32_t osdfunc_setrendermode(const osdfuncparm_t *parm)
static int32_t osdfunc_setrendermode(osdfuncparm_t const * const parm)
{
if (parm->numparms != 1)
return OSDCMD_SHOWHELP;
@ -388,7 +388,7 @@ static int32_t osdfunc_setrendermode(const osdfuncparm_t *parm)
}
#if defined(USE_OPENGL)
#ifdef DEBUGGINGAIDS
static int32_t osdcmd_hicsetpalettetint(const osdfuncparm_t *parm)
static int32_t osdcmd_hicsetpalettetint(osdfuncparm_t const * const parm)
{
int32_t pal, cols[3], eff;
@ -406,11 +406,11 @@ static int32_t osdcmd_hicsetpalettetint(const osdfuncparm_t *parm)
}
#endif
int32_t osdcmd_glinfo(const osdfuncparm_t *parm)
int32_t osdcmd_glinfo(osdfuncparm_t const * const UNUSED(parm))
{
char *s,*t,*u,i;
UNREFERENCED_PARAMETER(parm);
UNREFERENCED_CONST_PARAMETER(parm);
if (bpp == 8)
{
@ -500,7 +500,7 @@ int32_t osdcmd_glinfo(const osdfuncparm_t *parm)
#endif
#endif
static int32_t osdcmd_cvar_set_baselayer(const osdfuncparm_t *parm)
static int32_t osdcmd_cvar_set_baselayer(osdfuncparm_t const * const parm)
{
int32_t r = osdcmd_cvar_set(parm);
@ -526,7 +526,7 @@ int32_t baselayer_init(void)
#else
# define SCREENASPECT_CVAR_TYPE (CVAR_UINT)
#endif
cvar_t cvars_engine[] =
static osdcvardata_t cvars_engine[] =
{
{ "r_usenewaspect","enable/disable new screen aspect ratio determination code",(void *) &r_usenewaspect, CVAR_BOOL, 0, 1 },
{ "r_screenaspect","if using r_usenewaspect and in fullscreen, screen aspect ratio in the form XXYY, e.g. 1609 for 16:9",
@ -550,13 +550,7 @@ int32_t baselayer_init(void)
};
for (i=0; i<ARRAY_SIZE(cvars_engine); i++)
{
if (OSD_RegisterCvar(&cvars_engine[i]))
continue;
OSD_RegisterFunction(cvars_engine[i].name, cvars_engine[i].desc,
(cvars_engine[i].type & CVAR_FUNCPTR) ? osdcmd_cvar_set_baselayer : osdcmd_cvar_set);
}
OSD_RegisterCvar(&cvars_engine[i], (cvars_engine[i].flags & CVAR_FUNCPTR) ? osdcmd_cvar_set_baselayer : osdcmd_cvar_set);
#ifdef USE_OPENGL
OSD_RegisterFunction("setrendermode","setrendermode <number>: sets the engine's rendering mode.\n"

View file

@ -272,9 +272,9 @@ void clearkeys(void)
}
#ifdef USE_OPENGL
int32_t osdcmd_restartvid(const osdfuncparm_t *parm)
int32_t osdcmd_restartvid(osdfuncparm_t const * const UNUSED(parm))
{
UNREFERENCED_PARAMETER(parm);
UNREFERENCED_CONST_PARAMETER(parm);
if (!in3dmode()) return OSDCMD_OK;
@ -286,7 +286,7 @@ int32_t osdcmd_restartvid(const osdfuncparm_t *parm)
}
#endif
static int32_t osdcmd_vidmode(const osdfuncparm_t *parm)
static int32_t osdcmd_vidmode(osdfuncparm_t const * const parm)
{
int32_t newx = xdim, newy = ydim, newbpp = bpp, newfullscreen = fullscreen;
#ifdef USE_OPENGL
@ -643,8 +643,6 @@ int app_main(int argc, char const * const * argv)
M32_OnShowOSD
);
OSD_SetParameters(0,2, 0,0, 4,0);
if (!getcwd(program_origcwd,BMAX_PATH))
program_origcwd[0] = '\0';

View file

@ -9061,13 +9061,13 @@ static void check_sprite(int32_t i)
{
if ((unsigned)sprite[i].statnum >= MAXSTATUS)
{
initprintf(OSD_ERROR "Map error: sprite #%d (%d,%d) with illegal statnum (%d) REMOVED.\n",
initprintf("%sMap error: sprite #%d (%d,%d) with illegal statnum (%d) REMOVED.\n", osd->draw.errorfmt,
i, TrackerCast(sprite[i].x), TrackerCast(sprite[i].y), TrackerCast(sprite[i].statnum));
remove_sprite(i);
}
else if ((unsigned)sprite[i].picnum >= MAXTILES)
{
initprintf(OSD_ERROR "Map error: sprite #%d (%d,%d) with illegal picnum (%d) REMOVED.\n",
initprintf("%sMap error: sprite #%d (%d,%d) with illegal picnum (%d) REMOVED.\n", osd->draw.errorfmt,
i, TrackerCast(sprite[i].x), TrackerCast(sprite[i].y), TrackerCast(sprite[i].sectnum));
remove_sprite(i);
}
@ -9081,7 +9081,7 @@ static void check_sprite(int32_t i)
if (sprite[i].sectnum < 0)
remove_sprite(i);
initprintf(OSD_ERROR "Map error: sprite #%d (%d,%d) with illegal sector (%d) ",
initprintf("%sMap error: sprite #%d (%d,%d) with illegal sector (%d) ", osd->draw.errorfmt,
i, TrackerCast(sprite[i].x), TrackerCast(sprite[i].y), osectnum);
if (sprite[i].statnum != MAXSTATUS)

File diff suppressed because it is too large Load diff

View file

@ -5867,7 +5867,7 @@ int32_t polymost_printext256(int32_t xpos, int32_t ypos, int16_t col, int16_t ba
}
// Console commands by JBF
static int32_t gltexturemode(const osdfuncparm_t *parm)
static int32_t gltexturemode(osdfuncparm_t const * const parm)
{
int32_t m;
char *p;
@ -5908,7 +5908,7 @@ static int32_t gltexturemode(const osdfuncparm_t *parm)
return OSDCMD_OK;
}
static int32_t osdcmd_cvar_set_polymost(const osdfuncparm_t *parm)
static int32_t osdcmd_cvar_set_polymost(osdfuncparm_t const * const parm)
{
int32_t r = osdcmd_cvar_set(parm);
@ -5969,7 +5969,7 @@ void polymost_initosdfuncs(void)
{
uint32_t i;
cvar_t cvars_polymost[] =
static osdcvardata_t cvars_polymost[] =
{
{ "r_animsmoothing","enable/disable model animation smoothing",(void *) &r_animsmoothing, CVAR_BOOL, 0, 1 },
{ "r_downsize","controls downsizing factor (quality) for hires textures",(void *) &r_downsize, CVAR_INT|CVAR_FUNCPTR, 0, 5 },
@ -6066,16 +6066,7 @@ void polymost_initosdfuncs(void)
};
for (i=0; i<ARRAY_SIZE(cvars_polymost); i++)
{
// can't do this: editstatus is set after this function
// if (editstatus==0 && !Bstrcmp(cvars_polymost[i].name, "r_preview_mouseaim"))
// continue;
if (OSD_RegisterCvar(&cvars_polymost[i])) continue;
OSD_RegisterFunction(cvars_polymost[i].name, cvars_polymost[i].desc,
cvars_polymost[i].type & CVAR_FUNCPTR ? osdcmd_cvar_set_polymost : osdcmd_cvar_set);
}
OSD_RegisterCvar(&cvars_polymost[i], cvars_polymost[i].flags & CVAR_FUNCPTR ? osdcmd_cvar_set_polymost : osdcmd_cvar_set);
}
void polymost_precache(int32_t dapicnum, int32_t dapalnum, int32_t datype)

View file

@ -224,18 +224,13 @@ void win_init(void)
{
uint32_t i;
cvar_t cvars_win[] =
static osdcvardata_t cvars_win[] =
{
{ "r_togglecomposition","enable/disable toggle of desktop composition when initializing screen modes",(void *) &togglecomp, CVAR_BOOL, 0, 1 },
};
for (i=0; i<ARRAY_SIZE(cvars_win); i++)
{
if (OSD_RegisterCvar(&cvars_win[i]))
continue;
OSD_RegisterFunction(cvars_win[i].name, cvars_win[i].desc, osdcmd_cvar_set);
}
OSD_RegisterCvar(&cvars_win[i], osdcmd_cvar_set);
win_printversion();
}

View file

@ -412,7 +412,7 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nC
}
static int32_t set_maxrefreshfreq(const osdfuncparm_t *parm)
static int32_t set_maxrefreshfreq(osdfuncparm_t const * const parm)
{
int32_t freq;
if (parm->numparms == 0)

View file

@ -308,7 +308,7 @@ extern int32_t mskip;
//extern int32_t fillsector(int16_t sectnum, char fillcolor);
static int32_t osdcmd_quit(const osdfuncparm_t *parm);
static int32_t osdcmd_quit(osdfuncparm_t const * const parm);
#define M32_NUM_SPRITE_MODES (signed)ARRAY_SIZE(SpriteMode)
@ -8464,9 +8464,9 @@ int32_t ExtPreInit(int32_t argc,char const * const * argv)
return 0;
}
static int32_t osdcmd_quit(const osdfuncparm_t *parm)
static int32_t osdcmd_quit(osdfuncparm_t const * const UNUSED(parm))
{
UNREFERENCED_PARAMETER(parm);
UNREFERENCED_CONST_PARAMETER(parm);
OSD_ShowDisplay(0);
@ -8478,7 +8478,7 @@ static int32_t osdcmd_quit(const osdfuncparm_t *parm)
Bexit(0);
}
static int32_t osdcmd_editorgridextent(const osdfuncparm_t *parm)
static int32_t osdcmd_editorgridextent(osdfuncparm_t const * const parm)
{
int32_t i;
@ -8503,7 +8503,7 @@ static int32_t osdcmd_editorgridextent(const osdfuncparm_t *parm)
return OSDCMD_OK;
}
static int32_t osdcmd_addpath(const osdfuncparm_t *parm)
static int32_t osdcmd_addpath(osdfuncparm_t const * const parm)
{
char pathname[BMAX_PATH];
@ -8514,7 +8514,7 @@ static int32_t osdcmd_addpath(const osdfuncparm_t *parm)
return OSDCMD_OK;
}
static int32_t osdcmd_initgroupfile(const osdfuncparm_t *parm)
static int32_t osdcmd_initgroupfile(osdfuncparm_t const * const parm)
{
char file[BMAX_PATH];
@ -8525,7 +8525,7 @@ static int32_t osdcmd_initgroupfile(const osdfuncparm_t *parm)
return OSDCMD_OK;
}
static int32_t osdcmd_sensitivity(const osdfuncparm_t *parm)
static int32_t osdcmd_sensitivity(osdfuncparm_t const * const parm)
{
if (parm->numparms != 1)
{
@ -8537,9 +8537,9 @@ static int32_t osdcmd_sensitivity(const osdfuncparm_t *parm)
return OSDCMD_OK;
}
static int32_t osdcmd_noclip(const osdfuncparm_t *parm)
static int32_t osdcmd_noclip(osdfuncparm_t const * const UNUSED(parm))
{
UNREFERENCED_PARAMETER(parm);
UNREFERENCED_CONST_PARAMETER(parm);
m32_clipping--;
if (m32_clipping < 0)
m32_clipping = 2;
@ -8549,7 +8549,7 @@ static int32_t osdcmd_noclip(const osdfuncparm_t *parm)
return OSDCMD_OK;
}
static int32_t osdcmd_testplay_addparam(const osdfuncparm_t *parm)
static int32_t osdcmd_testplay_addparam(osdfuncparm_t const * const parm)
{
int32_t slen;
@ -8585,7 +8585,7 @@ static int32_t osdcmd_testplay_addparam(const osdfuncparm_t *parm)
//PK vvv ------------
// FIXME: The way the different options are handled is horribly inconsistent.
static int32_t osdcmd_vars_pk(const osdfuncparm_t *parm)
static int32_t osdcmd_vars_pk(osdfuncparm_t const * const parm)
{
const int32_t setval = (parm->numparms >= 1);
@ -8875,7 +8875,7 @@ static int32_t osdcmd_vars_pk(const osdfuncparm_t *parm)
}
#ifdef USE_OPENGL
static int32_t osdcmd_tint(const osdfuncparm_t *parm)
static int32_t osdcmd_tint(osdfuncparm_t const * const parm)
{
int32_t i;
polytint_t *p;
@ -8944,7 +8944,7 @@ static void SaveInHistory(const char *commandstr)
}
#ifdef LUNATIC
static int32_t osdcmd_lua(const osdfuncparm_t *parm)
static int32_t osdcmd_lua(osdfuncparm_t const * const parm)
{
// Should be used like
// lua "lua code..."
@ -8972,7 +8972,7 @@ static int32_t osdcmd_lua(const osdfuncparm_t *parm)
#endif
// M32 script vvv
static int32_t osdcmd_include(const osdfuncparm_t *parm)
static int32_t osdcmd_include(osdfuncparm_t const * const parm)
{
if (parm->numparms != 1)
return OSDCMD_SHOWHELP;
@ -8980,9 +8980,9 @@ static int32_t osdcmd_include(const osdfuncparm_t *parm)
return OSDCMD_OK;
}
static int32_t osdcmd_scriptinfo(const osdfuncparm_t *parm)
static int32_t osdcmd_scriptinfo(osdfuncparm_t const * const UNUSED(parm))
{
UNREFERENCED_PARAMETER(parm);
UNREFERENCED_CONST_PARAMETER(parm);
C_CompilationInfo();
return OSDCMD_OK;
}
@ -8990,7 +8990,7 @@ static int32_t osdcmd_scriptinfo(const osdfuncparm_t *parm)
#ifdef DEBUGGINGAIDS
extern void X_Disasm(ofstype beg, int32_t size);
static int32_t osdcmd_disasm(const osdfuncparm_t *parm)
static int32_t osdcmd_disasm(osdfuncparm_t const * const parm)
{
int32_t i;
@ -9016,7 +9016,7 @@ static int32_t osdcmd_disasm(const osdfuncparm_t *parm)
}
#endif
static int32_t osdcmd_do(const osdfuncparm_t *parm)
static int32_t osdcmd_do(osdfuncparm_t const * const parm)
{
intptr_t oscrofs;
char *tp;
@ -9103,7 +9103,7 @@ void M32RunScript(const char *s)
osdcmd_do(&parm);
}
static int32_t osdcmd_endisableevent(const osdfuncparm_t *parm)
static int32_t osdcmd_endisableevent(osdfuncparm_t const * const parm)
{
int32_t i, j, enable;
@ -9974,6 +9974,8 @@ int32_t ExtInit(void)
{
int32_t rv = 0;
OSD_SetParameters(0, 2, 0, 0, 4, 0, OSD_ERROR, OSDTEXT_RED);
set_memerr_handler(&M32_HandleMemErr);
if (!g_useCwd)

View file

@ -75,6 +75,16 @@ typedef enum basepal_ {
BASEPALCOUNT
} basepal_t;
#define OSDTEXT_DEFAULT "^00"
#define OSDTEXT_DARKRED "^10"
#define OSDTEXT_GREEN "^11"
#define OSDTEXT_RED "^21"
#define OSDTEXT_YELLOW "^23"
#define OSDTEXT_BRIGHT "^S0"
#define OSD_ERROR OSDTEXT_DARKRED OSDTEXT_BRIGHT
extern const char *g_gameNamePtr;
extern char *g_grpNamePtr;

View file

@ -6113,7 +6113,7 @@ int app_main(int argc, char const * const * argv)
G_ExtPreInit(argc, argv);
OSD_SetParameters(0,0, 0,12, 2,12);
OSD_SetParameters(0,0, 0,12, 2,12, OSD_ERROR, OSDTEXT_RED);
#ifdef __APPLE__
if (!g_useCwd)

View file

@ -1439,8 +1439,8 @@ skip_check:
M32_ERROR("Unknown iteration type %d!", how);
continue;
badindex:
OSD_Printf(OSD_ERROR "Line %d, %s %s: index %d out of range!\n",g_errorLineNum,keyw[g_tw],
iter_tokens[how].token, parm2);
OSD_Printf("%sLine %d, %s %s: index %d out of range!\n", osd->draw.highlight,
g_errorLineNum,keyw[g_tw], iter_tokens[how].token, parm2);
vm.flags |= VMFLAG_ERROR;
continue;
}

View file

@ -41,15 +41,15 @@ float r_ambientlight = 1.0, r_ambientlightrecip = 1.0;
uint32_t cl_cheatmask;
static inline int32_t osdcmd_quit(const osdfuncparm_t *parm)
static inline int32_t osdcmd_quit(osdfuncparm_t const * const UNUSED(parm))
{
UNREFERENCED_PARAMETER(parm);
UNREFERENCED_CONST_PARAMETER(parm);
OSD_ShowDisplay(0);
G_GameQuit();
return OSDCMD_OK;
}
static int32_t osdcmd_changelevel(const osdfuncparm_t *parm)
static int32_t osdcmd_changelevel(osdfuncparm_t const * const parm)
{
int32_t volume=0,level;
char *p;
@ -158,7 +158,7 @@ static int32_t osdcmd_changelevel(const osdfuncparm_t *parm)
return OSDCMD_OK;
}
static int32_t osdcmd_map(const osdfuncparm_t *parm)
static int32_t osdcmd_map(osdfuncparm_t const * const parm)
{
int32_t i;
char filename[BMAX_PATH];
@ -300,7 +300,7 @@ static int32_t osdcmd_map(const osdfuncparm_t *parm)
// the variance of the run times MUST be taken into account (that is, the
// replaying must be performed multiple times for the old and new versions,
// etc.)
static int32_t osdcmd_demo(const osdfuncparm_t *parm)
static int32_t osdcmd_demo(osdfuncparm_t const * const parm)
{
if (numplayers > 1)
{
@ -327,9 +327,9 @@ static int32_t osdcmd_demo(const osdfuncparm_t *parm)
return OSDCMD_OK;
}
static int32_t osdcmd_god(const osdfuncparm_t *parm)
static int32_t osdcmd_god(osdfuncparm_t const * const UNUSED(parm))
{
UNREFERENCED_PARAMETER(parm);
UNREFERENCED_CONST_PARAMETER(parm);
if (numplayers == 1 && g_player[myconnectindex].ps->gm & MODE_GAME)
osdcmd_cheatsinfo_stat.cheatnum = CHEAT_CORNHOLIO;
else
@ -338,9 +338,9 @@ static int32_t osdcmd_god(const osdfuncparm_t *parm)
return OSDCMD_OK;
}
static int32_t osdcmd_noclip(const osdfuncparm_t *parm)
static int32_t osdcmd_noclip(osdfuncparm_t const * const UNUSED(parm))
{
UNREFERENCED_PARAMETER(parm);
UNREFERENCED_CONST_PARAMETER(parm);
if (numplayers == 1 && g_player[myconnectindex].ps->gm & MODE_GAME)
{
@ -354,9 +354,9 @@ static int32_t osdcmd_noclip(const osdfuncparm_t *parm)
return OSDCMD_OK;
}
static int32_t osdcmd_restartsound(const osdfuncparm_t *parm)
static int32_t osdcmd_restartsound(osdfuncparm_t const * const UNUSED(parm))
{
UNREFERENCED_PARAMETER(parm);
UNREFERENCED_CONST_PARAMETER(parm);
S_SoundShutdown();
S_MusicShutdown();
@ -372,7 +372,7 @@ static int32_t osdcmd_restartsound(const osdfuncparm_t *parm)
return OSDCMD_OK;
}
static int32_t osdcmd_music(const osdfuncparm_t *parm)
static int32_t osdcmd_music(osdfuncparm_t const * const parm)
{
if (parm->numparms == 1)
{
@ -403,9 +403,9 @@ static int32_t osdcmd_music(const osdfuncparm_t *parm)
return OSDCMD_SHOWHELP;
}
int32_t osdcmd_restartvid(const osdfuncparm_t *parm)
int32_t osdcmd_restartvid(osdfuncparm_t const * const UNUSED(parm))
{
UNREFERENCED_PARAMETER(parm);
UNREFERENCED_CONST_PARAMETER(parm);
resetvideomode();
if (setgamemode(ud.config.ScreenMode,ud.config.ScreenWidth,ud.config.ScreenHeight,ud.config.ScreenBPP))
G_GameExit("restartvid: Reset failed...\n");
@ -415,9 +415,9 @@ int32_t osdcmd_restartvid(const osdfuncparm_t *parm)
return OSDCMD_OK;
}
int32_t osdcmd_restartmap(const osdfuncparm_t *parm)
int32_t osdcmd_restartmap(osdfuncparm_t const * const UNUSED(parm))
{
UNREFERENCED_PARAMETER(parm);
UNREFERENCED_CONST_PARAMETER(parm);
if (g_player[myconnectindex].ps->gm & MODE_GAME && ud.multimode == 1)
g_player[myconnectindex].ps->gm = MODE_RESTART;
@ -425,7 +425,7 @@ int32_t osdcmd_restartmap(const osdfuncparm_t *parm)
return OSDCMD_OK;
}
static int32_t osdcmd_vidmode(const osdfuncparm_t *parm)
static int32_t osdcmd_vidmode(osdfuncparm_t const * const parm)
{
int32_t newbpp = ud.config.ScreenBPP, newwidth = ud.config.ScreenWidth,
newheight = ud.config.ScreenHeight, newfs = ud.config.ScreenMode;
@ -478,7 +478,7 @@ static int32_t osdcmd_vidmode(const osdfuncparm_t *parm)
LUNATIC_CB int32_t (*El_GetLabelValue)(const char *label);
#endif
static int32_t osdcmd_spawn(const osdfuncparm_t *parm)
static int32_t osdcmd_spawn(osdfuncparm_t const * const parm)
{
int32_t picnum = 0;
uint16_t cstat=0;
@ -576,7 +576,7 @@ static int32_t osdcmd_spawn(const osdfuncparm_t *parm)
}
#if !defined LUNATIC
static int32_t osdcmd_setvar(const osdfuncparm_t *parm)
static int32_t osdcmd_setvar(osdfuncparm_t const * const parm)
{
int32_t i, varval;
char varname[256];
@ -602,7 +602,7 @@ static int32_t osdcmd_setvar(const osdfuncparm_t *parm)
return OSDCMD_OK;
}
static int32_t osdcmd_addlogvar(const osdfuncparm_t *parm)
static int32_t osdcmd_addlogvar(osdfuncparm_t const * const parm)
{
int32_t i;
char varname[256];
@ -622,7 +622,7 @@ static int32_t osdcmd_addlogvar(const osdfuncparm_t *parm)
return OSDCMD_OK;
}
static int32_t osdcmd_setactorvar(const osdfuncparm_t *parm)
static int32_t osdcmd_setactorvar(osdfuncparm_t const * const parm)
{
int32_t i, varval, ID;
char varname[256];
@ -656,7 +656,7 @@ static int32_t osdcmd_setactorvar(const osdfuncparm_t *parm)
return OSDCMD_OK;
}
#else
static int32_t osdcmd_lua(const osdfuncparm_t *parm)
static int32_t osdcmd_lua(osdfuncparm_t const * const parm)
{
// Should be used like
// lua "lua code..."
@ -690,7 +690,7 @@ static int32_t osdcmd_lua(const osdfuncparm_t *parm)
}
#endif
static int32_t osdcmd_addpath(const osdfuncparm_t *parm)
static int32_t osdcmd_addpath(osdfuncparm_t const * const parm)
{
char pathname[BMAX_PATH];
@ -701,7 +701,7 @@ static int32_t osdcmd_addpath(const osdfuncparm_t *parm)
return OSDCMD_OK;
}
static int32_t osdcmd_initgroupfile(const osdfuncparm_t *parm)
static int32_t osdcmd_initgroupfile(osdfuncparm_t const * const parm)
{
char file[BMAX_PATH];
@ -712,7 +712,7 @@ static int32_t osdcmd_initgroupfile(const osdfuncparm_t *parm)
return OSDCMD_OK;
}
static int32_t osdcmd_cmenu(const osdfuncparm_t *parm)
static int32_t osdcmd_cmenu(osdfuncparm_t const * const parm)
{
if (parm->numparms != 1) return OSDCMD_SHOWHELP;
if (numplayers > 1)
@ -731,7 +731,7 @@ static int32_t osdcmd_cmenu(const osdfuncparm_t *parm)
extern void G_SetCrosshairColor(int32_t r, int32_t g, int32_t b);
extern palette_t CrosshairColors;
static int32_t osdcmd_crosshaircolor(const osdfuncparm_t *parm)
static int32_t osdcmd_crosshaircolor(osdfuncparm_t const * const parm)
{
int32_t r, g, b;
@ -751,7 +751,7 @@ static int32_t osdcmd_crosshaircolor(const osdfuncparm_t *parm)
return OSDCMD_OK;
}
static int32_t osdcmd_give(const osdfuncparm_t *parm)
static int32_t osdcmd_give(osdfuncparm_t const * const parm)
{
int32_t i;
@ -836,7 +836,7 @@ void onvideomodechange(int32_t newmode)
g_crosshairSum = -1;
}
static int32_t osdcmd_name(const osdfuncparm_t *parm)
static int32_t osdcmd_name(osdfuncparm_t const * const parm)
{
char namebuf[32];
@ -862,7 +862,7 @@ static int32_t osdcmd_name(const osdfuncparm_t *parm)
}
static int32_t osdcmd_button(const osdfuncparm_t *parm)
static int32_t osdcmd_button(osdfuncparm_t const * const parm)
{
char const *p = parm->name+9; // skip "gamefunc_"
// if (g_player[myconnectindex].ps->gm == MODE_GAME) // only trigger these if in game
@ -983,7 +983,7 @@ const char *const ConsoleButtons[] =
"mwheeldn", "mouse5", "mouse6", "mouse7", "mouse8"
};
static int32_t osdcmd_bind(const osdfuncparm_t *parm)
static int32_t osdcmd_bind(osdfuncparm_t const * const parm)
{
int32_t i, j, repeat;
@ -1133,11 +1133,11 @@ static int32_t osdcmd_bind(const osdfuncparm_t *parm)
return OSDCMD_OK;
}
static int32_t osdcmd_unbindall(const osdfuncparm_t *parm)
static int32_t osdcmd_unbindall(osdfuncparm_t const * const UNUSED(parm))
{
int32_t i;
UNREFERENCED_PARAMETER(parm);
UNREFERENCED_CONST_PARAMETER(parm);
for (i=0; i<MAXBOUNDKEYS; i++)
CONTROL_FreeKeyBind(i);
@ -1157,7 +1157,7 @@ static int32_t osdcmd_unbindall(const osdfuncparm_t *parm)
return OSDCMD_OK;
}
static int32_t osdcmd_unbind(const osdfuncparm_t *parm)
static int32_t osdcmd_unbind(osdfuncparm_t const * const parm)
{
int32_t i;
@ -1190,27 +1190,27 @@ static int32_t osdcmd_unbind(const osdfuncparm_t *parm)
return OSDCMD_OK;
}
static int32_t osdcmd_quicksave(const osdfuncparm_t *parm)
static int32_t osdcmd_quicksave(osdfuncparm_t const * const UNUSED(parm))
{
UNREFERENCED_PARAMETER(parm);
UNREFERENCED_CONST_PARAMETER(parm);
if (!(g_player[myconnectindex].ps->gm & MODE_GAME))
OSD_Printf("quicksave: not in a game.\n");
else g_doQuickSave = 1;
return OSDCMD_OK;
}
static int32_t osdcmd_quickload(const osdfuncparm_t *parm)
static int32_t osdcmd_quickload(osdfuncparm_t const * const UNUSED(parm))
{
UNREFERENCED_PARAMETER(parm);
UNREFERENCED_CONST_PARAMETER(parm);
if (!(g_player[myconnectindex].ps->gm & MODE_GAME))
OSD_Printf("quickload: not in a game.\n");
else g_doQuickSave = 2;
return OSDCMD_OK;
}
static int32_t osdcmd_screenshot(const osdfuncparm_t *parm)
static int32_t osdcmd_screenshot(osdfuncparm_t const * const UNUSED(parm))
{
UNREFERENCED_PARAMETER(parm);
UNREFERENCED_CONST_PARAMETER(parm);
// KB_ClearKeysDown();
screencapture(
#ifndef EDUKE32_STANDALONE
@ -1223,14 +1223,14 @@ static int32_t osdcmd_screenshot(const osdfuncparm_t *parm)
}
#if 0
static int32_t osdcmd_savestate(const osdfuncparm_t *parm)
static int32_t osdcmd_savestate(osdfuncparm_t const * const UNUSED(parm))
{
UNREFERENCED_PARAMETER(parm);
G_SaveMapState();
return OSDCMD_OK;
}
static int32_t osdcmd_restorestate(const osdfuncparm_t *parm)
static int32_t osdcmd_restorestate(osdfuncparm_t const * const UNUSED(parm))
{
UNREFERENCED_PARAMETER(parm);
G_RestoreMapState();
@ -1239,7 +1239,7 @@ static int32_t osdcmd_restorestate(const osdfuncparm_t *parm)
#endif
#ifdef DEBUGGINGAIDS
static int32_t osdcmd_inittimer(const osdfuncparm_t *parm)
static int32_t osdcmd_inittimer(osdfuncparm_t const * const parm)
{
if (parm->numparms != 1)
{
@ -1254,14 +1254,14 @@ static int32_t osdcmd_inittimer(const osdfuncparm_t *parm)
}
#endif
static int32_t osdcmd_disconnect(const osdfuncparm_t *parm)
static int32_t osdcmd_disconnect(osdfuncparm_t const * const UNUSED(parm))
{
UNREFERENCED_PARAMETER(parm);
UNREFERENCED_CONST_PARAMETER(parm);
g_netDisconnect = 1;
return OSDCMD_OK;
}
static int32_t osdcmd_connect(const osdfuncparm_t *parm)
static int32_t osdcmd_connect(osdfuncparm_t const * const parm)
{
if (parm->numparms != 1)
return OSDCMD_SHOWHELP;
@ -1271,7 +1271,7 @@ static int32_t osdcmd_connect(const osdfuncparm_t *parm)
return OSDCMD_OK;
}
static int32_t osdcmd_password(const osdfuncparm_t *parm)
static int32_t osdcmd_password(osdfuncparm_t const * const parm)
{
if (parm->numparms < 1)
{
@ -1284,7 +1284,7 @@ static int32_t osdcmd_password(const osdfuncparm_t *parm)
}
#if !defined NETCODE_DISABLE
static int32_t osdcmd_listplayers(const osdfuncparm_t *parm)
static int32_t osdcmd_listplayers(osdfuncparm_t const * const parm)
{
ENetPeer *currentPeer;
char ipaddr[32];
@ -1315,7 +1315,7 @@ static int32_t osdcmd_listplayers(const osdfuncparm_t *parm)
return OSDCMD_OK;
}
static int32_t osdcmd_kick(const osdfuncparm_t *parm)
static int32_t osdcmd_kick(osdfuncparm_t const * const parm)
{
ENetPeer *currentPeer;
uint32_t hexaddr;
@ -1353,7 +1353,7 @@ static int32_t osdcmd_kick(const osdfuncparm_t *parm)
return OSDCMD_OK;
}
static int32_t osdcmd_kickban(const osdfuncparm_t *parm)
static int32_t osdcmd_kickban(osdfuncparm_t const * const parm)
{
ENetPeer *currentPeer;
uint32_t hexaddr;
@ -1398,7 +1398,7 @@ static int32_t osdcmd_kickban(const osdfuncparm_t *parm)
}
#endif
static int32_t osdcmd_cvar_set_game(const osdfuncparm_t *parm)
static int32_t osdcmd_cvar_set_game(osdfuncparm_t const * const parm)
{
int32_t r = osdcmd_cvar_set(parm);
@ -1515,7 +1515,7 @@ static int32_t osdcmd_cvar_set_game(const osdfuncparm_t *parm)
return r;
}
static int32_t osdcmd_cvar_set_multi(const osdfuncparm_t *parm)
static int32_t osdcmd_cvar_set_multi(osdfuncparm_t const * const parm)
{
int32_t r = osdcmd_cvar_set_game(parm);
@ -1530,7 +1530,7 @@ int32_t registerosdcommands(void)
{
uint32_t i;
cvar_t cvars_game[] =
static osdcvardata_t cvars_game[] =
{
{ "crosshair", "enable/disable crosshair", (void *)&ud.crosshair, CVAR_BOOL, 0, 1 },
@ -1632,7 +1632,6 @@ int32_t registerosdcommands(void)
{ "skill","changes the game skill setting", (void *)&ud.m_player_skill, CVAR_INT|CVAR_FUNCPTR/*|CVAR_NOMULTI*/, 0, 5 },
{ "snd_ambience", "enables/disables ambient sounds", (void *)&ud.config.AmbienceToggle, CVAR_BOOL, 0, 1 },
{ "snd_speech", "enables/disables player speech", (void *)&ud.config.VoiceToggle, CVAR_INT, 0, 5 },
{ "snd_enabled", "enables/disables sound effects", (void *)&ud.config.SoundToggle, CVAR_BOOL, 0, 1 },
{ "snd_mastervolume", "master volume for sound system", (void *)&ud.config.MasterVolume, CVAR_INT, 0, 255 },
{ "snd_fxvolume", "volume of sound effects", (void *)&ud.config.FXVolume, CVAR_INT, 1, 255 },
@ -1640,6 +1639,7 @@ int32_t registerosdcommands(void)
{ "snd_numchannels", "the number of sound channels", (void *)&ud.config.NumChannels, CVAR_INT, 0, 2 },
{ "snd_numvoices", "the number of concurrent sounds", (void *)&ud.config.NumVoices, CVAR_INT, 0, 256 },
{ "snd_reversestereo", "reverses the stereo channels", (void *)&ud.config.ReverseStereo, CVAR_BOOL, 0, 1 },
{ "snd_speech", "enables/disables player speech", (void *)&ud.config.VoiceToggle, CVAR_INT, 0, 5 },
{ "team","change team in multiplayer", (void *)&ud.team, CVAR_INT|CVAR_MULTI, 0, 3 },
@ -1661,21 +1661,15 @@ int32_t registerosdcommands(void)
for (i=0; i<ARRAY_SIZE(cvars_game); i++)
{
if (OSD_RegisterCvar(&cvars_game[i]))
continue;
switch (cvars_game[i].type & (CVAR_FUNCPTR|CVAR_MULTI))
switch (cvars_game[i].flags & (CVAR_FUNCPTR|CVAR_MULTI))
{
case CVAR_FUNCPTR:
OSD_RegisterFunction(cvars_game[i].name, cvars_game[i].desc, osdcmd_cvar_set_game);
break;
OSD_RegisterCvar(&cvars_game[i], osdcmd_cvar_set_game); break;
case CVAR_MULTI:
case CVAR_FUNCPTR|CVAR_MULTI:
OSD_RegisterFunction(cvars_game[i].name, cvars_game[i].desc, osdcmd_cvar_set_multi);
break;
OSD_RegisterCvar(&cvars_game[i], osdcmd_cvar_set_multi); break;
default:
OSD_RegisterFunction(cvars_game[i].name, cvars_game[i].desc, osdcmd_cvar_set);
break;
OSD_RegisterCvar(&cvars_game[i], osdcmd_cvar_set); break;
}
}

View file

@ -1164,15 +1164,12 @@ void P_DoQuote(int32_t q, DukePlayer_t *p)
if (p->ftq != q)
{
if (p == g_player[screenpeek].ps
&& Bstrcmp(apStrings[q], "")) // avoid printing blank quotes
{
if (cq) OSD_Printf(OSDTEXT_BLUE "%s\n", apStrings[q]);
else OSD_Printf("%s\n", apStrings[q]);
}
if (p == g_player[screenpeek].ps && apStrings[q][0] != '\0')
OSD_Printf(cq ? OSDTEXT_DEFAULT "%s\n" : "%s\n", apStrings[q]);
p->ftq = q;
}
pub = NUMPAGES;
pus = NUMPAGES;
}