From 6b5ec5b3f65bd2e6e1420c9ccfe692882108d941 Mon Sep 17 00:00:00 2001 From: terminx Date: Sun, 9 May 2010 22:12:29 +0000 Subject: [PATCH] fix a few more reported issues git-svn-id: https://svn.eduke32.com/eduke32@1635 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/build/src/osd.c | 55 +++- polymer/eduke32/build/src/winlayer.c | 46 +--- polymer/eduke32/source/astub.c | 51 ---- polymer/eduke32/source/config.c | 377 +-------------------------- polymer/eduke32/source/game.c | 13 +- polymer/eduke32/source/osdcmds.c | 94 +++---- 6 files changed, 101 insertions(+), 535 deletions(-) diff --git a/polymer/eduke32/build/src/osd.c b/polymer/eduke32/build/src/osd.c index 78b79d4f3..363925c9d 100644 --- a/polymer/eduke32/build/src/osd.c +++ b/polymer/eduke32/build/src/osd.c @@ -9,6 +9,7 @@ #include "cache1d.h" #include "pragmas.h" #include "scancodes.h" +#include "crc32.h" symbol_t *symbols = NULL; static symbol_t *addnewsymbol(const char *name); @@ -298,6 +299,54 @@ static int32_t _internal_osdfunc_exec(const osdfuncparm_t *parm) return OSDCMD_OK; } +static int32_t _internal_osdfunc_echo(const osdfuncparm_t *parm) +{ + int32_t i; + for (i = 0; i < parm->numparms; i++) + { + if (i > 0) OSD_Printf(" "); + OSD_Printf("%s", parm->parms[i]); + } + OSD_Printf("\n"); + + return OSDCMD_OK; +} + +static int32_t _internal_osdfunc_fileinfo(const osdfuncparm_t *parm) +{ + uint32_t crc, length; + int32_t i,j; + char buf[256]; + + if (parm->numparms != 1) return OSDCMD_SHOWHELP; + + if ((i = kopen4load((char *)parm->parms[0],0)) < 0) + { + OSD_Printf("fileinfo: File \"%s\" not found.\n", parm->parms[0]); + return OSDCMD_OK; + } + + length = kfilelength(i); + + crc32init(&crc); + do + { + j = kread(i,buf,256); + crc32block(&crc,(uint8_t *)buf,j); + } + while (j == 256); + crc32finish(&crc); + + kclose(i); + + OSD_Printf("fileinfo: %s\n" + " File size: %d\n" + " CRC-32: %08X\n", + parm->parms[0], length, crc); + + return OSDCMD_OK; +} + static void _internal_drawosdchar(int32_t x, int32_t y, char ch, int32_t shade, int32_t pal) { char st[2] = { 0,0 }; @@ -590,7 +639,7 @@ void OSD_Init(void) { "osdtextpal","osdtextpal: sets the palette of the OSD text",(void *)&osdtextpal, CVAR_INT, 0, MAXPALOOKUPS-1 }, { "osdeditshade","osdeditshade: sets the shade of the OSD input text",(void *)&osdeditshade, CVAR_INT, 0, 7 }, { "osdtextshade","osdtextshade: sets the shade of the OSD text",(void *)&osdtextshade, CVAR_INT, 0, 7 }, - { "osdpromptshade","osdpromptshade: sets the shade of the OSD prompt",(void *)&osdpromptshade, CVAR_INT, -128, 127 }, + { "osdpromptshade","osdpromptshade: sets the shade of the OSD prompt",(void *)&osdpromptshade, CVAR_INT, INT8_MIN, INT8_MAX }, { "osdrows","osdrows: sets the number of visible lines of the OSD",(void *)&osdrows, CVAR_INT|CVAR_FUNCPTR, 0, MAXPALOOKUPS-1 }, { "osdtextmode","osdtextmode: set OSD text mode (0:graphical, 1:fast)",(void *)&osdtextmode, CVAR_BOOL|CVAR_FUNCPTR, 0, 1 }, { "logcutoff","logcutoff: sets the maximal line count of the log file",(void *)&logcutoff, CVAR_INT, 0, 262144 }, @@ -618,10 +667,12 @@ void OSD_Init(void) OSD_RegisterFunction("alias","alias: creates an alias for calling multiple commands",_internal_osdfunc_alias); OSD_RegisterFunction("clear","clear: clears the console text buffer",_internal_osdfunc_clear); + OSD_RegisterFunction("echo","echo [text]: echoes text to the console", _internal_osdfunc_echo); OSD_RegisterFunction("exec","exec : executes a script", _internal_osdfunc_exec); + OSD_RegisterFunction("fileinfo","fileinfo : gets a file's information", _internal_osdfunc_fileinfo); OSD_RegisterFunction("help","help: displays help for the specified cvar or command; \"listsymbols\" to show all commands",_internal_osdfunc_help); OSD_RegisterFunction("history","history: displays the console command history",_internal_osdfunc_history); - OSD_RegisterFunction("listsymbols","listsymbols: lists all registered functions and cvars",_internal_osdfunc_listsymbols); + OSD_RegisterFunction("listsymbols","listsymbols: lists all registered functions, cvars and aliases",_internal_osdfunc_listsymbols); OSD_RegisterFunction("unalias","unalias: removes a command alias",_internal_osdfunc_unalias); atexit(OSD_Cleanup); diff --git a/polymer/eduke32/build/src/winlayer.c b/polymer/eduke32/build/src/winlayer.c index 06bd0c426..31855dbcc 100644 --- a/polymer/eduke32/build/src/winlayer.c +++ b/polymer/eduke32/build/src/winlayer.c @@ -992,7 +992,6 @@ static BOOL CALLBACK InitDirectInput_enum(LPCDIDEVICEINSTANCE lpddi, LPVOID pvRe { case DIDEVTYPE_JOYSTICK: { - int32_t i; inputdevices |= (1<<(JOYSTICK+2)); joyisgamepad = ((lpddi->dwDevType & (DIDEVTYPEJOYSTICK_GAMEPAD<<8)) != 0); d = joyisgamepad ? "GAMEPAD" : "JOYSTICK"; @@ -1252,7 +1251,6 @@ static void UninitDirectInput(void) static void GetKeyNames(void) { int32_t i; - HRESULT res; char tbuf[MAX_PATH]; memset(key_names,0,sizeof(key_names)); @@ -1346,10 +1344,11 @@ static void AcquireInputDevices(char acquire, int8_t device) // static inline void DI_PollJoysticks(void) { - DWORD i, dwElements = INPUT_BUFFER_SIZE, ev = 0; + DWORD dwElements = INPUT_BUFFER_SIZE; HRESULT result; DIDEVICEOBJECTDATA didod[INPUT_BUFFER_SIZE]; - uint32_t t,u; + uint32_t t; + int32_t i, ev; numdevs = 0; @@ -1384,7 +1383,7 @@ static inline void DI_PollJoysticks(void) // to be read and input events processed ev = MsgWaitForMultipleObjects(numdevs, waithnds, FALSE, 0, 0); - if (ev < WAIT_OBJECT_0 || ev > WAIT_OBJECT_0+numdevs) + if (ev < WAIT_OBJECT_0 || ev > (int32_t)(WAIT_OBJECT_0+numdevs)) return; switch (idevnums[ev - WAIT_OBJECT_0]) @@ -1666,38 +1665,6 @@ static HBITMAP hDIBSection = NULL; static HPALETTE hPalette = NULL; static VOID *lpPixels = NULL; -#define NUM_SYS_COLOURS 25 -static int32_t syscolouridx[NUM_SYS_COLOURS] = -{ - COLOR_SCROLLBAR, // 1 - COLOR_BACKGROUND, - COLOR_ACTIVECAPTION, - COLOR_INACTIVECAPTION, - COLOR_MENU, - COLOR_WINDOW, - COLOR_WINDOWFRAME, - COLOR_MENUTEXT, - COLOR_WINDOWTEXT, - COLOR_CAPTIONTEXT, // 10 - COLOR_ACTIVEBORDER, - COLOR_INACTIVEBORDER, - COLOR_APPWORKSPACE, - COLOR_HIGHLIGHT, - COLOR_HIGHLIGHTTEXT, - COLOR_BTNFACE, - COLOR_BTNSHADOW, - COLOR_GRAYTEXT, - COLOR_BTNTEXT, - COLOR_INACTIVECAPTIONTEXT, // 20 - COLOR_BTNHIGHLIGHT, - COLOR_3DDKSHADOW, - COLOR_3DLIGHT, - COLOR_INFOTEXT, - COLOR_INFOBK // 25 -}; -static DWORD syscolours[NUM_SYS_COLOURS]; -static char system_colours_saved = 0, bw_colours_set = 0; - static int32_t setgammaramp(WORD gt[3][256]); static int32_t getgammaramp(WORD gt[3][256]); @@ -2843,7 +2810,6 @@ static int32_t SetupOpenGL(int32_t width, int32_t height, int32_t bitspp) GLuint PixelFormat; int32_t minidriver; int32_t err; - static int32_t warnonce = 0; pfd.cColorBits = bitspp; hGLWindow = CreateWindow( @@ -3724,9 +3690,12 @@ static LRESULT CALLBACK WndProcCallback(HWND hWnd, UINT uMsg, WPARAM wParam, LPA SetForegroundWindow(hWindow); SetFocus(hWindow); } + + Bmemset(keystatus, 0, sizeof(keystatus)); AcquireInputDevices(appactive,-1); break; } + case WM_ACTIVATE: if (appactive) { @@ -3734,6 +3703,7 @@ static LRESULT CALLBACK WndProcCallback(HWND hWnd, UINT uMsg, WPARAM wParam, LPA SetFocus(hWindow); } + Bmemset(keystatus, 0, sizeof(keystatus)); AcquireInputDevices(appactive,-1); break; diff --git a/polymer/eduke32/source/astub.c b/polymer/eduke32/source/astub.c index 8b82b948f..c134184a3 100644 --- a/polymer/eduke32/source/astub.c +++ b/polymer/eduke32/source/astub.c @@ -8349,54 +8349,6 @@ static int32_t osdcmd_initgroupfile(const osdfuncparm_t *parm) return OSDCMD_OK; } -static int32_t osdcmd_echo(const osdfuncparm_t *parm) -{ - int32_t i; - for (i = 0; i < parm->numparms; i++) - { - if (i > 0) OSD_Printf(" "); - OSD_Printf("%s", parm->parms[i]); - } - OSD_Printf("\n"); - - return OSDCMD_OK; -} - -static int32_t osdcmd_fileinfo(const osdfuncparm_t *parm) -{ - uint32_t crc, length; - int32_t i,j; - char buf[256]; - - if (parm->numparms != 1) return OSDCMD_SHOWHELP; - - if ((i = kopen4load((char *)parm->parms[0],0)) < 0) - { - OSD_Printf("fileinfo: File \"%s\" not found.\n", parm->parms[0]); - return OSDCMD_OK; - } - - length = kfilelength(i); - - crc32init(&crc); - do - { - j = kread(i,buf,256); - crc32block(&crc,(uint8_t *)buf,j); - } - while (j == 256); - crc32finish(&crc); - - kclose(i); - - OSD_Printf("fileinfo: %s\n" - " File size: %d\n" - " CRC-32: %08X\n", - parm->parms[0], length, crc); - - return OSDCMD_OK; -} - static int32_t osdcmd_sensitivity(const osdfuncparm_t *parm) { if (parm->numparms != 1) @@ -8714,11 +8666,8 @@ static int32_t registerosdcommands(void) { OSD_RegisterFunction("addpath","addpath : adds path to game filesystem", osdcmd_addpath); - OSD_RegisterFunction("echo","echo [text]: echoes text to the console", osdcmd_echo); OSD_RegisterFunction("editorgridextent","editorgridextent: sets the size of the 2D mode editing grid",osdcmd_editorgridextent); - OSD_RegisterFunction("fileinfo","fileinfo : gets a file's information", osdcmd_fileinfo); - OSD_RegisterFunction("gamma","gamma : changes brightness", osdcmd_gamma); OSD_RegisterFunction("initgroupfile","initgroupfile : adds a grp file into the game filesystem", osdcmd_initgroupfile); diff --git a/polymer/eduke32/source/config.c b/polymer/eduke32/source/config.c index 3733e85dd..9d90daa70 100644 --- a/polymer/eduke32/source/config.c +++ b/polymer/eduke32/source/config.c @@ -691,72 +691,15 @@ int32_t CONFIG_ReadSetup(void) SCRIPT_GetString(ud.config.scripthandle, "Setup","SelectedGRP",&g_grpNamePtr[0]); } -/* - { - tempbuf[0] = 0; - SCRIPT_GetString(ud.config.scripthandle, "Screen Setup", "AmbientLight",&tempbuf[0]); - if (atof(tempbuf)) - { - r_ambientlight = atof(tempbuf); - r_ambientlightrecip = 1.f/r_ambientlight; - } - } - - SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "Detail",&ud.detail); - - { - extern uint32_t g_frameDelay; - - SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "MaxFPS",&r_maxfps); - r_maxfps = max(0,min(1000,r_maxfps)); - - if (r_maxfps) - g_frameDelay = (1000/r_maxfps); - else g_frameDelay = 0; - } -*/ - -/* - SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "Messages",&ud.fta_on); -*/ - if (!NAM) { SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "Out",&ud.lockout); SCRIPT_GetString(ud.config.scripthandle, "Screen Setup","Password",&ud.pwlockout[0]); } -/* - SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "ScreenGamma",&ud.brightness); -*/ SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "ScreenHeight",&ud.config.ScreenHeight); SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "ScreenMode",&ud.config.ScreenMode); -/* - SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "ScreenSize",&ud.screen_size); -*/ SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "ScreenWidth",&ud.config.ScreenWidth); -/* - SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "Shadows",&ud.shadows); - SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "Tilt",&ud.screen_tilting); - - { - tempbuf[0] = 0; - SCRIPT_GetString(ud.config.scripthandle, "Screen Setup", "VidGamma",&tempbuf[0]); - if (tempbuf[0]) vid_gamma = atof(tempbuf); - } - - { - tempbuf[0] = 0; - SCRIPT_GetString(ud.config.scripthandle, "Screen Setup", "VidBrightness",&tempbuf[0]); - if (tempbuf[0]) vid_brightness = atof(tempbuf); - } - - { - tempbuf[0] = 0; - SCRIPT_GetString(ud.config.scripthandle, "Screen Setup", "VidContrast",&tempbuf[0]); - if (tempbuf[0]) vid_contrast = atof(tempbuf); - } -*/ #ifdef RENDERTYPEWIN { @@ -768,82 +711,18 @@ int32_t CONFIG_ReadSetup(void) } #endif -/* - { -#ifdef _WIN32 - dummy = 0; -#else - dummy = 1; -#endif - SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "OSDTextMode",&dummy); - OSD_SetTextMode(dummy); - } + SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "ScreenBPP", &ud.config.ScreenBPP); + if (ud.config.ScreenBPP < 8) ud.config.ScreenBPP = 32; -#ifdef RENDERTYPEWIN - SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "MaxRefreshFreq", (int32_t*)&maxrefreshfreq); -#endif - -#if defined(POLYMOST) && defined(USE_OPENGL) - SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "GLAnimationSmoothing", &r_animsmoothing); - SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "GLAnisotropy", &glanisotropy); - / *SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "GLDepthPeeling", &r_depthpeeling);* / - SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "GLDetailMapping", &r_detailmapping); - SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "GLFullbrights", &r_fullbrights); - SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "GLGlowMapping", &r_glowmapping); - SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "GLOcclusionChecking", &r_modelocclusionchecking); - SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "GLParallaxSkyClamping", &r_parallaxskyclamping); - SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "GLParallaxSkyPanning", &r_parallaxskypanning); - / *SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "GLPeelsCount", &r_peelscount);* / - SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "GLProjectionFix", &glprojectionhacks); -*/ SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "Polymer", &dummy); - if (dummy > 0) glrendmode = 4; + if (dummy > 0 && ud.config.ScreenBPP >= 16) glrendmode = 4; else glrendmode = 3; -/* - SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "GLTextureMode", &gltexfiltermode); - SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "GLTextureQuality", &r_downsize); - r_downsizevar = r_downsize; - SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "GLUseCompressedTextureCache", &glusetexcache); - SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "GLUseTextureCompr", &glusetexcompr); - SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "GLVBOCount", &r_vbocount); - SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "GLVBOs", &r_vbos); - SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "GLVertexArrays", &r_vertexarrays); - SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "GLVSync", &vsync); - SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "GLWidescreen", &glwidescreen); - SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "OSDHightile",&osdhightile); -*/ - - { - SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "ScreenBPP", &ud.config.ScreenBPP); - if (ud.config.ScreenBPP < 8) ud.config.ScreenBPP = 32; - } /* - { - dummy = usehightile; - SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "UseHightile",&dummy); - usehightile = dummy != 0; - } - { - dummy = usemodels; - SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "UseModels",&dummy); - usemodels = dummy != 0; - } -#endif - - SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "AltHud",&ud.althud); - SCRIPT_GetNumber(ud.config.scripthandle, "Misc","AngleInterpolation",&ud.angleinterpolation); - SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "AutoMsg",&ud.automsg); - SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "AutoVote",&ud.autovote); - - { SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "Color",&ud.color); G_CheckPlayerColor((int32_t *)&ud.color,-1); g_player[0].ps->palookup = g_player[0].pcolor = ud.color; - } - - { tempbuf[0] = 0; SCRIPT_GetString(ud.config.scripthandle, "Misc", "CrosshairColor",&tempbuf[0]); if (tempbuf[0]) @@ -864,59 +743,9 @@ int32_t CONFIG_ReadSetup(void) DefaultCrosshairColors.f = 1; } } - } */ -/* - SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "CrosshairScale",&ud.crosshairscale); - SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "Crosshairs",&ud.crosshair); - SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "DeathMessages",&ud.obituaries); - SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "DemoCams",&ud.democams); - */ SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "Executions",&ud.executions); - /* - SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "IDPlayers",&ud.idplayers); - SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "MPMessageDisplayTime",&ud.msgdisptime); - SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "RunMode",&ud.config.RunMode); - SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "ShowFPS",&ud.tickrate); - SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "ShowLevelStats",&ud.levelstats); - SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "ShowOpponentWeapons",&ud.config.ShowOpponentWeapons); ud.showweapons = ud.config.ShowOpponentWeapons; - SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "ShowViewWeapon",&ud.drawweapon); - SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "StatusBarMode",&ud.statusbarmode); - SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "StatusBarScale",&ud.statusbarscale); -*/ - -/* - { - SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "Team",&dummy); - ud.team = 0; - if (dummy < 4 && dummy > -1) ud.team = dummy; - g_player[0].pteam = ud.team; - } -*/ - -/* - SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "TextScale",&ud.textscale); - dummy = ud.config.useprecache; - SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "UsePrecache",&dummy); - ud.config.useprecache = dummy != 0; - SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "ViewBobbing",&ud.viewbob); - SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "WeaponScale",&ud.weaponscale); - SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "WeaponSway",&ud.weaponsway); - - { - SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "DemoRecDiffs",&demorec_diffs_cvar); - SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "DemoRecDiffTics",&demorec_difftics_cvar); - SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "DemoRecDiffCompress",&demorec_diffcompress_cvar); - SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "DemoRecSyncCompress",&demorec_synccompress_cvar); - SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "DemoPlayDiffs",&demoplay_diffs); - demorec_diffs_cvar = !!demorec_diffs_cvar; - demorec_difftics_cvar = min(max(2, demorec_difftics_cvar), 60*(TICRATE/TICSPERFRAME)); - demorec_diffcompress_cvar = min(max(0, demorec_diffcompress_cvar), 1); - demorec_synccompress_cvar = min(max(0, demorec_synccompress_cvar), 1); - demoplay_diffs = !!demoplay_diffs; - } -*/ // weapon choices are defaulted in G_CheckCommandLine, which may override them if (!g_forceWeaponChoice) @@ -928,60 +757,6 @@ int32_t CONFIG_ReadSetup(void) if (dummy >= 0) g_player[0].wchoice[i] = dummy; } -/* - SCRIPT_GetNumber(ud.config.scripthandle, "Sound Setup", "AmbienceToggle",&ud.config.AmbienceToggle); - SCRIPT_GetNumber(ud.config.scripthandle, "Sound Setup", "FXDevice",&ud.config.FXDevice); - SCRIPT_GetNumber(ud.config.scripthandle, "Sound Setup", "FXVolume",&ud.config.FXVolume); - SCRIPT_GetNumber(ud.config.scripthandle, "Sound Setup", "MixRate",&ud.config.MixRate); - SCRIPT_GetNumber(ud.config.scripthandle, "Sound Setup", "MusicDevice",&ud.config.MusicDevice); - SCRIPT_GetNumber(ud.config.scripthandle, "Sound Setup", "MusicToggle",&ud.config.MusicToggle); - SCRIPT_GetNumber(ud.config.scripthandle, "Sound Setup", "MusicVolume",&ud.config.MusicVolume); - SCRIPT_GetNumber(ud.config.scripthandle, "Sound Setup", "NumBits",&ud.config.NumBits); - SCRIPT_GetNumber(ud.config.scripthandle, "Sound Setup", "NumChannels",&ud.config.NumChannels); - SCRIPT_GetNumber(ud.config.scripthandle, "Sound Setup", "NumVoices",&ud.config.NumVoices); - SCRIPT_GetNumber(ud.config.scripthandle, "Sound Setup", "ReverseStereo",&ud.config.ReverseStereo); - SCRIPT_GetNumber(ud.config.scripthandle, "Sound Setup", "SoundToggle",&ud.config.SoundToggle); - - { - SCRIPT_GetNumber(ud.config.scripthandle, "Sound Setup", "VoiceToggle",&ud.config.VoiceToggle); - // hack to switch old VoiceToggle value over to new bitfield format - if (ud.config.VoiceToggle == 2) ud.config.VoiceToggle = 5; - } -*/ - -/* - SCRIPT_GetNumber(ud.config.scripthandle, "Controls","AimingFlag",(int32_t *)&g_myAimMode); // (if toggle mode) gives state - - { - SCRIPT_GetNumber(ud.config.scripthandle, "Controls","AutoAim",&ud.config.AutoAim); // JBF 20031125 - g_player[0].ps->auto_aim = ud.config.AutoAim; - } - - SCRIPT_GetNumber(ud.config.scripthandle, "Controls","MouseAimingFlipped",&ud.mouseflip); // mouse aiming inverted - - { - SCRIPT_GetNumber(ud.config.scripthandle, "Controls","MouseAiming",&ud.mouseaiming); // 1=momentary/0=toggle - g_player[0].ps->aim_mode = ud.mouseaiming; - } - - SCRIPT_GetNumber(ud.config.scripthandle, "Controls","MouseBias",&ud.config.MouseBias); - SCRIPT_GetNumber(ud.config.scripthandle, "Controls","MouseDeadZone",&ud.config.MouseDeadZone); - SCRIPT_GetNumber(ud.config.scripthandle, "Controls","RunKeyBehaviour",&ud.runkey_mode); // JBF 20031125 - - { - SCRIPT_GetNumber(ud.config.scripthandle, "Controls","SmoothInput",&ud.config.SmoothInput); - control_smoothmouse = ud.config.SmoothInput; - } - - SCRIPT_GetNumber(ud.config.scripthandle, "Controls","UseJoystick",&ud.config.UseJoystick); - SCRIPT_GetNumber(ud.config.scripthandle, "Controls","UseMouse",&ud.config.UseMouse); - - { - SCRIPT_GetNumber(ud.config.scripthandle, "Controls","WeaponSwitchMode",&ud.weaponswitch); - g_player[0].ps->weaponswitch = ud.weaponswitch; - } -*/ - #ifdef _WIN32 SCRIPT_GetNumber(ud.config.scripthandle, "Updates", "CheckForUpdates", &ud.config.CheckForUpdates); SCRIPT_GetNumber(ud.config.scripthandle, "Updates", "LastUpdateCheck", &ud.config.LastUpdateCheck); @@ -1072,56 +847,7 @@ void CONFIG_WriteSetup(void) if (ud.config.scripthandle < 0) ud.config.scripthandle = SCRIPT_Init(setupfilename); -/* - SCRIPT_PutNumber(ud.config.scripthandle, "Controls","AimingFlag",(int32_t) g_myAimMode,FALSE,FALSE); - SCRIPT_PutNumber(ud.config.scripthandle, "Controls","AutoAim",ud.config.AutoAim,FALSE,FALSE); - SCRIPT_PutNumber(ud.config.scripthandle, "Controls","MouseAimingFlipped",ud.mouseflip,FALSE,FALSE); - SCRIPT_PutNumber(ud.config.scripthandle, "Controls","MouseAiming",ud.mouseaiming,FALSE,FALSE); - SCRIPT_PutNumber(ud.config.scripthandle, "Controls","MouseBias",ud.config.MouseBias,FALSE,FALSE); - SCRIPT_PutNumber(ud.config.scripthandle, "Controls","MouseDeadZone",ud.config.MouseDeadZone,FALSE,FALSE); - SCRIPT_PutNumber(ud.config.scripthandle, "Controls","RunKeyBehaviour",ud.runkey_mode,FALSE,FALSE); - SCRIPT_PutNumber(ud.config.scripthandle, "Controls","SmoothInput",ud.config.SmoothInput,FALSE,FALSE); - SCRIPT_PutNumber(ud.config.scripthandle, "Controls","UseJoystick",ud.config.UseJoystick,FALSE,FALSE); - SCRIPT_PutNumber(ud.config.scripthandle, "Controls","UseMouse",ud.config.UseMouse,FALSE,FALSE); - SCRIPT_PutNumber(ud.config.scripthandle, "Controls","WeaponSwitchMode",ud.weaponswitch,FALSE,FALSE); - - SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "AltHud",ud.althud,FALSE,FALSE); -// SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "AngleInterpolation",ud.angleinterpolation,false,false); - SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "AutoMsg",ud.automsg,FALSE,FALSE); - SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "AutoVote",ud.autovote,FALSE,FALSE); - SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "Color",ud.color,FALSE,FALSE); - - if (CrosshairColors.r != DefaultCrosshairColors.r || CrosshairColors.g != DefaultCrosshairColors.g - || CrosshairColors.b != DefaultCrosshairColors.b) - { - Bsprintf(tempbuf,"%d,%d,%d",CrosshairColors.r,CrosshairColors.g,CrosshairColors.b); - SCRIPT_PutString(ud.config.scripthandle, "Misc", "CrosshairColor",tempbuf); - } - - SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "CrosshairScale",ud.crosshairscale,FALSE,FALSE); - SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "Crosshairs",ud.crosshair,FALSE,FALSE); - SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "DeathMessages",ud.obituaries,FALSE,FALSE); - SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "DemoCams",ud.democams,FALSE,FALSE); - */ SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "Executions",++ud.executions,FALSE,FALSE); - /* - SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "IDPlayers",ud.idplayers,FALSE,FALSE); - SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "MPMessageDisplayTime",ud.msgdisptime,FALSE,FALSE); - SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "RunMode",ud.config.RunMode,FALSE,FALSE); - SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "ShowFPS",ud.tickrate,FALSE,FALSE); - SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "ShowLevelStats",ud.levelstats,FALSE,FALSE); - SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "ShowOpponentWeapons",ud.config.ShowOpponentWeapons,FALSE,FALSE); - SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "ShowViewWeapon",ud.drawweapon,FALSE,FALSE); - SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "StatusBarMode",ud.statusbarmode,FALSE,FALSE); - SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "StatusBarScale",ud.statusbarscale,FALSE,FALSE); -*/ - - /*SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "Team",ud.team,FALSE,FALSE);*/ -/* - SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "TextScale",ud.textscale,FALSE,FALSE); - SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "UsePrecache",ud.config.useprecache,FALSE,FALSE); - SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "ViewBobbing",ud.viewbob,FALSE,FALSE); -*/ for (dummy=0; dummy<10; dummy++) { @@ -1129,62 +855,11 @@ void CONFIG_WriteSetup(void) SCRIPT_PutNumber(ud.config.scripthandle, "Misc",buf,g_player[myconnectindex].wchoice[dummy],FALSE,FALSE); } -/* - SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "WeaponScale",ud.weaponscale,FALSE,FALSE); - SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "WeaponSway",ud.weaponsway,FALSE,FALSE); - - SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "DemoRecDiffs",demorec_diffs_cvar,FALSE,FALSE); - SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "DemoRecDiffTics",demorec_difftics_cvar,FALSE,FALSE); - SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "DemoRecDiffCompress",demorec_diffcompress_cvar,FALSE,FALSE); - SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "DemoRecSyncCompress",demorec_synccompress_cvar,FALSE,FALSE); - SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "DemoPlayDiffs",demoplay_diffs,FALSE,FALSE); -*/ - SCRIPT_PutNumber(ud.config.scripthandle, "Setup","ConfigVersion",BYTEVERSION_JF,FALSE,FALSE); SCRIPT_PutNumber(ud.config.scripthandle, "Setup", "ForceSetup",ud.config.ForceSetup,FALSE,FALSE); SCRIPT_PutNumber(ud.config.scripthandle, "Setup", "NoAutoLoad",ud.config.NoAutoLoad,FALSE,FALSE); -/* - { - Bsprintf(tempbuf,"%.2f",r_ambientlight); - SCRIPT_PutString(ud.config.scripthandle, "Screen Setup", "AmbientLight",tempbuf); - } - - SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "Detail",ud.detail,FALSE,FALSE); -#if defined(POLYMOST) && defined(USE_OPENGL) - SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "GLAnimationSmoothing",r_animsmoothing,FALSE,FALSE); - SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "GLAnisotropy",glanisotropy,FALSE,FALSE); - / *SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "GLDepthPeeling",r_depthpeeling,false,false);* / - SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "GLDetailMapping", r_detailmapping,FALSE,FALSE); - SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "GLFullbrights", r_fullbrights,FALSE,FALSE); - SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "GLGlowMapping", r_glowmapping,FALSE,FALSE); - SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "GLOcclusionChecking", r_modelocclusionchecking,FALSE,FALSE); - SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "GLParallaxSkyClamping",r_parallaxskyclamping,FALSE,FALSE); - SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "GLParallaxSkyPanning",r_parallaxskypanning,FALSE,FALSE); - / *SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "GLPeelsCount",r_peelscount,false,false);* / - SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "GLProjectionFix",glprojectionhacks,FALSE,FALSE); -*/ - SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "Polymer",glrendmode == 4,FALSE,FALSE); -/* - SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "GLTextureMode",gltexfiltermode,FALSE,FALSE); - SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "GLTextureQuality", r_downsize,FALSE,FALSE); - SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "GLUseCompressedTextureCache", glusetexcache,FALSE,FALSE); - SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "GLUseTextureCompr",glusetexcompr,FALSE,FALSE); - SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "GLVBOCount", r_vbocount,FALSE,FALSE); - SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "GLVBOs", r_vbos,FALSE,FALSE); - SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "GLVertexArrays", r_vertexarrays,FALSE,FALSE); - SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "GLVSync", vsync,FALSE,FALSE); - SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "GLWidescreen",glwidescreen,FALSE,FALSE); -#endif - SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "MaxFPS", r_maxfps, FALSE, FALSE); -#ifdef RENDERTYPEWIN - SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "MaxRefreshFreq",maxrefreshfreq,FALSE,FALSE); -#endif - SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "Messages",ud.fta_on,FALSE,FALSE); - - SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "OSDHightile",osdhightile,FALSE,FALSE); - SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "OSDTextMode",OSD_GetTextMode(),FALSE,FALSE); -*/ + SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "Polymer",glrendmode == 4 && bpp > 8,FALSE,FALSE); if (!NAM) { @@ -1193,31 +868,9 @@ void CONFIG_WriteSetup(void) } SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "ScreenBPP",ud.config.ScreenBPP,FALSE,FALSE); // JBF 20040523 -/* - SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "ScreenGamma",ud.brightness,FALSE,FALSE); -*/ SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "ScreenHeight",ud.config.ScreenHeight,FALSE,FALSE); // JBF 20031206 SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "ScreenMode",ud.config.ScreenMode,FALSE,FALSE); // JBF 20031206 -/* SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "ScreenSize",ud.screen_size,FALSE,FALSE);*/ SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "ScreenWidth",ud.config.ScreenWidth,FALSE,FALSE); // JBF 20031206 -/* - SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "Shadows",ud.shadows,FALSE,FALSE); - SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "Tilt",ud.screen_tilting,FALSE,FALSE); - -#if defined(POLYMOST) && defined(USE_OPENGL) - SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "UseHightile",usehightile,FALSE,FALSE); - SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "UseModels",usemodels,FALSE,FALSE); -#endif - - { - Bsprintf(tempbuf,"%.2f",vid_brightness); - SCRIPT_PutString(ud.config.scripthandle, "Screen Setup", "VidBrightness",tempbuf); - Bsprintf(tempbuf,"%.2f",vid_contrast); - SCRIPT_PutString(ud.config.scripthandle, "Screen Setup", "VidContrast",tempbuf); - Bsprintf(tempbuf,"%.2f",vid_gamma); - SCRIPT_PutString(ud.config.scripthandle, "Screen Setup", "VidGamma",tempbuf); - } -*/ #ifdef RENDERTYPEWIN SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "WindowPositioning", windowpos, FALSE, FALSE); @@ -1225,34 +878,12 @@ void CONFIG_WriteSetup(void) SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "WindowPosY", windowy, FALSE, FALSE); #endif -/* - SCRIPT_PutNumber(ud.config.scripthandle, "Sound Setup", "AmbienceToggle",ud.config.AmbienceToggle,FALSE,FALSE); - SCRIPT_PutNumber(ud.config.scripthandle, "Sound Setup", "FXVolume",ud.config.FXVolume,FALSE,FALSE); - SCRIPT_PutNumber(ud.config.scripthandle, "Sound Setup", "MusicToggle",ud.config.MusicToggle,FALSE,FALSE); - SCRIPT_PutNumber(ud.config.scripthandle, "Sound Setup", "MusicVolume",ud.config.MusicVolume,FALSE,FALSE); - SCRIPT_PutNumber(ud.config.scripthandle, "Sound Setup", "NumVoices",ud.config.NumVoices,FALSE,FALSE); - SCRIPT_PutNumber(ud.config.scripthandle, "Sound Setup", "NumChannels",ud.config.NumChannels,FALSE,FALSE); - SCRIPT_PutNumber(ud.config.scripthandle, "Sound Setup", "NumBits",ud.config.NumBits,FALSE,FALSE); - SCRIPT_PutNumber(ud.config.scripthandle, "Sound Setup", "MixRate",ud.config.MixRate,FALSE,FALSE); - SCRIPT_PutNumber(ud.config.scripthandle, "Sound Setup", "ReverseStereo",ud.config.ReverseStereo,FALSE,FALSE); - SCRIPT_PutNumber(ud.config.scripthandle, "Sound Setup", "SoundToggle",ud.config.SoundToggle,FALSE,FALSE); - SCRIPT_PutNumber(ud.config.scripthandle, "Sound Setup", "VoiceToggle",ud.config.VoiceToggle,FALSE,FALSE); -*/ #ifdef _WIN32 SCRIPT_PutNumber(ud.config.scripthandle, "Updates", "CheckForUpdates", ud.config.CheckForUpdates, FALSE, FALSE); SCRIPT_PutNumber(ud.config.scripthandle, "Updates", "LastUpdateCheck", ud.config.LastUpdateCheck, FALSE, FALSE); #endif - // JBF 20031211 -/* - for (dummy=0; dummy", // 25 - "sfm", // 26 + "cgs", // 26 }; enum cheatindex_t @@ -8323,7 +8323,7 @@ enum cheatindex_t CHEAT_KEYS, CHEAT_DEBUG, CHEAT_RESERVED3, - CHEAT_SCREAMFORME, + CHEAT_COMEGETSOME, }; void G_CheatGetInv(void) @@ -8567,7 +8567,7 @@ FOUNDCHEAT: KB_FlushKeyBoardQueue(); return; - case CHEAT_SCREAMFORME: + case CHEAT_COMEGETSOME: ud.god = 1-ud.god; if (ud.god) @@ -8586,7 +8586,8 @@ FOUNDCHEAT: sprite[g_player[myconnectindex].ps->i].hitag = 0; sprite[g_player[myconnectindex].ps->i].lotag = 0; sprite[g_player[myconnectindex].ps->i].pal = g_player[myconnectindex].ps->palookup; - Bstrcpy(ScriptQuotes[122],"Scream for me, Long Beach!"); + Bstrcpy(ScriptQuotes[122],"COME GET SOME!"); + S_PlaySound(DUKE_GETWEAPON2); P_DoQuote(122,g_player[myconnectindex].ps); G_CheatGetInv(); for (weapon = PISTOL_WEAPON; weapon < MAX_WEAPONS; weapon++) @@ -11803,6 +11804,7 @@ MAIN_LOOP_RESTART: sampletimer(); MUSIC_Update(); Net_GetPackets(); + G_HandleLocalKeys(); // only allow binds to function if the player is actually in a game (not in a menu, typing, et cetera) or demo bindsenabled = g_player[myconnectindex].ps->gm & (MODE_GAME|MODE_DEMO); @@ -11813,7 +11815,6 @@ MAIN_LOOP_RESTART: { CONTROL_ProcessBinds(); getinput(myconnectindex); - G_HandleLocalKeys(); avg.fvel += loc.fvel; avg.svel += loc.svel; @@ -11841,7 +11842,7 @@ MAIN_LOOP_RESTART: { sampletimer(); - if ((totalclock < ototalclock+TICSPERFRAME) || (ready2send == 0)) return; + if ((totalclock < ototalclock+TICSPERFRAME) || (ready2send == 0)) break; ototalclock += TICSPERFRAME; g_player[myconnectindex].movefifoend++; } diff --git a/polymer/eduke32/source/osdcmds.c b/polymer/eduke32/source/osdcmds.c index 90b552ab1..cb30ce419 100644 --- a/polymer/eduke32/source/osdcmds.c +++ b/polymer/eduke32/source/osdcmds.c @@ -26,7 +26,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "osdcmds.h" #include "baselayer.h" #include "duke3d.h" -#include "crc32.h" #include "osd.h" #include "osdfuncs.h" #include @@ -42,6 +41,7 @@ extern int32_t r_maxfps; extern uint32_t g_frameDelay; extern int32_t demorec_diffs_cvar, demorec_force_cvar, demorec_seeds_cvar, demoplay_diffs, demoplay_showsync; extern int32_t demorec_difftics_cvar, demorec_diffcompress_cvar, demorec_synccompress_cvar; +extern void G_CheckPlayerColor(int32_t *color,int32_t prev_color); static inline int32_t osdcmd_quit(const osdfuncparm_t *parm) { @@ -50,19 +50,6 @@ static inline int32_t osdcmd_quit(const osdfuncparm_t *parm) return OSDCMD_OK; } -static int32_t osdcmd_echo(const osdfuncparm_t *parm) -{ - int32_t i; - for (i = 0; i < parm->numparms; i++) - { - if (i > 0) OSD_Printf(" "); - OSD_Printf("%s", parm->parms[i]); - } - OSD_Printf("\n"); - - return OSDCMD_OK; -} - static int32_t osdcmd_changelevel(const osdfuncparm_t *parm) { int32_t volume=0,level; @@ -343,41 +330,6 @@ static int32_t osdcmd_noclip(const osdfuncparm_t *parm) return OSDCMD_OK; } -static int32_t osdcmd_fileinfo(const osdfuncparm_t *parm) -{ - uint32_t crc, length; - int32_t i,j; - char buf[256]; - - if (parm->numparms != 1) return OSDCMD_SHOWHELP; - - if ((i = kopen4loadfrommod((char *)parm->parms[0],0)) < 0) - { - OSD_Printf("fileinfo: File \"%s\" not found.\n", parm->parms[0]); - return OSDCMD_OK; - } - - length = kfilelength(i); - - crc32init(&crc); - do - { - j = kread(i,buf,256); - crc32block(&crc,(uint8_t *)buf,j); - } - while (j == 256); - crc32finish(&crc); - - kclose(i); - - OSD_Printf("fileinfo: %s\n" - " File size: %d\n" - " CRC-32: %08X\n", - parm->parms[0], length, crc); - - return OSDCMD_OK; -} - static int32_t osdcmd_restartsound(const osdfuncparm_t *parm) { UNREFERENCED_PARAMETER(parm); @@ -1323,14 +1275,6 @@ static int32_t osdcmd_kickban(const osdfuncparm_t *parm) return OSDCMD_OK; } -static int32_t osdcmd_cvar_set_multi(const osdfuncparm_t *parm) -{ - int32_t r = osdcmd_cvar_set(parm); - G_UpdatePlayerFromMenu(); - - return r; -} - static int32_t osdcmd_cvar_set_game(const osdfuncparm_t *parm) { int32_t r = osdcmd_cvar_set(parm); @@ -1397,6 +1341,24 @@ static int32_t osdcmd_cvar_set_game(const osdfuncparm_t *parm) return r; } + else if (!Bstrcasecmp(parm->name, "color")) + { + G_CheckPlayerColor((int32_t *)&ud.color,-1); + g_player[0].ps->palookup = g_player[0].pcolor = ud.color; + + return r; + } + + return r; +} + +static int32_t osdcmd_cvar_set_multi(const osdfuncparm_t *parm) +{ + int32_t r = osdcmd_cvar_set_game(parm); + + if (r != OSDCMD_OK) return r; + + G_UpdatePlayerFromMenu(); return r; } @@ -1426,7 +1388,9 @@ int32_t registerosdcommands(void) { "cl_weaponswitch", "cl_weaponswitch: enable/disable auto weapon switching", (void*)&ud.weaponswitch, CVAR_INT|CVAR_MULTI, 0, 3 }, { "cl_angleinterpolation", "cl_angleinterpolation: enable/disable angle interpolation", (void*)&ud.angleinterpolation, CVAR_INT, 0, 256 }, - { "crosshairscale","crosshairscale: changes the crosshair scale", (void*)&ud.crosshairscale, CVAR_INT, 10, 100 }, + { "color", "color: changes player palette", (void*)&ud.color, CVAR_INT|CVAR_MULTI, 0, g_numRealPalettes }, + + { "crosshairscale","crosshairscale: changes the size of the crosshair", (void*)&ud.crosshairscale, CVAR_INT, 10, 100 }, { "demorec_diffs","demorec_diffs: enable/disable diff recording in demos",(void*)&demorec_diffs_cvar, CVAR_BOOL, 0, 1 }, { "demorec_force","demorec_force: enable/disable forced demo recording",(void*)&demorec_force_cvar, CVAR_BOOL|CVAR_NOSAVE, 0, 1 }, @@ -1454,16 +1418,20 @@ int32_t registerosdcommands(void) { "in_joystick","in_joystick: enables input from the joystick if it is present",(void*)&ud.config.UseJoystick, CVAR_BOOL|CVAR_FUNCPTR, 0, 1 }, { "in_mouse","in_mouse: enables input from the mouse if it is present",(void*)&ud.config.UseMouse, CVAR_BOOL|CVAR_FUNCPTR, 0, 1 }, + { "in_aimmode", "in_aimmode: 0:toggle, 1:hold to aim", (void*)&ud.mouseaiming, CVAR_BOOL, 0, 1 }, { "in_mousebias", "in_mousebias: emulates the original mouse code's weighting of input towards whichever axis is moving the most at any given time", (void*)&ud.config.MouseBias, CVAR_INT, 0, 32 }, { "in_mousedeadzone", "in_mousedeadzone: amount of mouse movement to filter out", (void*)&ud.config.MouseDeadZone, CVAR_INT, 0, 512 }, + { "in_mouseflip", "in_mouseflip: invert vertical mouse movement", (void*)&ud.mouseflip, CVAR_BOOL, 0, 1 }, + { "in_mousemode", "in_mousemode: like pressing U.", (void*)&g_myAimMode, CVAR_BOOL, 0, 1 }, { "in_mousesmoothing", "in_mousesmoothing: enable/disable mouse input smoothing", (void*)&ud.config.SmoothInput, CVAR_BOOL, 0, 1 }, { "mus_enabled", "mus_enabled: enables/disables music", (void*)&ud.config.MusicToggle, CVAR_BOOL, 0, 1 }, { "mus_volume", "mus_musvolume: controls volume of midi music", (void*)&ud.config.MusicVolume, CVAR_INT, 0, 255 }, - { "r_drawweapon", "r_drawweapon: enable/disable weapon drawing", (void*)&ud.drawweapon, CVAR_INT, 0, 2 }, { "osdhightile", "osdhightile: enable/disable hires art replacements for console text", (void*)&osdhightile, CVAR_BOOL, 0, 1 }, + + { "r_drawweapon", "r_drawweapon: enable/disable weapon drawing", (void*)&ud.drawweapon, CVAR_INT, 0, 2 }, { "r_showfps", "r_showfps: show the frame rate counter", (void*)&ud.tickrate, CVAR_INT, 0, 2 }, { "r_shadows", "r_shadows: enable/disable sprite and model shadows", (void*)&ud.shadows, CVAR_BOOL, 0, 1 }, { "r_precache", "r_precache: enable/disable the pre-level caching routine", (void*)&ud.config.useprecache, CVAR_BOOL, 0, 1 }, @@ -1485,7 +1453,7 @@ int32_t registerosdcommands(void) { "snd_numvoices", "snd_numvoices: the number of concurrent sounds", (void*)&ud.config.NumVoices, CVAR_INT, 0, 96 }, { "snd_reversestereo", "snd_reversestereo: reverses the stereo channels", (void*)&ud.config.ReverseStereo, CVAR_BOOL, 0, 16 }, - { "team","team : change team in multiplayer", (void*)&ud.team, CVAR_INT|CVAR_FUNCPTR|CVAR_MULTI, 0, 3 }, + { "team","team : change team in multiplayer", (void*)&ud.team, CVAR_INT|CVAR_MULTI, 0, 3 }, { "vid_gamma","vid_gamma : adjusts gamma ramp",(void*)&vid_gamma, CVAR_DOUBLE|CVAR_FUNCPTR, 0, 10 }, { "vid_contrast","vid_contrast : adjusts gamma ramp",(void*)&vid_contrast, CVAR_DOUBLE|CVAR_FUNCPTR, 0, 10 }, @@ -1505,6 +1473,7 @@ int32_t registerosdcommands(void) OSD_RegisterFunction(cvars_game[i].name, cvars_game[i].helpstr, osdcmd_cvar_set_game); break; case CVAR_MULTI: + case CVAR_FUNCPTR|CVAR_MULTI: OSD_RegisterFunction(cvars_game[i].name, cvars_game[i].helpstr, osdcmd_cvar_set_multi); break; default: @@ -1529,9 +1498,6 @@ int32_t registerosdcommands(void) OSD_RegisterFunction("connect","connect: connects to a multiplayer game", osdcmd_connect); OSD_RegisterFunction("disconnect","disconnect: disconnects from the local multiplayer game", osdcmd_disconnect); - OSD_RegisterFunction("echo","echo [text]: echoes text to the console", osdcmd_echo); - OSD_RegisterFunction("fileinfo","fileinfo : gets a file's information", osdcmd_fileinfo); - for (i=0; i: changes brightness (obsolete)", osdcmd_setbrightness); OSD_RegisterFunction("give","give : gives requested item", osdcmd_give); OSD_RegisterFunction("god","god: toggles god mode", osdcmd_god); @@ -1569,7 +1534,6 @@ int32_t registerosdcommands(void) OSD_RegisterFunction("quit","quit: exits the game immediately", osdcmd_quit); OSD_RegisterFunction("exit","exit: exits the game immediately", osdcmd_quit); -// OSD_RegisterFunction("rate","rate: sets the multiplayer packet send rate, in packets/sec",osdcmd_rate); OSD_RegisterFunction("restartsound","restartsound: reinitializes the sound system",osdcmd_restartsound); OSD_RegisterFunction("restartvid","restartvid: reinitializes the video mode",osdcmd_restartvid);