diff --git a/polymer/eduke32/build/src/osd.c b/polymer/eduke32/build/src/osd.c index 221058a29..f80028a96 100644 --- a/polymer/eduke32/build/src/osd.c +++ b/polymer/eduke32/build/src/osd.c @@ -142,20 +142,26 @@ static int32_t OSD_CvarModified(const osdcvar_t *cvar) return 0; } - switch (cvar->c.type & (CVAR_BOOL|CVAR_INT|CVAR_UINT|CVAR_FLOAT|CVAR_DOUBLE)) + int rv = 0; + + switch (cvar->c.type & (CVAR_BOOL|CVAR_INT|CVAR_UINT|CVAR_FLOAT|CVAR_DOUBLE|CVAR_STRING)) { case CVAR_BOOL: case CVAR_INT: - return (cvar->dval.i != *(int32_t *)cvar->c.vptr); + rv = (cvar->dval.i != *(int32_t *)cvar->c.vptr); break; case CVAR_UINT: - return (cvar->dval.uint != *(uint32_t *)cvar->c.vptr); + rv = (cvar->dval.uint != *(uint32_t *)cvar->c.vptr); break; case CVAR_FLOAT: - return (cvar->dval.f != *(float *)cvar->c.vptr); + rv = (cvar->dval.f != *(float *)cvar->c.vptr); break; case CVAR_DOUBLE: - return (cvar->dval.d != *(double *)cvar->c.vptr); + rv = (cvar->dval.d != *(double *)cvar->c.vptr); break; + case CVAR_STRING: + rv = 1; break; default: - EDUKE32_UNREACHABLE_SECTION(return 0); + EDUKE32_UNREACHABLE_SECTION(break); } + + return rv; } // color code format is as follows: diff --git a/polymer/eduke32/source/config.c b/polymer/eduke32/source/config.c index 651da7c5b..284a53c98 100644 --- a/polymer/eduke32/source/config.c +++ b/polymer/eduke32/source/config.c @@ -725,17 +725,6 @@ int32_t CONFIG_ReadSetup(void) SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "Executions",&ud.executions); - // weapon choices are defaulted in G_CheckCommandLine, which may override them - if (!g_forceWeaponChoice) - for (i=0; i<=FREEZE_WEAPON; i++) - { - Bsprintf(buf,"WeaponChoice%d",i); - dummy = -1; - SCRIPT_GetNumber(ud.config.scripthandle, "Misc", buf, &dummy); - if (dummy >= 0 && dummy <= FREEZE_WEAPON) - g_player[0].wchoice[i] = dummy; - } - #ifdef _WIN32 SCRIPT_GetNumber(ud.config.scripthandle, "Updates", "CheckForUpdates", &ud.config.CheckForUpdates); SCRIPT_GetNumber(ud.config.scripthandle, "Updates", "LastUpdateCheck", &ud.config.LastUpdateCheck); @@ -858,12 +847,6 @@ void CONFIG_WriteSetup(uint32_t flags) SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "MaxRefreshFreq", maxrefreshfreq, FALSE, FALSE); #endif - for (dummy=0; dummy<10; dummy++) - { - Bsprintf(buf,"WeaponChoice%d",dummy); - SCRIPT_PutNumber(ud.config.scripthandle, "Misc",buf,g_player[myconnectindex].wchoice[dummy],FALSE,FALSE); - } - if (!NAM) { SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "Out",ud.lockout,FALSE,FALSE); @@ -875,118 +858,120 @@ void CONFIG_WriteSetup(uint32_t flags) SCRIPT_PutNumber(ud.config.scripthandle, "Updates", "LastUpdateCheck", ud.config.LastUpdateCheck, FALSE, FALSE); #endif - for (dummy=0; dummy= (MAXMOUSEBUTTONS-2)) continue; + + if (CONFIG_FunctionNumToName(ud.config.MouseFunctions[dummy][1])) + { + Bsprintf(buf, "MouseButtonClicked%d", dummy); + SCRIPT_PutString(ud.config.scripthandle, "Controls", buf, CONFIG_FunctionNumToName(ud.config.MouseFunctions[dummy][1])); + } } - if (dummy >= (MAXMOUSEBUTTONS-2)) continue; - - if (CONFIG_FunctionNumToName(ud.config.MouseFunctions[dummy][1])) + for (dummy=0; dummy 0 || getrendermode() >= REND_POLYMOST) // JBF 20040101: redraw background always { -#ifdef __ANDROID__ - // HACK: this is needed or else we get leftover UI texture crap where we'd get HOM on PC - clearview(0L); -#endif - #ifndef EDUKE32_TOUCH_DEVICES if (ud.screen_size >= 8) #endif @@ -9047,6 +9042,22 @@ FAKE_F3: } + if (KB_UnBoundKeyPressed(sc_F5) && ud.config.MusicToggle) + { + map_t *map = &MapInfo[g_musicIndex]; + char *const qmusic = ScriptQuotes[QUOTE_MUSIC]; + + KB_ClearKeyDown(sc_F5); + + if (map->musicfn != NULL) + Bsnprintf(qmusic, MAXQUOTELEN, "%s. Use SHIFT-F5 to change.", + map->musicfn); + else + qmusic[0] = '\0'; + + P_DoQuote(QUOTE_MUSIC, g_player[myconnectindex].ps); + } + if ((KB_UnBoundKeyPressed(sc_F6) || g_doQuickSave == 1) && (g_player[myconnectindex].ps->gm&MODE_GAME)) { KB_ClearKeyDown(sc_F6); @@ -9092,22 +9103,6 @@ FAKE_F3: P_DoQuote(QUOTE_VIEW_MODE_OFF+g_player[myconnectindex].ps->over_shoulder_on,g_player[myconnectindex].ps); } - if (KB_UnBoundKeyPressed(sc_F5) && ud.config.MusicToggle) - { - map_t *map = &MapInfo[g_musicIndex]; - char *const qmusic = ScriptQuotes[QUOTE_MUSIC]; - - KB_ClearKeyDown(sc_F5); - - if (map->musicfn != NULL) - Bsnprintf(qmusic, MAXQUOTELEN, "%s. Use SHIFT-F5 to change.", - map->musicfn); - else - qmusic[0] = '\0'; - - P_DoQuote(QUOTE_MUSIC, g_player[myconnectindex].ps); - } - if (KB_UnBoundKeyPressed(sc_F8)) { KB_ClearKeyDown(sc_F8); @@ -9153,6 +9148,20 @@ FAKE_F3: } } + if (KB_UnBoundKeyPressed(sc_F11)) + { + KB_ClearKeyDown(sc_F11); + M_ChangeMenu(MENU_COLCORR_INGAME); + FX_StopAllSounds(); + S_ClearSoundLocks(); + M_OpenMenu(myconnectindex); + if ((!g_netServer && ud.multimode < 2) && ud.recstat != 2) + { + ready2send = 0; + totalclock = ototalclock; + } + } + if (ud.overhead_on != 0) { @@ -9216,20 +9225,6 @@ FAKE_F3: g_restorePalette = 1; G_UpdateScreenArea(); } - - if (KB_UnBoundKeyPressed(sc_F11)) - { - KB_ClearKeyDown(sc_F11); - M_ChangeMenu(MENU_COLCORR_INGAME); - FX_StopAllSounds(); - S_ClearSoundLocks(); - M_OpenMenu(myconnectindex); - if ((!g_netServer && ud.multimode < 2) && ud.recstat != 2) - { - ready2send = 0; - totalclock = ototalclock; - } - } } static void G_ShowParameterHelp(void) @@ -9809,6 +9804,7 @@ static void G_CheckCommandLine(int32_t argc, const char **argv) g_player[0].wchoice[7] = 2; g_player[0].wchoice[8] = 9; g_player[0].wchoice[9] = 1; + Bsprintf(ud.wchoice, "3457860291"); #ifdef HAVE_CLIPSHAPE_FEATURE // pre-form the default 10 clipmaps @@ -10352,15 +10348,23 @@ static void G_CheckCommandLine(int32_t argc, const char **argv) while (*c) { g_player[0].wchoice[j] = *c-'0'; + ud.wchoice[j] = *c; c++; j++; } + while (j < 10) { if (j == 9) + { g_player[0].wchoice[9] = 1; + ud.wchoice[9] = '1'; + } else + { g_player[0].wchoice[j] = 2; + ud.wchoice[j] = '2'; + } j++; } @@ -10378,6 +10382,8 @@ static void G_CheckCommandLine(int32_t argc, const char **argv) g_player[0].wchoice[7] = 2; g_player[0].wchoice[8] = 9; g_player[0].wchoice[9] = 1; + + Bsprintf(ud.wchoice, "3457860291"); } break; case 'v': diff --git a/polymer/eduke32/source/game.h b/polymer/eduke32/source/game.h index 242605519..88caf352f 100644 --- a/polymer/eduke32/source/game.h +++ b/polymer/eduke32/source/game.h @@ -254,6 +254,7 @@ typedef struct { char pwlockout[MAXPWLOCKOUT],rtsname[MAXRTSNAME]; char display_bonus_screen; char show_level_text; + char wchoice[MAX_WEAPONS]; } user_defs; diff --git a/polymer/eduke32/source/osdcmds.c b/polymer/eduke32/source/osdcmds.c index 3b801d04f..f6997f7ca 100644 --- a/polymer/eduke32/source/osdcmds.c +++ b/polymer/eduke32/source/osdcmds.c @@ -864,6 +864,7 @@ static int32_t osdcmd_name(const osdfuncparm_t *parm) return OSDCMD_OK; } + static int32_t osdcmd_button(const osdfuncparm_t *parm) { char *p = (char *)parm->name+9; // skip "gamefunc_" @@ -1402,56 +1403,40 @@ static int32_t osdcmd_cvar_set_game(const osdfuncparm_t *parm) { ud.statusbarmode = (ud.screen_size < 8); G_UpdateScreenArea(); - - return r; } else if (!Bstrcasecmp(parm->name, "r_maxfps")) { g_frameDelay = r_maxfps ? Blrintf(1000.f/(float)r_maxfps) : 0; - - return r; } else if (!Bstrcasecmp(parm->name, "r_ambientlight")) { if (r_ambientlight == 0) r_ambientlightrecip = 256.f; else r_ambientlightrecip = 1.f/r_ambientlight; - - return r; } else if (!Bstrcasecmp(parm->name, "in_mouse")) { CONTROL_MouseEnabled = (ud.config.UseMouse && CONTROL_MousePresent); - - return r; } else if (!Bstrcasecmp(parm->name, "in_joystick")) { CONTROL_JoystickEnabled = (ud.config.UseJoystick && CONTROL_JoyPresent); - - return r; } else if (!Bstrcasecmp(parm->name, "vid_gamma")) { ud.brightness = GAMMA_CALC; ud.brightness <<= 2; setbrightness(ud.brightness>>2,g_player[myconnectindex].ps->palette,0); - - return r; } else if (!Bstrcasecmp(parm->name, "vid_brightness") || !Bstrcasecmp(parm->name, "vid_contrast")) { setbrightness(ud.brightness>>2,g_player[myconnectindex].ps->palette,0); - - return r; } else if (!Bstrcasecmp(parm->name, "hud_scale") || !Bstrcasecmp(parm->name, "hud_statusbarmode") || !Bstrcasecmp(parm->name, "r_rotatespritenowidescreen")) { G_UpdateScreenArea(); - - return r; } else if (!Bstrcasecmp(parm->name, "skill")) { @@ -1459,15 +1444,11 @@ static int32_t osdcmd_cvar_set_game(const osdfuncparm_t *parm) return r; ud.player_skill = ud.m_player_skill; - - 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; } else if (!Bstrcasecmp(parm->name, "osdscale")) { @@ -1475,8 +1456,54 @@ static int32_t osdcmd_cvar_set_game(const osdfuncparm_t *parm) if (xdim && ydim) OSD_ResizeDisplay(xdim, ydim); + } + else if (!Bstrcasecmp(parm->name, "wchoice")) + { + if (parm->numparms == 1) + { + if (g_forceWeaponChoice) // rewrite ud.wchoice because osdcmd_cvar_set already changed it + { + int j = 0; - return r; + while (j < 10) + { + ud.wchoice[j] = g_player[myconnectindex].wchoice[j] + '0'; + j++; + } + + ud.wchoice[j] = 0; + } + else + { + char const *c = parm->parms[0]; + + if (*c) + { + int j = 0; + + while (*c && j < 10) + { + g_player[myconnectindex].wchoice[j] = *c - '0'; + c++; + j++; + } + + while (j < 10) + { + if (j == 9) + g_player[myconnectindex].wchoice[9] = 1; + else + g_player[myconnectindex].wchoice[j] = 2; + + j++; + } + } + } + + g_forceWeaponChoice = 0; + } + + /* Net_SendClientInfo();*/ } return r; @@ -1609,16 +1636,17 @@ int32_t registerosdcommands(void) { "team","change team in multiplayer", (void *)&ud.team, CVAR_INT|CVAR_MULTI, 0, 3 }, #ifdef EDUKE32_TOUCH_DEVICES - { "touch_sens_move_x","touch input sensitivity for moving froward/back", (void *)&droidinput.forward_sens, CVAR_FLOAT, 0, 10 }, - { "touch_sens_move_y","touch input sensitivity for strafing", (void *)&droidinput.strafe_sens, CVAR_FLOAT, 0, 10 }, - { "touch_sens_look_x", "touch input sensitivity for turning left/right", (void *) &droidinput.yaw_sens, CVAR_FLOAT, 0, 10 }, - { "touch_sens_move_y", "touch input sensitivity for looking up/down", (void *) &droidinput.pitch_sens, CVAR_FLOAT, 0, 10 }, + { "touch_sens_move_x","touch input sensitivity for moving froward/back", (void *)&droidinput.forward_sens, CVAR_FLOAT, 1, 9 }, + { "touch_sens_move_y","touch input sensitivity for strafing", (void *)&droidinput.strafe_sens, CVAR_FLOAT, 1, 9 }, + { "touch_sens_look_x", "touch input sensitivity for turning left/right", (void *) &droidinput.yaw_sens, CVAR_FLOAT, 1, 9 }, + { "touch_sens_look_y", "touch input sensitivity for looking up/down", (void *) &droidinput.pitch_sens, CVAR_FLOAT, 1, 9 }, { "touch_invert", "invert look up/down touch input", (void *) &droidinput.invertLook, CVAR_INT, 0, 1 }, #endif { "vid_gamma","adjusts gamma component of gamma ramp",(void *)&vid_gamma, CVAR_FLOAT|CVAR_FUNCPTR, 0, 10 }, { "vid_contrast","adjusts contrast component of gamma ramp",(void *)&vid_contrast, CVAR_FLOAT|CVAR_FUNCPTR, 0, 10 }, { "vid_brightness","adjusts brightness component of gamma ramp",(void *)&vid_brightness, CVAR_FLOAT|CVAR_FUNCPTR, 0, 10 }, + { "wchoice","sets weapon autoselection order", (void *)ud.wchoice, CVAR_STRING|CVAR_FUNCPTR, 0, MAX_WEAPONS }, }; osdcmd_cheatsinfo_stat.cheatnum = -1;