mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-15 08:52:00 +00:00
NRedneck compiles with MSVC now
# Conflicts: # platform/Windows/eduke32.sln # source/build/src/tilepacker.cpp # source/rr/src/common.cpp # source/rr/src/duke3d.h # source/rr/src/game.cpp # source/rr/src/menus.cpp # source/rr/src/osdcmds.cpp # source/rr/src/screens.cpp
This commit is contained in:
parent
26c0490763
commit
bdd7bb72d8
23 changed files with 673 additions and 764 deletions
|
@ -22,6 +22,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
|
||||
#pragma once
|
||||
|
||||
#define MAXCHEATLEN 20
|
||||
#define NUMCHEATCODES (int32_t)ARRAY_SIZE(CheatStrings)
|
||||
|
||||
extern void G_DoCheats(void);
|
||||
extern void G_SetupCheats(void);
|
||||
|
||||
|
|
|
@ -20,6 +20,11 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
*/
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
#ifndef cmdline_h__
|
||||
#define cmdline_h__
|
||||
|
||||
#include "compat.h"
|
||||
|
||||
extern void G_CheckCommandLine(int32_t argc, char const * const * argv);
|
||||
extern void G_ShowParameterHelp(void);
|
||||
extern void G_ShowDebugHelp(void);
|
||||
|
@ -33,3 +38,4 @@ extern const char *CommandMap;
|
|||
extern const char *CommandName;
|
||||
extern int32_t g_forceWeaponChoice;
|
||||
extern int32_t g_fakeMultiMode;
|
||||
#endif // cmdline_h__
|
||||
|
|
|
@ -211,8 +211,6 @@ void G_SetupGlobalPsky(void)
|
|||
//////////
|
||||
|
||||
static char g_rootDir[BMAX_PATH];
|
||||
//char g_modDir[BMAX_PATH] = "/";
|
||||
|
||||
int g_useCwd;
|
||||
static void G_LoadAddon(void);
|
||||
int32_t g_groupFileHandle;
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#ifndef EDUKE32_COMMON_GAME_H_
|
||||
#define EDUKE32_COMMON_GAME_H_
|
||||
|
||||
#include "collections.h"
|
||||
#include "grpscan.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -133,8 +134,6 @@ extern void G_SetupGlobalPsky(void);
|
|||
|
||||
//////////
|
||||
|
||||
extern char g_modDir[BMAX_PATH];
|
||||
extern int kopen4loadfrommod(const char *filename, char searchfirst);
|
||||
extern void G_AddSearchPaths(void);
|
||||
extern void G_CleanupSearchPaths(void);
|
||||
|
||||
|
|
|
@ -116,24 +116,52 @@ const char *CONFIG_AnalogNumToName(int32_t func)
|
|||
}
|
||||
|
||||
|
||||
void CONFIG_SetDefaultKeys(const char (*keyptr)[MAXGAMEFUNCLEN])
|
||||
void CONFIG_SetDefaultKeys(const char (*keyptr)[MAXGAMEFUNCLEN], bool lazy/*=false*/)
|
||||
{
|
||||
Bmemset(ud.config.KeyboardKeys, 0xff, sizeof(ud.config.KeyboardKeys));
|
||||
static char const s_gamefunc_[] = "gamefunc_";
|
||||
int constexpr strlen_gamefunc_ = ARRAY_SIZE(s_gamefunc_) - 1;
|
||||
|
||||
CONTROL_ClearAllBinds();
|
||||
if (!lazy)
|
||||
{
|
||||
Bmemset(ud.config.KeyboardKeys, 0xff, sizeof(ud.config.KeyboardKeys));
|
||||
CONTROL_ClearAllBinds();
|
||||
}
|
||||
|
||||
for (size_t i=0; i < ARRAY_SIZE(gamefunctions); ++i)
|
||||
for (int i=0; i < ARRAY_SSIZE(gamefunctions); ++i)
|
||||
{
|
||||
if (gamefunctions[i][0] == '\0')
|
||||
continue;
|
||||
|
||||
ud.config.KeyboardKeys[i][0] = KB_StringToScanCode(keyptr[i<<1]);
|
||||
ud.config.KeyboardKeys[i][1] = KB_StringToScanCode(keyptr[(i<<1)+1]);
|
||||
auto &key = ud.config.KeyboardKeys[i];
|
||||
|
||||
int const default0 = KB_StringToScanCode(keyptr[i<<1]);
|
||||
int const default1 = KB_StringToScanCode(keyptr[(i<<1)+1]);
|
||||
|
||||
// skip the function if the default key is already used
|
||||
// or the function is assigned to another key
|
||||
if (lazy && (key[0] != 0xff || (CONTROL_KeyIsBound(default0) && Bstrlen(CONTROL_KeyBinds[default0].cmdstr) > strlen_gamefunc_
|
||||
&& CONFIG_FunctionNameToNum(CONTROL_KeyBinds[default0].cmdstr + strlen_gamefunc_) >= 0)))
|
||||
{
|
||||
#if 0 // defined(DEBUGGINGAIDS)
|
||||
if (key[0] != 0xff)
|
||||
initprintf("Skipping %s bound to %s\n", keyptr[i<<1], CONTROL_KeyBinds[default0].cmdstr);
|
||||
#endif
|
||||
continue;
|
||||
}
|
||||
|
||||
key[0] = default0;
|
||||
key[1] = default1;
|
||||
|
||||
if (key[0])
|
||||
CONTROL_FreeKeyBind(key[0]);
|
||||
|
||||
if (key[1])
|
||||
CONTROL_FreeKeyBind(key[1]);
|
||||
|
||||
if (i == gamefunc_Show_Console)
|
||||
OSD_CaptureKey(ud.config.KeyboardKeys[i][0]);
|
||||
OSD_CaptureKey(key[0]);
|
||||
else
|
||||
CONFIG_MapKey(i, ud.config.KeyboardKeys[i][0], 0, ud.config.KeyboardKeys[i][1], 0);
|
||||
CONFIG_MapKey(i, key[0], 0, key[1], 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -154,8 +182,8 @@ void CONFIG_SetDefaults(void)
|
|||
droidinput.toggleCrouch = 1;
|
||||
droidinput.quickSelectWeapon = 1;
|
||||
|
||||
ud.config.ScreenWidth = droidinfo.screen_width;
|
||||
ud.config.ScreenHeight = droidinfo.screen_height;
|
||||
ud.setup.xdim = droidinfo.screen_width;
|
||||
ud.setup.ydim = droidinfo.screen_height;
|
||||
#else
|
||||
# if defined RENDERTYPESDL && SDL_MAJOR_VERSION > 1
|
||||
uint32_t inited = SDL_WasInit(SDL_INIT_VIDEO);
|
||||
|
@ -167,27 +195,23 @@ void CONFIG_SetDefaults(void)
|
|||
SDL_DisplayMode dm;
|
||||
if (SDL_GetDesktopDisplayMode(0, &dm) == 0)
|
||||
{
|
||||
ud.config.ScreenWidth = dm.w;
|
||||
ud.config.ScreenHeight = dm.h;
|
||||
ud.setup.xdim = dm.w;
|
||||
ud.setup.ydim = dm.h;
|
||||
}
|
||||
else
|
||||
# endif
|
||||
{
|
||||
ud.config.ScreenWidth = 1024;
|
||||
ud.config.ScreenHeight = 768;
|
||||
ud.setup.xdim = 1024;
|
||||
ud.setup.ydim = 768;
|
||||
}
|
||||
#endif
|
||||
|
||||
ud.config.ScreenMode = 1;
|
||||
|
||||
#ifdef USE_OPENGL
|
||||
ud.config.ScreenBPP = 32;
|
||||
ud.setup.bpp = 32;
|
||||
#else
|
||||
ud.config.ScreenBPP = 8;
|
||||
ud.setup.bpp = 8;
|
||||
#endif
|
||||
ud.config.useprecache = 1;
|
||||
ud.config.ForceSetup = 1;
|
||||
ud.config.NoAutoLoad = 1;
|
||||
ud.config.AmbienceToggle = 1;
|
||||
ud.config.AutoAim = 1;
|
||||
ud.config.FXVolume = 255;
|
||||
|
@ -261,11 +285,16 @@ void CONFIG_SetDefaults(void)
|
|||
ud.weaponswitch = 3; // new+empty
|
||||
ud.angleinterpolation = 0;
|
||||
#ifdef GEKKO
|
||||
ud.config.UseJoystick = 1;
|
||||
ud.setup.usejoystick = 1;
|
||||
#else
|
||||
ud.config.UseJoystick = 0;
|
||||
ud.setup.usejoystick = 0;
|
||||
#endif
|
||||
ud.config.UseMouse = 1;
|
||||
|
||||
ud.setup.forcesetup = 1;
|
||||
ud.setup.noautoload = 1;
|
||||
ud.setup.fullscreen = 1;
|
||||
ud.setup.usemouse = 1;
|
||||
|
||||
ud.config.VoiceToggle = 5; // bitfield, 1 = local, 2 = dummy, 4 = other players in DM
|
||||
ud.display_bonus_screen = 1;
|
||||
ud.show_level_text = 1;
|
||||
|
@ -284,6 +313,7 @@ void CONFIG_SetDefaults(void)
|
|||
ud.autosave = 1;
|
||||
ud.autosavedeletion = 1;
|
||||
ud.maxautosaves = 5;
|
||||
ud.fov = 90;
|
||||
|
||||
ud.config.CheckForUpdates = 1;
|
||||
|
||||
|
@ -395,47 +425,48 @@ void CONFIG_SetDefaults(void)
|
|||
|
||||
|
||||
// wrapper for CONTROL_MapKey(), generates key bindings to reflect changes to keyboard setup
|
||||
void CONFIG_MapKey(int32_t which, kb_scancode key1, kb_scancode oldkey1, kb_scancode key2, kb_scancode oldkey2)
|
||||
void CONFIG_MapKey(int which, kb_scancode key1, kb_scancode oldkey1, kb_scancode key2, kb_scancode oldkey2)
|
||||
{
|
||||
int32_t i, j, k;
|
||||
int32_t ii[] = { key1, key2, oldkey1, oldkey2 };
|
||||
int const keys[] = { key1, key2, oldkey1, oldkey2 };
|
||||
char buf[2*MAXGAMEFUNCLEN];
|
||||
|
||||
UNREFERENCED_PARAMETER(which);
|
||||
// CONTROL_MapKey(which, key1, key2);
|
||||
|
||||
if (which == gamefunc_Show_Console)
|
||||
OSD_CaptureKey(key1);
|
||||
|
||||
for (k = 0; (unsigned)k < ARRAY_SIZE(ii); k++)
|
||||
for (int k = 0; (unsigned)k < ARRAY_SIZE(keys); k++)
|
||||
{
|
||||
if (ii[k] == 0xff || !ii[k])
|
||||
if (keys[k] == 0xff || !keys[k])
|
||||
continue;
|
||||
|
||||
for (j=0; ConsoleKeys[j].name; j++)
|
||||
if (ii[k] == ConsoleKeys[j].id)
|
||||
int match = 0;
|
||||
|
||||
for (; sctokeylut[match].key; match++)
|
||||
{
|
||||
if (keys[k] == sctokeylut[match].sc)
|
||||
break;
|
||||
}
|
||||
|
||||
tempbuf[0] = 0;
|
||||
|
||||
for (i=NUMGAMEFUNCTIONS-1; i>=0; i--)
|
||||
for (int i=NUMGAMEFUNCTIONS-1; i>=0; i--)
|
||||
{
|
||||
if (ud.config.KeyboardKeys[i][0] == ii[k] || ud.config.KeyboardKeys[i][1] == ii[k])
|
||||
if (ud.config.KeyboardKeys[i][0] == keys[k] || ud.config.KeyboardKeys[i][1] == keys[k])
|
||||
{
|
||||
Bsprintf(buf,"gamefunc_%s; ",CONFIG_FunctionNumToName(i));
|
||||
Bsprintf(buf, "gamefunc_%s; ", CONFIG_FunctionNumToName(i));
|
||||
Bstrcat(tempbuf,buf);
|
||||
}
|
||||
}
|
||||
|
||||
i = Bstrlen(tempbuf);
|
||||
if (i >= 2)
|
||||
int const len = Bstrlen(tempbuf);
|
||||
|
||||
if (len >= 2)
|
||||
{
|
||||
tempbuf[i-2] = 0; // cut off the trailing "; "
|
||||
CONTROL_BindKey(ii[k], tempbuf, 1, ConsoleKeys[j].name ? ConsoleKeys[j].name : "<?>");
|
||||
tempbuf[len-2] = 0; // cut off the trailing "; "
|
||||
CONTROL_BindKey(keys[k], tempbuf, 1, sctokeylut[match].key ? sctokeylut[match].key : "<?>");
|
||||
}
|
||||
else
|
||||
{
|
||||
CONTROL_FreeKeyBind(ii[k]);
|
||||
CONTROL_FreeKeyBind(keys[k]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -638,8 +669,8 @@ int32_t CONFIG_ReadSetup(void)
|
|||
SCRIPT_GetString(ud.config.scripthandle, "Comm Setup","RTSName",&ud.rtsname[0]);
|
||||
|
||||
SCRIPT_GetNumber(ud.config.scripthandle, "Setup", "ConfigVersion", &ud.configversion);
|
||||
SCRIPT_GetNumber(ud.config.scripthandle, "Setup", "ForceSetup", &ud.config.ForceSetup);
|
||||
SCRIPT_GetNumber(ud.config.scripthandle, "Setup", "NoAutoLoad", &ud.config.NoAutoLoad);
|
||||
SCRIPT_GetNumber(ud.config.scripthandle, "Setup", "ForceSetup", &ud.setup.forcesetup);
|
||||
SCRIPT_GetNumber(ud.config.scripthandle, "Setup", "NoAutoLoad", &ud.setup.noautoload);
|
||||
SCRIPT_GetNumber(ud.config.scripthandle, "Setup", "CacheSize", &dummy);
|
||||
|
||||
if (dummy > MAXCACHE1DSIZE)
|
||||
|
@ -669,10 +700,10 @@ int32_t CONFIG_ReadSetup(void)
|
|||
|
||||
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", "ScreenHeight",&ud.config.ScreenHeight);
|
||||
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "ScreenMode",&ud.config.ScreenMode);
|
||||
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "ScreenWidth",&ud.config.ScreenWidth);
|
||||
|
||||
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "ScreenHeight", &ud.setup.ydim);
|
||||
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "ScreenMode", &ud.setup.fullscreen);
|
||||
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "ScreenWidth", &ud.setup.xdim);
|
||||
|
||||
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "WindowPositioning", (int32_t *)&windowpos);
|
||||
|
||||
|
@ -682,14 +713,14 @@ int32_t CONFIG_ReadSetup(void)
|
|||
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "WindowPosY", (int32_t *)&windowy);
|
||||
|
||||
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "MaxRefreshFreq", (int32_t *)&maxrefreshfreq);
|
||||
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "ScreenBPP", &ud.config.ScreenBPP);
|
||||
|
||||
if (ud.config.ScreenBPP < 8) ud.config.ScreenBPP = 32;
|
||||
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "ScreenBPP", &ud.setup.bpp);
|
||||
|
||||
if (ud.setup.bpp < 8) ud.setup.bpp = 32;
|
||||
|
||||
#ifdef POLYMER
|
||||
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "Polymer", &dummy);
|
||||
if (dummy > 0 && ud.config.ScreenBPP >= 16) glrendmode = REND_POLYMER;
|
||||
else glrendmode = REND_POLYMOST;
|
||||
int32_t rendmode = 0;
|
||||
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "Polymer", &rendmode);
|
||||
glrendmode = (rendmode > 0) ? REND_POLYMER : REND_POLYMOST;
|
||||
#endif
|
||||
|
||||
SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "Executions",&ud.executions);
|
||||
|
@ -763,18 +794,18 @@ void CONFIG_WriteSetup(uint32_t flags)
|
|||
SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "Executions",ud.executions,FALSE,FALSE);
|
||||
|
||||
SCRIPT_PutNumber(ud.config.scripthandle, "Setup","ConfigVersion",BYTEVERSION_EDUKE32,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);
|
||||
SCRIPT_PutNumber(ud.config.scripthandle, "Setup", "ForceSetup", ud.setup.forcesetup, FALSE, FALSE);
|
||||
SCRIPT_PutNumber(ud.config.scripthandle, "Setup", "NoAutoLoad", ud.setup.noautoload, FALSE, FALSE);
|
||||
SCRIPT_PutNumber(ud.config.scripthandle, "Setup", "CacheSize", MAXCACHE1DSIZE, FALSE, FALSE);
|
||||
|
||||
#ifdef POLYMER
|
||||
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "Polymer",glrendmode == REND_POLYMER,FALSE,FALSE);
|
||||
#endif
|
||||
|
||||
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "ScreenBPP",ud.config.ScreenBPP,FALSE,FALSE); // JBF 20040523
|
||||
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", "ScreenWidth",ud.config.ScreenWidth,FALSE,FALSE); // JBF 20031206
|
||||
|
||||
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "ScreenBPP", ud.setup.bpp, FALSE, FALSE);
|
||||
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "ScreenHeight", ud.setup.ydim, FALSE, FALSE);
|
||||
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "ScreenMode", ud.setup.fullscreen, FALSE, FALSE);
|
||||
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "ScreenWidth", ud.setup.xdim, FALSE, FALSE);
|
||||
|
||||
if (g_grpNamePtr && !g_addonNum)
|
||||
SCRIPT_PutString(ud.config.scripthandle, "Setup","SelectedGRP",g_grpNamePtr);
|
||||
|
@ -804,7 +835,7 @@ void CONFIG_WriteSetup(uint32_t flags)
|
|||
SCRIPT_PutNumber(ud.config.scripthandle, "Updates", "LastUpdateCheck", ud.config.LastUpdateCheck, FALSE, FALSE);
|
||||
#endif
|
||||
|
||||
if (ud.config.UseMouse)
|
||||
if (ud.setup.usemouse)
|
||||
{
|
||||
for (dummy=0; dummy<MAXMOUSEBUTTONS; dummy++)
|
||||
{
|
||||
|
@ -851,7 +882,7 @@ void CONFIG_WriteSetup(uint32_t flags)
|
|||
}
|
||||
}
|
||||
|
||||
if (ud.config.UseJoystick)
|
||||
if (ud.setup.usejoystick)
|
||||
{
|
||||
for (dummy=0; dummy<MAXJOYBUTTONSANDHATS; dummy++)
|
||||
{
|
||||
|
|
|
@ -23,6 +23,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
#ifndef config_public_h_
|
||||
#define config_public_h_
|
||||
|
||||
#include "function.h"
|
||||
|
||||
#define SETUPNAMEPARM "SETUPFILE"
|
||||
|
||||
int32_t CONFIG_ReadSetup( void );
|
||||
|
@ -30,7 +32,7 @@ void CONFIG_GetSetupFilename( void );
|
|||
void CONFIG_WriteSetup(uint32_t flags);
|
||||
void CONFIG_SetupMouse( void );
|
||||
void CONFIG_SetupJoystick( void );
|
||||
void CONFIG_SetDefaultKeys(const char (*keyptr)[MAXGAMEFUNCLEN]);
|
||||
void CONFIG_SetDefaultKeys(const char (*keyptr)[MAXGAMEFUNCLEN], bool lazy=false);
|
||||
|
||||
int32_t CONFIG_GetMapBestTime(char const * mapname, uint8_t const * mapmd4);
|
||||
int32_t CONFIG_SetMapBestTime(uint8_t const * mapmd4, int32_t tm);
|
||||
|
|
|
@ -23,6 +23,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
#ifndef demo_h_
|
||||
#define demo_h_
|
||||
|
||||
#include "compat.h"
|
||||
|
||||
#define DEMOFN_FMT "edemo%03d.edm"
|
||||
#define LDEMOFN_FMT "demo%d.dmo"
|
||||
#define MAXDEMOS 1000
|
||||
|
|
|
@ -24,9 +24,15 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
#define duke3d_h_
|
||||
|
||||
// JBF
|
||||
#include "compat.h"
|
||||
#include "a.h"
|
||||
#include "baselayer.h"
|
||||
#include "build.h"
|
||||
#include "cache1d.h"
|
||||
#include "compat.h"
|
||||
|
||||
#include "fx_man.h"
|
||||
#include "keyboard.h"
|
||||
#include "pragmas.h"
|
||||
|
||||
#ifdef POLYMER
|
||||
#include "polymer.h"
|
||||
|
@ -36,12 +42,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#include "cache1d.h"
|
||||
#include "pragmas.h"
|
||||
#include "baselayer.h"
|
||||
#include "keyboard.h"
|
||||
#include "fx_man.h"
|
||||
|
||||
#define HEAD2 APPNAME
|
||||
|
||||
#define VOLUMEALL (g_Shareware == 0)
|
||||
|
@ -113,30 +113,30 @@ EDUKE32_STATIC_ASSERT(7 <= MAXTILES-MAXUSERTILES);
|
|||
// so that debugging with valgrind --smc-check=none is possible:
|
||||
//#define DEBUG_VALGRIND_NO_SMC
|
||||
|
||||
#include "common_game.h"
|
||||
#include "namesdyn.h"
|
||||
#include "function.h"
|
||||
#include "macros.h"
|
||||
#include "gamedefs.h"
|
||||
#include "config.h"
|
||||
#include "sounds.h"
|
||||
#include "control.h"
|
||||
#include "_rts.h"
|
||||
#include "rts.h"
|
||||
#include "soundsdyn.h"
|
||||
#include "music.h"
|
||||
#include "inv.h"
|
||||
#include "player.h"
|
||||
#include "actors.h"
|
||||
#include "quotes.h"
|
||||
#include "global.h"
|
||||
#include "sector.h"
|
||||
#include "net.h"
|
||||
#include "common_game.h"
|
||||
#include "config.h"
|
||||
#include "control.h"
|
||||
#include "function.h"
|
||||
#include "game.h"
|
||||
#include "gamedef.h"
|
||||
#include "gamedefs.h"
|
||||
#include "gameexec.h"
|
||||
#include "gamevars.h"
|
||||
#include "global.h"
|
||||
#include "inv.h"
|
||||
#include "macros.h"
|
||||
#include "music.h"
|
||||
#include "namesdyn.h"
|
||||
#include "net.h"
|
||||
#include "player.h"
|
||||
#include "quotes.h"
|
||||
#include "rts.h"
|
||||
#include "screentext.h"
|
||||
#include "sector.h"
|
||||
#include "sounds.h"
|
||||
#include "soundsdyn.h"
|
||||
|
||||
static inline int32_t G_HaveActor(int spriteNum)
|
||||
{
|
||||
|
|
|
@ -108,7 +108,8 @@ int32_t hud_showmapname = 1;
|
|||
int32_t g_levelTextTime = 0;
|
||||
|
||||
int32_t r_maxfps = 60;
|
||||
uint64_t g_frameDelay = 17;
|
||||
int32_t r_maxfpsoffset = 0;
|
||||
double g_frameDelay = 0.0;
|
||||
|
||||
#if defined(RENDERTYPEWIN) && defined(USE_OPENGL)
|
||||
extern char forcegl;
|
||||
|
@ -171,13 +172,13 @@ void G_HandleSpecialKeys(void)
|
|||
|
||||
if (g_networkMode != NET_DEDICATED_SERVER && ALT_IS_PRESSED && KB_KeyPressed(sc_Enter))
|
||||
{
|
||||
if (videoSetGameMode(!ud.config.ScreenMode,ud.config.ScreenWidth,ud.config.ScreenHeight,ud.config.ScreenBPP,ud.detail))
|
||||
if (videoSetGameMode(!ud.setup.fullscreen,ud.setup.xdim,ud.setup.ydim,ud.setup.bpp,ud.detail))
|
||||
{
|
||||
OSD_Printf(OSD_ERROR "Failed setting fullscreen video mode.\n");
|
||||
if (videoSetGameMode(ud.config.ScreenMode, ud.config.ScreenWidth, ud.config.ScreenHeight, ud.config.ScreenBPP, ud.detail))
|
||||
if (videoSetGameMode(ud.setup.fullscreen, ud.setup.xdim, ud.setup.ydim, ud.setup.bpp, ud.detail))
|
||||
G_GameExit("Failed to recover from failure to set fullscreen video mode.\n");
|
||||
}
|
||||
else ud.config.ScreenMode = !ud.config.ScreenMode;
|
||||
else ud.setup.fullscreen = !ud.setup.fullscreen;
|
||||
KB_ClearKeyDown(sc_Enter);
|
||||
g_restorePalette = 1;
|
||||
G_UpdateScreenArea();
|
||||
|
@ -374,7 +375,7 @@ void G_GameExit(const char *msg)
|
|||
if (g_mostConcurrentPlayers > 1 && g_player[myconnectindex].ps->gm&MODE_GAME && GTFLAGS(GAMETYPE_SCORESHEET) && *msg == ' ')
|
||||
{
|
||||
G_BonusScreen(1);
|
||||
videoSetGameMode(ud.config.ScreenMode,ud.config.ScreenWidth,ud.config.ScreenHeight,ud.config.ScreenBPP,ud.detail);
|
||||
videoSetGameMode(ud.setup.fullscreen,ud.setup.xdim,ud.setup.ydim,ud.setup.bpp,ud.detail);
|
||||
}
|
||||
|
||||
// shareware and TEN screens
|
||||
|
@ -1013,13 +1014,14 @@ void G_DrawRooms(int32_t playerNum, int32_t smoothRatio)
|
|||
#endif
|
||||
)));
|
||||
|
||||
viewingRange = Blrintf(float(vr) * tanf(ud.fov * (PI/360.f)));
|
||||
|
||||
if (!RRRA || !pPlayer->drug_mode)
|
||||
{
|
||||
if (!r_usenewaspect)
|
||||
renderSetAspect(vr, yxaspect);
|
||||
renderSetAspect(viewingRange, yxaspect);
|
||||
else
|
||||
{
|
||||
viewingRange = vr;
|
||||
yxAspect = tabledivide32_noinline(65536 * ydim * 8, xdim * 5);
|
||||
|
||||
renderSetAspect(mulscale16(viewingRange,viewingrange), yxaspect);
|
||||
|
@ -1141,10 +1143,10 @@ void G_DrawRooms(int32_t playerNum, int32_t smoothRatio)
|
|||
if (pPlayer->drug_stat[0] == 0)
|
||||
{
|
||||
pPlayer->drug_stat[1]++;
|
||||
aspect = vr + pPlayer->drug_stat[1] * 5000;
|
||||
if (vr * 3 < aspect)
|
||||
aspect = viewingRange + pPlayer->drug_stat[1] * 5000;
|
||||
if (viewingRange * 3 < aspect)
|
||||
{
|
||||
pPlayer->drug_aspect = vr * 3;
|
||||
pPlayer->drug_aspect = viewingRange * 3;
|
||||
pPlayer->drug_stat[0] = 2;
|
||||
}
|
||||
else
|
||||
|
@ -1156,14 +1158,14 @@ void G_DrawRooms(int32_t playerNum, int32_t smoothRatio)
|
|||
else if (pPlayer->drug_stat[0] == 3)
|
||||
{
|
||||
pPlayer->drug_stat[1]--;
|
||||
aspect = vr + pPlayer->drug_stat[1] * 5000;
|
||||
if (aspect < vr)
|
||||
aspect = viewingRange + pPlayer->drug_stat[1] * 5000;
|
||||
if (aspect < viewingRange)
|
||||
{
|
||||
pPlayer->drug_mode = 0;
|
||||
pPlayer->drug_stat[0] = 0;
|
||||
pPlayer->drug_stat[2] = 0;
|
||||
pPlayer->drug_stat[1] = 0;
|
||||
pPlayer->drug_aspect = vr;
|
||||
pPlayer->drug_aspect = viewingRange;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1180,7 +1182,7 @@ void G_DrawRooms(int32_t playerNum, int32_t smoothRatio)
|
|||
else
|
||||
{
|
||||
pPlayer->drug_stat[2]++;
|
||||
aspect = pPlayer->drug_stat[2] * 500 + vr * 3;
|
||||
aspect = pPlayer->drug_stat[2] * 500 + viewingRange * 3;
|
||||
pPlayer->drug_aspect = aspect;
|
||||
P_UpdateScreenPal(pPlayer);
|
||||
}
|
||||
|
@ -1197,7 +1199,7 @@ void G_DrawRooms(int32_t playerNum, int32_t smoothRatio)
|
|||
else
|
||||
{
|
||||
pPlayer->drug_stat[2]--;
|
||||
aspect = pPlayer->drug_stat[2] * 500 + vr * 3;
|
||||
aspect = pPlayer->drug_stat[2] * 500 + viewingRange * 3;
|
||||
pPlayer->drug_aspect = aspect;
|
||||
P_UpdateScreenPal(pPlayer);
|
||||
}
|
||||
|
@ -6813,7 +6815,7 @@ static int parsedefinitions_game(scriptfile *pScript, int firstPass)
|
|||
else
|
||||
{
|
||||
initprintf("Using file \"%s\" as game data.\n", fileName);
|
||||
if (!g_noAutoLoad && !ud.config.NoAutoLoad)
|
||||
if (!g_noAutoLoad && !ud.setup.noautoload)
|
||||
G_DoAutoload(fileName);
|
||||
}
|
||||
}
|
||||
|
@ -7526,10 +7528,10 @@ static void G_Startup(void)
|
|||
if (g_modDir[0] != '/' && (cwd = getcwd(NULL, 0)))
|
||||
{
|
||||
Bchdir(g_modDir);
|
||||
if (artLoadFiles("tiles%03d.art",MAXCACHE1DSIZE) < 0)
|
||||
if (artLoadFiles("tiles%03i.art",MAXCACHE1DSIZE) < 0)
|
||||
{
|
||||
Bchdir(cwd);
|
||||
if (artLoadFiles("tiles%03d.art",MAXCACHE1DSIZE) < 0)
|
||||
if (artLoadFiles("tiles%03i.art",MAXCACHE1DSIZE) < 0)
|
||||
G_GameExit("Failed loading art.");
|
||||
}
|
||||
Bchdir(cwd);
|
||||
|
@ -7538,7 +7540,7 @@ static void G_Startup(void)
|
|||
#endif
|
||||
|
||||
}
|
||||
else if (artLoadFiles("tiles%03d.art",MAXCACHE1DSIZE) < 0)
|
||||
else if (artLoadFiles("tiles%03i.art",MAXCACHE1DSIZE) < 0)
|
||||
G_GameExit("Failed loading art.");
|
||||
}
|
||||
|
||||
|
@ -7872,7 +7874,7 @@ int app_main(int argc, char const * const * argv)
|
|||
G_ScanGroups();
|
||||
|
||||
#ifdef STARTUP_SETUP_WINDOW
|
||||
if (readSetup < 0 || (!g_noSetup && (ud.configversion != BYTEVERSION_EDUKE32 || ud.config.ForceSetup)) || g_commandSetup)
|
||||
if (readSetup < 0 || (!g_noSetup && (ud.configversion != BYTEVERSION_EDUKE32 || ud.setup.forcesetup)) || g_commandSetup)
|
||||
{
|
||||
if (quitevent || !startwin_run())
|
||||
{
|
||||
|
@ -7883,7 +7885,7 @@ int app_main(int argc, char const * const * argv)
|
|||
#endif
|
||||
|
||||
g_logFlushWindow = 0;
|
||||
G_LoadGroups(!g_noAutoLoad && !ud.config.NoAutoLoad);
|
||||
G_LoadGroups(!g_noAutoLoad && !ud.setup.noautoload);
|
||||
// flushlogwindow = 1;
|
||||
|
||||
if (!g_useCwd)
|
||||
|
@ -8045,8 +8047,8 @@ int app_main(int argc, char const * const * argv)
|
|||
CONFIG_SetupMouse();
|
||||
CONFIG_SetupJoystick();
|
||||
|
||||
CONTROL_JoystickEnabled = (ud.config.UseJoystick && CONTROL_JoyPresent);
|
||||
CONTROL_MouseEnabled = (ud.config.UseMouse && CONTROL_MousePresent);
|
||||
CONTROL_JoystickEnabled = (ud.setup.usejoystick && CONTROL_JoyPresent);
|
||||
CONTROL_MouseEnabled = (ud.setup.usemouse && CONTROL_MousePresent);
|
||||
|
||||
// JBF 20040215: evil and nasty place to do this, but joysticks are evil and nasty too
|
||||
for (bssize_t i=0; i<joystick.numAxes; i++)
|
||||
|
@ -8076,48 +8078,53 @@ int app_main(int argc, char const * const * argv)
|
|||
OSD_Exec(tempbuf);
|
||||
OSD_Exec("autoexec.cfg");
|
||||
|
||||
CONFIG_SetDefaultKeys(keydefaults, true);
|
||||
|
||||
system_getcvars();
|
||||
|
||||
if (g_networkMode != NET_DEDICATED_SERVER)
|
||||
{
|
||||
if (videoSetGameMode(ud.config.ScreenMode,ud.config.ScreenWidth,ud.config.ScreenHeight,ud.config.ScreenBPP,ud.detail) < 0)
|
||||
if (videoSetGameMode(ud.setup.fullscreen, ud.setup.xdim, ud.setup.ydim, ud.setup.bpp, ud.detail) < 0)
|
||||
{
|
||||
vec2_t const res[] = {
|
||||
{ ud.config.ScreenWidth, ud.config.ScreenHeight }, { 800, 600 }, { 640, 480 }, { 320, 240 },
|
||||
};
|
||||
|
||||
#ifdef USE_OPENGL
|
||||
int const bpp[] = { 32, 16, 8 };
|
||||
#else
|
||||
int const bpp[] = { 8 };
|
||||
#endif
|
||||
|
||||
initprintf("Failure setting video mode %dx%dx%d %s! Attempting safer mode...\n", ud.config.ScreenWidth, ud.config.ScreenHeight,
|
||||
ud.config.ScreenBPP, ud.config.ScreenMode ? "fullscreen" : "windowed");
|
||||
initprintf("Failure setting video mode %dx%dx%d %s! Trying next mode...\n", ud.setup.xdim, ud.setup.ydim,
|
||||
ud.setup.bpp, ud.setup.fullscreen ? "fullscreen" : "windowed");
|
||||
|
||||
int resIdx = 0;
|
||||
int bppIdx = 0;
|
||||
|
||||
while (videoSetGameMode(0, res[resIdx].x, res[resIdx].y, bpp[bppIdx], ud.detail) < 0)
|
||||
for (int i=0; i < validmodecnt; i++)
|
||||
{
|
||||
initprintf("Failure setting video mode %dx%dx%d windowed! Attempting safer mode...\n", res[resIdx].x, res[resIdx].y,
|
||||
bpp[bppIdx]);
|
||||
|
||||
if (++bppIdx == ARRAY_SIZE(bpp))
|
||||
if (validmode[i].xdim == ud.setup.xdim && validmode[i].ydim == ud.setup.ydim)
|
||||
{
|
||||
if (++resIdx == ARRAY_SIZE(res))
|
||||
G_GameExit("Unable to set failsafe video mode!");
|
||||
bppIdx = 0;
|
||||
resIdx = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
ud.config.ScreenWidth = res[resIdx].x;
|
||||
ud.config.ScreenHeight = res[resIdx].y;
|
||||
ud.config.ScreenBPP = bpp[bppIdx];
|
||||
int const savedIdx = resIdx;
|
||||
int bpp = ud.setup.bpp;
|
||||
|
||||
while (videoSetGameMode(0, validmode[resIdx].xdim, validmode[resIdx].ydim, bpp, ud.detail) < 0)
|
||||
{
|
||||
initprintf("Failure setting video mode %dx%dx%d windowed! Trying next mode...\n",
|
||||
validmode[resIdx].xdim, validmode[resIdx].ydim, bpp);
|
||||
|
||||
if (++resIdx == validmodecnt)
|
||||
{
|
||||
if (bpp == 8)
|
||||
G_GameExit("Fatal error: unable to set any video mode!");
|
||||
|
||||
resIdx = savedIdx;
|
||||
bpp = 8;
|
||||
}
|
||||
}
|
||||
|
||||
ud.setup.xdim = validmode[resIdx].xdim;
|
||||
ud.setup.ydim = validmode[resIdx].ydim;
|
||||
ud.setup.bpp = bpp;
|
||||
}
|
||||
|
||||
videoSetPalette(ud.brightness>>2,g_player[myconnectindex].ps->palette,0);
|
||||
|
||||
g_frameDelay = calcFrameDelay(r_maxfps + r_maxfpsoffset);
|
||||
videoSetPalette(ud.brightness>>2, g_player[myconnectindex].ps->palette, 0);
|
||||
S_MusicStartup();
|
||||
S_SoundStartup();
|
||||
}
|
||||
|
@ -8284,7 +8291,7 @@ MAIN_LOOP_RESTART:
|
|||
OSD_DispatchQueued();
|
||||
|
||||
char gameUpdate = false;
|
||||
uint32_t gameUpdateStartTime = timerGetTicks();
|
||||
double const gameUpdateStartTime = timerGetHiTicks();
|
||||
if (((g_netClient || g_netServer) || !(g_player[myconnectindex].ps->gm & (MODE_MENU|MODE_DEMO))) && totalclock >= ototalclock+TICSPERFRAME)
|
||||
{
|
||||
if (g_networkMode != NET_DEDICATED_SERVER)
|
||||
|
@ -8336,7 +8343,7 @@ MAIN_LOOP_RESTART:
|
|||
while (((g_netClient || g_netServer) || !(g_player[myconnectindex].ps->gm & (MODE_MENU|MODE_DEMO))) && totalclock >= ototalclock+TICSPERFRAME);
|
||||
|
||||
gameUpdate = true;
|
||||
g_gameUpdateTime = timerGetTicks()-gameUpdateStartTime;
|
||||
g_gameUpdateTime = timerGetHiTicks()-gameUpdateStartTime;
|
||||
if (g_gameUpdateAvgTime < 0.f)
|
||||
g_gameUpdateAvgTime = g_gameUpdateTime;
|
||||
g_gameUpdateAvgTime = ((GAMEUPDATEAVGTIMENUMSAMPLES-1.f)*g_gameUpdateAvgTime+g_gameUpdateTime)/((float) GAMEUPDATEAVGTIMENUMSAMPLES);
|
||||
|
@ -8374,7 +8381,7 @@ MAIN_LOOP_RESTART:
|
|||
|
||||
if (gameUpdate)
|
||||
{
|
||||
g_gameUpdateAndDrawTime = timerGetTicks()-gameUpdateStartTime;
|
||||
g_gameUpdateAndDrawTime = timerGetHiTicks()-gameUpdateStartTime;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -30,6 +30,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
#endif
|
||||
|
||||
#include "fix16.h"
|
||||
#include "gamedefs.h"
|
||||
#include "gamedef.h"
|
||||
#include "net.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -136,6 +139,18 @@ void A_DeleteSprite(int spriteNum);
|
|||
#define MAX_RETURN_VALUES 6
|
||||
|
||||
// KEEPINSYNC lunatic/_defs_game.lua
|
||||
|
||||
typedef struct {
|
||||
int32_t usejoystick;
|
||||
int32_t usemouse;
|
||||
int32_t fullscreen;
|
||||
int32_t xdim;
|
||||
int32_t ydim;
|
||||
int32_t bpp;
|
||||
int32_t forcesetup;
|
||||
int32_t noautoload;
|
||||
} ud_setup_t;
|
||||
|
||||
typedef struct {
|
||||
vec3_t camerapos;
|
||||
int32_t const_visibility,uw_framerate;
|
||||
|
@ -163,7 +178,7 @@ typedef struct {
|
|||
|
||||
int32_t playerbest;
|
||||
|
||||
int32_t configversion, bgstretch;
|
||||
int32_t configversion, bgstretch, frameperiod;
|
||||
|
||||
int32_t default_volume, default_skill;
|
||||
|
||||
|
@ -174,6 +189,8 @@ typedef struct {
|
|||
|
||||
uint32_t userbytever;
|
||||
|
||||
int32_t fov;
|
||||
|
||||
fix16_t cameraq16ang, cameraq16horiz;
|
||||
int16_t camerasect;
|
||||
int16_t pause_on,from_bonus;
|
||||
|
@ -183,8 +200,6 @@ typedef struct {
|
|||
int8_t menutitle_pal, slidebar_palselected, slidebar_paldisabled;
|
||||
|
||||
struct {
|
||||
int32_t UseJoystick;
|
||||
int32_t UseMouse;
|
||||
int32_t AutoAim;
|
||||
int32_t ShowOpponentWeapons;
|
||||
int32_t MouseDeadZone,MouseBias;
|
||||
|
@ -221,18 +236,6 @@ typedef struct {
|
|||
|
||||
int32_t ReverseStereo;
|
||||
|
||||
//
|
||||
// Screen variables
|
||||
//
|
||||
|
||||
int32_t ScreenMode;
|
||||
|
||||
int32_t ScreenWidth;
|
||||
int32_t ScreenHeight;
|
||||
int32_t ScreenBPP;
|
||||
|
||||
int32_t ForceSetup;
|
||||
int32_t NoAutoLoad;
|
||||
|
||||
int32_t scripthandle;
|
||||
int32_t setupread;
|
||||
|
@ -242,6 +245,8 @@ typedef struct {
|
|||
int32_t useprecache;
|
||||
} config;
|
||||
|
||||
ud_setup_t setup;
|
||||
|
||||
char overhead_on,last_overhead,showweapons;
|
||||
char god,warp_on,cashman,eog,showallmap;
|
||||
char show_help,scrollmode,noclip;
|
||||
|
@ -290,7 +295,6 @@ extern int32_t g_cameraClock;
|
|||
extern int32_t g_cameraDistance;
|
||||
extern int32_t g_crosshairSum;
|
||||
extern int32_t g_doQuickSave;
|
||||
extern int32_t g_forceWeaponChoice;
|
||||
extern int32_t g_fakeMultiMode;
|
||||
extern int32_t g_levelTextTime;
|
||||
extern int32_t g_quitDeadline;
|
||||
|
@ -298,6 +302,7 @@ extern int32_t g_restorePalette;
|
|||
extern int32_t hud_glowingquotes;
|
||||
extern int32_t hud_showmapname;
|
||||
extern int32_t r_maxfps;
|
||||
extern int32_t r_maxfpsoffset;
|
||||
extern int32_t tempwallptr;
|
||||
extern int32_t ticrandomseed;
|
||||
extern int32_t vote_map;
|
||||
|
@ -311,7 +316,8 @@ extern int32_t MAXCACHE1DSIZE;
|
|||
extern palette_t CrosshairColors;
|
||||
extern palette_t DefaultCrosshairColors;
|
||||
|
||||
extern uint64_t g_frameDelay;
|
||||
extern double g_frameDelay;
|
||||
static inline double calcFrameDelay(int maxFPS) { return maxFPS ? ((double)timerGetFreqU64() / (double)(maxFPS)) : 0.0; }
|
||||
|
||||
int32_t A_CheckInventorySprite(spritetype *s);
|
||||
int32_t A_InsertSprite(int16_t whatsect, int32_t s_x, int32_t s_y, int32_t s_z, int16_t s_pn, int8_t s_s, uint8_t s_xr,
|
||||
|
|
|
@ -23,7 +23,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
#ifndef gamedef_h_
|
||||
#define gamedef_h_
|
||||
|
||||
#include "actors.h"
|
||||
#include "build.h" // hashtable_t
|
||||
#include "cheats.h"
|
||||
#include "common.h" // tokenlist
|
||||
#include "player.h" // projectile_t
|
||||
|
||||
|
@ -46,9 +48,6 @@ enum
|
|||
#define LABEL_HASPARM2 1
|
||||
#define LABEL_ISSTRING 2
|
||||
|
||||
#define MAXCHEATLEN 20
|
||||
#define NUMCHEATCODES (int32_t)ARRAY_SIZE(CheatStrings)
|
||||
|
||||
#define VM_INSTMASK 0xfff
|
||||
|
||||
#define C_CUSTOMERROR(Text, ...) \
|
||||
|
|
|
@ -23,6 +23,14 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
#ifndef global_h_
|
||||
#define global_h_
|
||||
|
||||
#include "build.h"
|
||||
#include "compat.h"
|
||||
#include "duke3d.h"
|
||||
#include "mmulti.h"
|
||||
#include "quotes.h"
|
||||
#include "sector.h"
|
||||
#include "sounds.h"
|
||||
|
||||
#define MAXMINECARTS 16
|
||||
#define MAXJAILDOORS 32
|
||||
#define MAXLIGHTNINSECTORS 64
|
||||
|
@ -41,9 +49,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
|
||||
// duke3d global soup :(
|
||||
|
||||
// XXX: we don't #include everything we need.
|
||||
#include "compat.h"
|
||||
#include "build.h"
|
||||
|
||||
G_EXTERN int32_t g_interpolationCnt;
|
||||
G_EXTERN int32_t g_interpolationLock;
|
||||
|
@ -51,11 +56,6 @@ G_EXTERN int32_t oldipos[MAXINTERPOLATIONS];
|
|||
G_EXTERN int32_t *curipos[MAXINTERPOLATIONS];
|
||||
G_EXTERN int32_t bakipos[MAXINTERPOLATIONS];
|
||||
|
||||
#include "mmulti.h"
|
||||
|
||||
#include "duke3d.h"
|
||||
#include "sector.h"
|
||||
#include "quotes.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -230,8 +230,8 @@ G_EXTERN int32_t g_screenCapture;
|
|||
G_EXTERN sound_t g_sounds[MAXSOUNDS];
|
||||
G_EXTERN uint32_t everyothertime;
|
||||
G_EXTERN uint32_t g_moveThingsCount;
|
||||
G_EXTERN uint32_t g_gameUpdateTime;
|
||||
G_EXTERN uint32_t g_gameUpdateAndDrawTime;
|
||||
G_EXTERN double g_gameUpdateTime;
|
||||
G_EXTERN double g_gameUpdateAndDrawTime;
|
||||
#define GAMEUPDATEAVGTIMENUMSAMPLES 100
|
||||
extern float g_gameUpdateAvgTime;
|
||||
|
||||
|
|
|
@ -23,6 +23,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
#ifndef EDUKE32_MACROS_H_
|
||||
#define EDUKE32_MACROS_H_
|
||||
|
||||
#include "mmulti.h"
|
||||
|
||||
// Macros, some from SW source
|
||||
|
||||
static FORCE_INLINE int32_t krand2(void)
|
||||
|
|
|
@ -380,7 +380,7 @@ static MenuEntry_t ME_GAMESETUP_SAVESETUP = MAKE_MENUENTRY( "Save setup", &MF_Re
|
|||
#endif
|
||||
|
||||
#if defined STARTUP_SETUP_WINDOW && !defined EDUKE32_SIMPLE_MENU
|
||||
static MenuOption_t MEO_GAMESETUP_STARTWIN = MAKE_MENUOPTION( &MF_Redfont, &MEOS_OffOn, &ud.config.ForceSetup );
|
||||
static MenuOption_t MEO_GAMESETUP_STARTWIN = MAKE_MENUOPTION( &MF_Redfont, &MEOS_OffOn, &ud.setup.forcesetup );
|
||||
static MenuEntry_t ME_GAMESETUP_STARTWIN = MAKE_MENUENTRY( "Startup window:", &MF_Redfont, &MEF_BigOptionsRt, &MEO_GAMESETUP_STARTWIN, Option );
|
||||
#endif
|
||||
|
||||
|
@ -519,12 +519,14 @@ static MenuOptionSet_t MEOS_VIDEOSETUP_VSYNC = MAKE_MENUOPTIONSET(MEOSN_VIDEOSET
|
|||
static MenuOption_t MEO_VIDEOSETUP_VSYNC = MAKE_MENUOPTION(&MF_Redfont, &MEOS_VIDEOSETUP_VSYNC, &newvsync);
|
||||
static MenuEntry_t ME_VIDEOSETUP_VSYNC = MAKE_MENUENTRY("VSync:", &MF_Redfont, &MEF_BigOptionsRt, &MEO_VIDEOSETUP_VSYNC, Option);
|
||||
|
||||
static char const *MEOSN_VIDEOSETUP_FRAMELIMIT [] = { "None", "30 fps", "60 fps", "120 fps", };
|
||||
static int32_t MEOSV_VIDEOSETUP_FRAMELIMIT [] = { 0, 30, 60, 120 };
|
||||
static MenuOptionSet_t MEOS_VIDEOSETUP_FRAMELIMIT = MAKE_MENUOPTIONSET(MEOSN_VIDEOSETUP_FRAMELIMIT, MEOSV_VIDEOSETUP_FRAMELIMIT, 0x2);
|
||||
static char const *MEOSN_VIDEOSETUP_FRAMELIMIT [] = { "30 fps", "60 fps", "75 fps", "100 fps", "120 fps", "144 fps", "165 fps", "240 fps" };
|
||||
static int32_t MEOSV_VIDEOSETUP_FRAMELIMIT [] = { 30, 60, 75, 100, 120, 144, 165, 240 };
|
||||
static MenuOptionSet_t MEOS_VIDEOSETUP_FRAMELIMIT = MAKE_MENUOPTIONSET(MEOSN_VIDEOSETUP_FRAMELIMIT, MEOSV_VIDEOSETUP_FRAMELIMIT, 0x0);
|
||||
static MenuOption_t MEO_VIDEOSETUP_FRAMELIMIT= MAKE_MENUOPTION(&MF_Redfont, &MEOS_VIDEOSETUP_FRAMELIMIT, &r_maxfps);
|
||||
static MenuEntry_t ME_VIDEOSETUP_FRAMELIMIT = MAKE_MENUENTRY("Framerate limit:", &MF_Redfont, &MEF_BigOptionsRt, &MEO_VIDEOSETUP_FRAMELIMIT, Option);
|
||||
|
||||
static MenuRangeInt32_t MEO_VIDEOSETUP_FRAMELIMITOFFSET = MAKE_MENURANGE( &r_maxfpsoffset, &MF_Redfont, -10, 10, 0, 21, 1 );
|
||||
static MenuEntry_t ME_VIDEOSETUP_FRAMELIMITOFFSET = MAKE_MENUENTRY( "FPS offset:", &MF_Redfont, &MEF_BigOptionsRt, &MEO_VIDEOSETUP_FRAMELIMITOFFSET, RangeInt32 );
|
||||
|
||||
static MenuEntry_t ME_VIDEOSETUP_APPLY = MAKE_MENUENTRY( "Apply Changes", &MF_Redfont, &MEF_BigOptions_Apply, &MEO_NULL, Link );
|
||||
|
||||
|
@ -546,6 +548,10 @@ static MenuEntry_t ME_DISPLAYSETUP_ASPECTRATIO = MAKE_MENUENTRY( "Widescreen:",
|
|||
#endif
|
||||
|
||||
|
||||
static MenuRangeInt32_t MEO_DISPLAYSETUP_FOV = MAKE_MENURANGE( &ud.fov, &MF_Redfont, 75, 120, 0, 10, 0 );
|
||||
static MenuEntry_t ME_DISPLAYSETUP_FOV = MAKE_MENUENTRY( "FOV:", &MF_Redfont, &MEF_BigOptionsRt, &MEO_DISPLAYSETUP_FOV, RangeInt32 );
|
||||
|
||||
|
||||
#ifdef USE_OPENGL
|
||||
|
||||
//POGOTODO: allow filtering again in standalone once indexed colour textures support filtering
|
||||
|
@ -709,6 +715,7 @@ static MenuEntry_t *MEL_DISPLAYSETUP[] = {
|
|||
#ifndef EDUKE32_ANDROID_MENU
|
||||
&ME_DISPLAYSETUP_VIDEOSETUP,
|
||||
&ME_DISPLAYSETUP_ASPECTRATIO,
|
||||
&ME_DISPLAYSETUP_FOV,
|
||||
#endif
|
||||
&ME_DISPLAYSETUP_UPSCALING,
|
||||
};
|
||||
|
@ -720,6 +727,7 @@ static MenuEntry_t *MEL_DISPLAYSETUP_GL[] = {
|
|||
#ifndef EDUKE32_ANDROID_MENU
|
||||
&ME_DISPLAYSETUP_VIDEOSETUP,
|
||||
&ME_DISPLAYSETUP_ASPECTRATIO,
|
||||
&ME_DISPLAYSETUP_FOV,
|
||||
#endif
|
||||
&ME_DISPLAYSETUP_TEXFILTER,
|
||||
#ifdef EDUKE32_ANDROID_MENU
|
||||
|
@ -741,6 +749,7 @@ static MenuEntry_t *MEL_DISPLAYSETUP_GL_POLYMER[] = {
|
|||
&ME_DISPLAYSETUP_COLORCORR,
|
||||
#ifndef EDUKE32_ANDROID_MENU
|
||||
&ME_DISPLAYSETUP_VIDEOSETUP,
|
||||
&ME_DISPLAYSETUP_FOV,
|
||||
#endif
|
||||
&ME_DISPLAYSETUP_TEXFILTER,
|
||||
&ME_DISPLAYSETUP_ANISOTROPY,
|
||||
|
@ -2030,6 +2039,8 @@ static void Menu_Pre(MenuID_t cm)
|
|||
&& vsync == newvsync
|
||||
)
|
||||
|| (newrendermode != REND_CLASSIC && resolution[nr].bppmax <= 8));
|
||||
|
||||
MenuEntry_DisableOnCondition(&ME_VIDEOSETUP_FRAMELIMITOFFSET, !r_maxfps);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -2079,7 +2090,7 @@ static void Menu_Pre(MenuID_t cm)
|
|||
|
||||
case MENU_OPTIONS:
|
||||
MenuEntry_DisableOnCondition(&ME_OPTIONS_PLAYERSETUP, ud.recstat == 1);
|
||||
MenuEntry_HideOnCondition(&ME_OPTIONS_JOYSTICKSETUP, !ud.config.UseJoystick || CONTROL_JoyPresent == 0);
|
||||
MenuEntry_HideOnCondition(&ME_OPTIONS_JOYSTICKSETUP, !ud.setup.usejoystick || CONTROL_JoyPresent == 0);
|
||||
break;
|
||||
|
||||
case MENU_COLCORR:
|
||||
|
@ -3601,10 +3612,10 @@ static void Menu_EntryLinkActivate(MenuEntry_t *entry)
|
|||
G_UpdateScreenArea();
|
||||
videoSetRenderMode(nrend);
|
||||
vsync = videoSetVsync(nvsync);
|
||||
ud.config.ScreenMode = fullscreen;
|
||||
ud.config.ScreenWidth = xres;
|
||||
ud.config.ScreenHeight = yres;
|
||||
ud.config.ScreenBPP = bpp;
|
||||
ud.setup.fullscreen = fullscreen;
|
||||
ud.setup.xdim = xres;
|
||||
ud.setup.ydim = yres;
|
||||
ud.setup.bpp = bpp;
|
||||
}
|
||||
else if (entry == &ME_SOUND_RESTART)
|
||||
{
|
||||
|
@ -3766,9 +3777,7 @@ static int32_t Menu_EntryOptionModify(MenuEntry_t *entry, int32_t newOption)
|
|||
}
|
||||
}
|
||||
else if (entry == &ME_VIDEOSETUP_FRAMELIMIT)
|
||||
{
|
||||
g_frameDelay = newOption ? (timerGetFreqU64()/newOption) : 0;
|
||||
}
|
||||
g_frameDelay = calcFrameDelay(newOption + r_maxfpsoffset);
|
||||
|
||||
switch (g_currentMenu)
|
||||
{
|
||||
|
@ -3831,7 +3840,7 @@ static void Menu_EntryOptionDidModify(MenuEntry_t *entry)
|
|||
videoResetMode();
|
||||
if (videoSetGameMode(fullscreen, xres, yres, bpp, upscalefactor))
|
||||
OSD_Printf("restartvid: Reset failed...\n");
|
||||
onvideomodechange(ud.config.ScreenBPP>8);
|
||||
onvideomodechange(ud.setup.bpp>8);
|
||||
G_RefreshLights();
|
||||
}
|
||||
#endif
|
||||
|
@ -3866,6 +3875,8 @@ static int32_t Menu_EntryRangeInt32Modify(MenuEntry_t *entry, int32_t newValue)
|
|||
joySetDeadZone(M_JOYSTICKAXES.currentEntry, newValue, *MEO_JOYSTICKAXIS_SATU.variable);
|
||||
else if (entry == &ME_JOYSTICKAXIS_SATU)
|
||||
joySetDeadZone(M_JOYSTICKAXES.currentEntry, *MEO_JOYSTICKAXIS_DEAD.variable, newValue);
|
||||
else if (entry == &ME_VIDEOSETUP_FRAMELIMITOFFSET)
|
||||
g_frameDelay = calcFrameDelay(r_maxfps + newValue);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -20,14 +20,19 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
*/
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
#include "duke3d.h"
|
||||
#include "osdcmds.h"
|
||||
#include "menus.h"
|
||||
#include "osdfuncs.h"
|
||||
#include "demo.h" // g_firstDemoFile[]
|
||||
#include "cheats.h"
|
||||
#include "sbar.h"
|
||||
#include "cmdline.h"
|
||||
#include "demo.h" // g_firstDemoFile[]
|
||||
#include "duke3d.h"
|
||||
#include "menus.h"
|
||||
#include "osdcmds.h"
|
||||
#include "osdfuncs.h"
|
||||
#include "savegame.h"
|
||||
#include "sbar.h"
|
||||
|
||||
#ifdef LUNATIC
|
||||
# include "lunatic_game.h"
|
||||
#endif
|
||||
|
||||
#ifdef EDUKE32_TOUCH_DEVICES
|
||||
#include "in_android.h"
|
||||
|
@ -38,7 +43,7 @@ float r_ambientlight = 1.0, r_ambientlightrecip = 1.0;
|
|||
|
||||
uint32_t cl_cheatmask;
|
||||
|
||||
static inline int32_t osdcmd_quit(osdfuncparm_t const * const UNUSED(parm))
|
||||
static inline int osdcmd_quit(osdcmdptr_t UNUSED(parm))
|
||||
{
|
||||
UNREFERENCED_CONST_PARAMETER(parm);
|
||||
OSD_ShowDisplay(0);
|
||||
|
@ -46,7 +51,7 @@ static inline int32_t osdcmd_quit(osdfuncparm_t const * const UNUSED(parm))
|
|||
return OSDCMD_OK;
|
||||
}
|
||||
|
||||
static int32_t osdcmd_changelevel(osdfuncparm_t const * const parm)
|
||||
static int osdcmd_changelevel(osdcmdptr_t parm)
|
||||
{
|
||||
int32_t volume=0,level;
|
||||
char *p;
|
||||
|
@ -155,7 +160,7 @@ static int32_t osdcmd_changelevel(osdfuncparm_t const * const parm)
|
|||
return OSDCMD_OK;
|
||||
}
|
||||
|
||||
static int32_t osdcmd_map(osdfuncparm_t const * const parm)
|
||||
static int osdcmd_map(osdcmdptr_t parm)
|
||||
{
|
||||
int32_t i;
|
||||
char filename[BMAX_PATH];
|
||||
|
@ -274,7 +279,12 @@ static int32_t osdcmd_map(osdfuncparm_t const * const parm)
|
|||
|
||||
ud.multimode = 1;
|
||||
|
||||
G_NewGame_EnterLevel();
|
||||
if (g_player[myconnectindex].ps->gm & MODE_GAME)
|
||||
{
|
||||
G_NewGame(ud.m_volume_number, ud.m_level_number, ud.m_player_skill);
|
||||
g_player[myconnectindex].ps->gm = MODE_RESTART;
|
||||
}
|
||||
else G_NewGame_EnterLevel();
|
||||
|
||||
return OSDCMD_OK;
|
||||
}
|
||||
|
@ -296,7 +306,7 @@ static int32_t osdcmd_map(osdfuncparm_t const * const 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(osdfuncparm_t const * const parm)
|
||||
static int osdcmd_demo(osdcmdptr_t parm)
|
||||
{
|
||||
if (numplayers > 1)
|
||||
{
|
||||
|
@ -323,7 +333,7 @@ static int32_t osdcmd_demo(osdfuncparm_t const * const parm)
|
|||
return OSDCMD_OK;
|
||||
}
|
||||
|
||||
static int32_t osdcmd_activatecheat(osdfuncparm_t const * const parm)
|
||||
static int osdcmd_activatecheat(osdcmdptr_t parm)
|
||||
{
|
||||
if (parm->numparms != 1)
|
||||
return OSDCMD_SHOWHELP;
|
||||
|
@ -336,7 +346,7 @@ static int32_t osdcmd_activatecheat(osdfuncparm_t const * const parm)
|
|||
return OSDCMD_OK;
|
||||
}
|
||||
|
||||
static int32_t osdcmd_god(osdfuncparm_t const * const UNUSED(parm))
|
||||
static int osdcmd_god(osdcmdptr_t UNUSED(parm))
|
||||
{
|
||||
UNREFERENCED_CONST_PARAMETER(parm);
|
||||
if (numplayers == 1 && g_player[myconnectindex].ps->gm & MODE_GAME)
|
||||
|
@ -347,7 +357,7 @@ static int32_t osdcmd_god(osdfuncparm_t const * const UNUSED(parm))
|
|||
return OSDCMD_OK;
|
||||
}
|
||||
|
||||
static int32_t osdcmd_noclip(osdfuncparm_t const * const UNUSED(parm))
|
||||
static int osdcmd_noclip(osdcmdptr_t UNUSED(parm))
|
||||
{
|
||||
UNREFERENCED_CONST_PARAMETER(parm);
|
||||
|
||||
|
@ -363,7 +373,7 @@ static int32_t osdcmd_noclip(osdfuncparm_t const * const UNUSED(parm))
|
|||
return OSDCMD_OK;
|
||||
}
|
||||
|
||||
static int32_t osdcmd_restartsound(osdfuncparm_t const * const UNUSED(parm))
|
||||
static int osdcmd_restartsound(osdcmdptr_t UNUSED(parm))
|
||||
{
|
||||
UNREFERENCED_CONST_PARAMETER(parm);
|
||||
S_SoundShutdown();
|
||||
|
@ -381,7 +391,7 @@ static int32_t osdcmd_restartsound(osdfuncparm_t const * const UNUSED(parm))
|
|||
return OSDCMD_OK;
|
||||
}
|
||||
|
||||
static int32_t osdcmd_music(osdfuncparm_t const * const parm)
|
||||
static int osdcmd_music(osdcmdptr_t parm)
|
||||
{
|
||||
if (parm->numparms == 1)
|
||||
{
|
||||
|
@ -411,19 +421,19 @@ static int32_t osdcmd_music(osdfuncparm_t const * const parm)
|
|||
return OSDCMD_SHOWHELP;
|
||||
}
|
||||
|
||||
int32_t osdcmd_restartvid(osdfuncparm_t const * const UNUSED(parm))
|
||||
int osdcmd_restartvid(osdcmdptr_t UNUSED(parm))
|
||||
{
|
||||
UNREFERENCED_CONST_PARAMETER(parm);
|
||||
videoResetMode();
|
||||
if (videoSetGameMode(ud.config.ScreenMode,ud.config.ScreenWidth,ud.config.ScreenHeight,ud.config.ScreenBPP,ud.detail))
|
||||
if (videoSetGameMode(ud.setup.fullscreen,ud.setup.xdim,ud.setup.ydim,ud.setup.bpp,ud.detail))
|
||||
G_GameExit("restartvid: Reset failed...\n");
|
||||
onvideomodechange(ud.config.ScreenBPP>8);
|
||||
onvideomodechange(ud.setup.bpp>8);
|
||||
G_UpdateScreenArea();
|
||||
|
||||
return OSDCMD_OK;
|
||||
}
|
||||
|
||||
int32_t osdcmd_restartmap(osdfuncparm_t const * const UNUSED(parm))
|
||||
int osdcmd_restartmap(osdcmdptr_t UNUSED(parm))
|
||||
{
|
||||
UNREFERENCED_CONST_PARAMETER(parm);
|
||||
|
||||
|
@ -433,10 +443,10 @@ int32_t osdcmd_restartmap(osdfuncparm_t const * const UNUSED(parm))
|
|||
return OSDCMD_OK;
|
||||
}
|
||||
|
||||
static int32_t osdcmd_vidmode(osdfuncparm_t const * const parm)
|
||||
static int osdcmd_vidmode(osdcmdptr_t parm)
|
||||
{
|
||||
int32_t newbpp = ud.config.ScreenBPP, newwidth = ud.config.ScreenWidth,
|
||||
newheight = ud.config.ScreenHeight, newfs = ud.config.ScreenMode;
|
||||
int32_t newbpp = ud.setup.bpp, newwidth = ud.setup.xdim,
|
||||
newheight = ud.setup.ydim, newfs = ud.setup.fullscreen;
|
||||
int32_t tmp;
|
||||
|
||||
if (parm->numparms < 1 || parm->numparms > 4) return OSDCMD_SHOWHELP;
|
||||
|
@ -469,19 +479,19 @@ static int32_t osdcmd_vidmode(osdfuncparm_t const * const parm)
|
|||
if (videoSetGameMode(newfs,newwidth,newheight,newbpp,upscalefactor))
|
||||
{
|
||||
initprintf("vidmode: Mode change failed!\n");
|
||||
if (videoSetGameMode(ud.config.ScreenMode, ud.config.ScreenWidth, ud.config.ScreenHeight, ud.config.ScreenBPP, upscalefactor))
|
||||
if (videoSetGameMode(ud.setup.fullscreen, ud.setup.xdim, ud.setup.ydim, ud.setup.bpp, upscalefactor))
|
||||
G_GameExit("vidmode: Reset failed!\n");
|
||||
}
|
||||
ud.config.ScreenBPP = newbpp;
|
||||
ud.config.ScreenWidth = newwidth;
|
||||
ud.config.ScreenHeight = newheight;
|
||||
ud.config.ScreenMode = newfs;
|
||||
onvideomodechange(ud.config.ScreenBPP>8);
|
||||
ud.setup.bpp = newbpp;
|
||||
ud.setup.xdim = newwidth;
|
||||
ud.setup.ydim = newheight;
|
||||
ud.setup.fullscreen = newfs;
|
||||
onvideomodechange(ud.setup.bpp>8);
|
||||
G_UpdateScreenArea();
|
||||
return OSDCMD_OK;
|
||||
}
|
||||
|
||||
static int32_t osdcmd_spawn(osdfuncparm_t const * const parm)
|
||||
static int osdcmd_spawn(osdcmdptr_t parm)
|
||||
{
|
||||
int32_t picnum = 0;
|
||||
uint16_t cstat=0;
|
||||
|
@ -575,40 +585,41 @@ static int32_t osdcmd_spawn(osdfuncparm_t const * const parm)
|
|||
return OSDCMD_OK;
|
||||
}
|
||||
|
||||
static int32_t osdcmd_addpath(osdfuncparm_t const * const parm)
|
||||
static int osdcmd_addpath(osdcmdptr_t parm)
|
||||
{
|
||||
char pathname[BMAX_PATH];
|
||||
if (parm->numparms != 1)
|
||||
return OSDCMD_SHOWHELP;
|
||||
|
||||
if (parm->numparms != 1) return OSDCMD_SHOWHELP;
|
||||
addsearchpath(parm->parms[0]);
|
||||
|
||||
strcpy(pathname,parm->parms[0]);
|
||||
addsearchpath(pathname);
|
||||
return OSDCMD_OK;
|
||||
}
|
||||
|
||||
static int32_t osdcmd_initgroupfile(osdfuncparm_t const * const parm)
|
||||
static int osdcmd_initgroupfile(osdcmdptr_t parm)
|
||||
{
|
||||
char file[BMAX_PATH];
|
||||
if (parm->numparms != 1)
|
||||
return OSDCMD_SHOWHELP;
|
||||
|
||||
if (parm->numparms != 1) return OSDCMD_SHOWHELP;
|
||||
initgroupfile(parm->parms[0]);
|
||||
|
||||
strcpy(file,parm->parms[0]);
|
||||
initgroupfile(file);
|
||||
return OSDCMD_OK;
|
||||
}
|
||||
|
||||
static int32_t osdcmd_cmenu(osdfuncparm_t const * const parm)
|
||||
static int osdcmd_cmenu(osdcmdptr_t parm)
|
||||
{
|
||||
if (parm->numparms != 1) return OSDCMD_SHOWHELP;
|
||||
if (parm->numparms != 1)
|
||||
return OSDCMD_SHOWHELP;
|
||||
|
||||
if (numplayers > 1)
|
||||
{
|
||||
OSD_Printf("cmenu: disallowed in multiplayer\n");
|
||||
OSD_Printf("Command not allowed in multiplayer\n");
|
||||
return OSDCMD_OK;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if ((g_player[myconnectindex].ps->gm & MODE_MENU) != MODE_MENU)
|
||||
Menu_Open(myconnectindex);
|
||||
|
||||
Menu_Change(Batol(parm->parms[0]));
|
||||
}
|
||||
|
||||
return OSDCMD_OK;
|
||||
}
|
||||
|
@ -616,18 +627,18 @@ static int32_t osdcmd_cmenu(osdfuncparm_t const * const parm)
|
|||
|
||||
|
||||
|
||||
static int32_t osdcmd_crosshaircolor(osdfuncparm_t const * const parm)
|
||||
static int osdcmd_crosshaircolor(osdcmdptr_t parm)
|
||||
{
|
||||
int32_t r, g, b;
|
||||
|
||||
if (parm->numparms != 3)
|
||||
{
|
||||
OSD_Printf("crosshaircolor: r:%d g:%d b:%d\n",CrosshairColors.r,CrosshairColors.g,CrosshairColors.b);
|
||||
return OSDCMD_SHOWHELP;
|
||||
}
|
||||
r = Batol(parm->parms[0]);
|
||||
g = Batol(parm->parms[1]);
|
||||
b = Batol(parm->parms[2]);
|
||||
|
||||
uint8_t const r = Batol(parm->parms[0]);
|
||||
uint8_t const g = Batol(parm->parms[1]);
|
||||
uint8_t const b = Batol(parm->parms[2]);
|
||||
|
||||
G_SetCrosshairColor(r,g,b);
|
||||
|
||||
if (!OSD_ParsingScript())
|
||||
|
@ -636,7 +647,7 @@ static int32_t osdcmd_crosshaircolor(osdfuncparm_t const * const parm)
|
|||
return OSDCMD_OK;
|
||||
}
|
||||
|
||||
static int32_t osdcmd_give(osdfuncparm_t const * const parm)
|
||||
static int osdcmd_give(osdcmdptr_t parm)
|
||||
{
|
||||
int32_t i;
|
||||
|
||||
|
@ -722,7 +733,7 @@ void onvideomodechange(int32_t newmode)
|
|||
}
|
||||
|
||||
#if !defined NETCODE_DISABLE
|
||||
static int32_t osdcmd_name(osdfuncparm_t const * const parm)
|
||||
static int osdcmd_name(osdcmdptr_t parm)
|
||||
{
|
||||
char namebuf[32];
|
||||
|
||||
|
@ -748,152 +759,43 @@ static int32_t osdcmd_name(osdfuncparm_t const * const parm)
|
|||
}
|
||||
#endif
|
||||
|
||||
static int32_t osdcmd_button(osdfuncparm_t const * const parm)
|
||||
static int osdcmd_button(osdcmdptr_t parm)
|
||||
{
|
||||
static char const s_gamefunc_[] = "gamefunc_";
|
||||
int constexpr strlen_gamefunc_ = ARRAY_SIZE(s_gamefunc_) - 1;
|
||||
static char const s_gamefunc_[] = "gamefunc_";
|
||||
int constexpr strlen_gamefunc_ = ARRAY_SIZE(s_gamefunc_) - 1;
|
||||
|
||||
char const* p = parm->name + strlen_gamefunc_;
|
||||
char const *p = parm->name + strlen_gamefunc_;
|
||||
|
||||
// if (g_player[myconnectindex].ps->gm == MODE_GAME) // only trigger these if in game
|
||||
CONTROL_ButtonFlags[CONFIG_FunctionNameToNum(p)] = 1; // FIXME
|
||||
// if (g_player[myconnectindex].ps->gm == MODE_GAME) // only trigger these if in game
|
||||
CONTROL_ButtonFlags[CONFIG_FunctionNameToNum(p)] = 1; // FIXME
|
||||
|
||||
return OSDCMD_OK;
|
||||
}
|
||||
|
||||
const keydef_t ConsoleKeys[]=
|
||||
{
|
||||
{ "Escape", 0x1 },
|
||||
{ "1", 0x2 },
|
||||
{ "2", 0x3 },
|
||||
{ "3", 0x4 },
|
||||
{ "4", 0x5 },
|
||||
{ "5", 0x6 },
|
||||
{ "6", 0x7 },
|
||||
{ "7", 0x8 },
|
||||
{ "8", 0x9 },
|
||||
{ "9", 0xa },
|
||||
{ "0", 0xb },
|
||||
{ "-", 0xc },
|
||||
{ "=", 0xd },
|
||||
{ "BakSpc", 0xe },
|
||||
{ "Tab", 0xf },
|
||||
{ "Q", 0x10 },
|
||||
{ "W", 0x11 },
|
||||
{ "E", 0x12 },
|
||||
{ "R", 0x13 },
|
||||
{ "T", 0x14 },
|
||||
{ "Y", 0x15 },
|
||||
{ "U", 0x16 },
|
||||
{ "I", 0x17 },
|
||||
{ "O", 0x18 },
|
||||
{ "P", 0x19 },
|
||||
{ "[", 0x1a },
|
||||
{ "]", 0x1b },
|
||||
{ "Enter", 0x1c },
|
||||
{ "LCtrl", 0x1d },
|
||||
{ "A", 0x1e },
|
||||
{ "S", 0x1f },
|
||||
{ "D", 0x20 },
|
||||
{ "F", 0x21 },
|
||||
{ "G", 0x22 },
|
||||
{ "H", 0x23 },
|
||||
{ "J", 0x24 },
|
||||
{ "K", 0x25 },
|
||||
{ "L", 0x26 },
|
||||
{ "SemiColon", 0x27 },
|
||||
{ "'", 0x28 },
|
||||
{ "Tilde", 0x29 },
|
||||
{ "LShift", 0x2a },
|
||||
{ "Backslash", 0x2b },
|
||||
{ "Z", 0x2c },
|
||||
{ "X", 0x2d },
|
||||
{ "C", 0x2e },
|
||||
{ "V", 0x2f },
|
||||
{ "B", 0x30 },
|
||||
{ "N", 0x31 },
|
||||
{ "M", 0x32 },
|
||||
{ ",", 0x33 },
|
||||
{ ".", 0x34 },
|
||||
{ "/", 0x35 },
|
||||
{ "RShift", 0x36 },
|
||||
{ "Kpad*", 0x37 },
|
||||
{ "LAlt", 0x38 },
|
||||
{ "Space", 0x39 },
|
||||
{ "CapLck", 0x3a },
|
||||
{ "F1", 0x3b },
|
||||
{ "F2", 0x3c },
|
||||
{ "F3", 0x3d },
|
||||
{ "F4", 0x3e },
|
||||
{ "F5", 0x3f },
|
||||
{ "F6", 0x40 },
|
||||
{ "F7", 0x41 },
|
||||
{ "F8", 0x42 },
|
||||
{ "F9", 0x43 },
|
||||
{ "F10", 0x44 },
|
||||
{ "NumLck", 0x45 },
|
||||
{ "ScrLck", 0x46 },
|
||||
{ "Kpad7", 0x47 },
|
||||
{ "Kpad8", 0x48 },
|
||||
{ "Kpad9", 0x49 },
|
||||
{ "Kpad-", 0x4a },
|
||||
{ "Kpad4", 0x4b },
|
||||
{ "Kpad5", 0x4c },
|
||||
{ "Kpad6", 0x4d },
|
||||
{ "Kpad+", 0x4e },
|
||||
{ "Kpad1", 0x4f },
|
||||
{ "Kpad2", 0x50 },
|
||||
{ "Kpad3", 0x51 },
|
||||
{ "Kpad0", 0x52 },
|
||||
{ "Kpad.", 0x53 },
|
||||
{ "F11", 0x57 },
|
||||
{ "F12", 0x58 },
|
||||
{ "KpdEnt", 0x9c },
|
||||
{ "RCtrl", 0x9d },
|
||||
{ "Kpad/", 0xb5 },
|
||||
{ "RAlt", 0xb8 },
|
||||
{ "PrtScn", 0xb7 },
|
||||
{ "Pause", 0xc5 },
|
||||
{ "Home", 0xc7 },
|
||||
{ "Up", 0xc8 },
|
||||
{ "PgUp", 0xc9 },
|
||||
{ "Left", 0xcb },
|
||||
{ "Right", 0xcd },
|
||||
{ "End", 0xcf },
|
||||
{ "Down", 0xd0 },
|
||||
{ "PgDn", 0xd1 },
|
||||
{ "Insert", 0xd2 },
|
||||
{ "Delete", 0xd3 },
|
||||
|
||||
{0,0}
|
||||
};
|
||||
|
||||
const char *const ConsoleButtons[] =
|
||||
{
|
||||
"mouse1", "mouse2", "mouse3", "mouse4", "mwheelup",
|
||||
"mwheeldn", "mouse5", "mouse6", "mouse7", "mouse8"
|
||||
};
|
||||
|
||||
static int32_t osdcmd_bind(osdfuncparm_t const * const parm)
|
||||
static int osdcmd_bind(osdcmdptr_t parm)
|
||||
{
|
||||
int32_t i, j, repeat;
|
||||
|
||||
if (parm->numparms==1 && !Bstrcasecmp(parm->parms[0],"showkeys"))
|
||||
{
|
||||
for (i=0; ConsoleKeys[i].name; i++)
|
||||
OSD_Printf("%s\n",ConsoleKeys[i].name);
|
||||
for (i=0; i<MAXMOUSEBUTTONS; i++)
|
||||
OSD_Printf("%s\n",ConsoleButtons[i]);
|
||||
for (int i=0; sctokeylut[i].key; i++)
|
||||
OSD_Printf("%s\n",sctokeylut[i].key);
|
||||
for (auto ConsoleButton : ConsoleButtons)
|
||||
OSD_Printf("%s\n",ConsoleButton);
|
||||
return OSDCMD_OK;
|
||||
}
|
||||
|
||||
if (parm->numparms==0)
|
||||
{
|
||||
int32_t j=0;
|
||||
int j=0;
|
||||
|
||||
OSD_Printf("Current key bindings:\n");
|
||||
|
||||
for (i=0; i<MAXBOUNDKEYS+MAXMOUSEBUTTONS; i++)
|
||||
for (int i=0; i<MAXBOUNDKEYS+MAXMOUSEBUTTONS; i++)
|
||||
if (CONTROL_KeyIsBound(i))
|
||||
{
|
||||
j++;
|
||||
|
@ -907,15 +809,21 @@ static int32_t osdcmd_bind(osdfuncparm_t const * const parm)
|
|||
return OSDCMD_OK;
|
||||
}
|
||||
|
||||
for (i=0; ConsoleKeys[i].name; i++)
|
||||
if (!Bstrcasecmp(parm->parms[0],ConsoleKeys[i].name))
|
||||
break;
|
||||
int i, j, repeat;
|
||||
|
||||
if (!ConsoleKeys[i].name)
|
||||
for (i=0; i < ARRAY_SSIZE(sctokeylut); i++)
|
||||
{
|
||||
if (!Bstrcasecmp(parm->parms[0], sctokeylut[i].key))
|
||||
break;
|
||||
}
|
||||
|
||||
// didn't find the key
|
||||
if (i == ARRAY_SSIZE(sctokeylut))
|
||||
{
|
||||
for (i=0; i<MAXMOUSEBUTTONS; i++)
|
||||
if (!Bstrcasecmp(parm->parms[0],ConsoleButtons[i]))
|
||||
break;
|
||||
|
||||
if (i >= MAXMOUSEBUTTONS)
|
||||
return OSDCMD_SHOWHELP;
|
||||
|
||||
|
@ -953,10 +861,10 @@ static int32_t osdcmd_bind(osdfuncparm_t const * const parm)
|
|||
|
||||
if (parm->numparms < 2)
|
||||
{
|
||||
if (CONTROL_KeyIsBound(ConsoleKeys[i].id))
|
||||
OSD_Printf("%-9s %s\"%s\"\n", ConsoleKeys[i].name, CONTROL_KeyBinds[ConsoleKeys[i].id].repeat?"":"norepeat ",
|
||||
CONTROL_KeyBinds[ConsoleKeys[i].id].cmdstr);
|
||||
else OSD_Printf("%s is unbound\n", ConsoleKeys[i].name);
|
||||
if (CONTROL_KeyIsBound(sctokeylut[i].sc))
|
||||
OSD_Printf("%-9s %s\"%s\"\n", sctokeylut[i].key, CONTROL_KeyBinds[sctokeylut[i].sc].repeat?"":"norepeat ",
|
||||
CONTROL_KeyBinds[sctokeylut[i].sc].cmdstr);
|
||||
else OSD_Printf("%s is unbound\n", sctokeylut[i].key);
|
||||
|
||||
return OSDCMD_OK;
|
||||
}
|
||||
|
@ -977,20 +885,21 @@ static int32_t osdcmd_bind(osdfuncparm_t const * const parm)
|
|||
Bstrcat(tempbuf,parm->parms[j++]);
|
||||
}
|
||||
|
||||
CONTROL_BindKey(ConsoleKeys[i].id, tempbuf, repeat, ConsoleKeys[i].name);
|
||||
CONTROL_BindKey(sctokeylut[i].sc, tempbuf, repeat, sctokeylut[i].key);
|
||||
|
||||
{
|
||||
char *cp = tempbuf;
|
||||
|
||||
// Populate the keyboard config menu based on the bind.
|
||||
// Take care of processing one-to-many bindings properly, too.
|
||||
while ((cp = Bstrstr(cp, "gamefunc_")))
|
||||
static char const s_gamefunc_[] = "gamefunc_";
|
||||
int constexpr strlen_gamefunc_ = ARRAY_SIZE(s_gamefunc_) - 1;
|
||||
|
||||
while ((cp = Bstrstr(cp, s_gamefunc_)))
|
||||
{
|
||||
char *semi;
|
||||
cp += strlen_gamefunc_;
|
||||
|
||||
cp += 9; // skip the "gamefunc_"
|
||||
char *semi = Bstrchr(cp, ';');
|
||||
|
||||
semi = Bstrchr(cp, ';');
|
||||
if (semi)
|
||||
*semi = 0;
|
||||
|
||||
|
@ -1002,14 +911,13 @@ static int32_t osdcmd_bind(osdfuncparm_t const * const parm)
|
|||
if (j != -1)
|
||||
{
|
||||
ud.config.KeyboardKeys[j][1] = ud.config.KeyboardKeys[j][0];
|
||||
ud.config.KeyboardKeys[j][0] = ConsoleKeys[i].id;
|
||||
// CONTROL_MapKey(j, ConsoleKeys[i].id, ud.config.KeyboardKeys[j][0]);
|
||||
ud.config.KeyboardKeys[j][0] = sctokeylut[i].sc;
|
||||
// CONTROL_MapKey(j, sctokeylut[i].sc, ud.config.KeyboardKeys[j][0]);
|
||||
|
||||
if (j == gamefunc_Show_Console)
|
||||
OSD_CaptureKey(ConsoleKeys[i].id);
|
||||
OSD_CaptureKey(sctokeylut[i].sc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!OSD_ParsingScript())
|
||||
OSD_Printf("%s\n",parm->raw);
|
||||
|
@ -1017,23 +925,18 @@ static int32_t osdcmd_bind(osdfuncparm_t const * const parm)
|
|||
return OSDCMD_OK;
|
||||
}
|
||||
|
||||
static int32_t osdcmd_unbindall(osdfuncparm_t const * const UNUSED(parm))
|
||||
static int osdcmd_unbindall(osdcmdptr_t UNUSED(parm))
|
||||
{
|
||||
int32_t i;
|
||||
|
||||
UNREFERENCED_CONST_PARAMETER(parm);
|
||||
|
||||
for (i=0; i<MAXBOUNDKEYS; i++)
|
||||
for (int i = 0; i < MAXBOUNDKEYS; ++i)
|
||||
CONTROL_FreeKeyBind(i);
|
||||
|
||||
for (i=0; i<MAXMOUSEBUTTONS; i++)
|
||||
for (int i = 0; i < MAXMOUSEBUTTONS; ++i)
|
||||
CONTROL_FreeMouseBind(i);
|
||||
|
||||
for (i=0; i<NUMGAMEFUNCTIONS; i++)
|
||||
{
|
||||
ud.config.KeyboardKeys[i][0] = ud.config.KeyboardKeys[i][1] = 0xff;
|
||||
// CONTROL_MapKey(i, ud.config.KeyboardKeys[i][0], ud.config.KeyboardKeys[i][1]);
|
||||
}
|
||||
for (auto &KeyboardKey : ud.config.KeyboardKeys)
|
||||
KeyboardKey[0] = KeyboardKey[1] = 0xff;
|
||||
|
||||
if (!OSD_ParsingScript())
|
||||
OSD_Printf("unbound all controls\n");
|
||||
|
@ -1041,40 +944,35 @@ static int32_t osdcmd_unbindall(osdfuncparm_t const * const UNUSED(parm))
|
|||
return OSDCMD_OK;
|
||||
}
|
||||
|
||||
static int32_t osdcmd_unbind(osdfuncparm_t const * const parm)
|
||||
static int osdcmd_unbind(osdcmdptr_t parm)
|
||||
{
|
||||
int32_t i;
|
||||
if (parm->numparms != 1)
|
||||
return OSDCMD_SHOWHELP;
|
||||
|
||||
if (parm->numparms < 1) return OSDCMD_SHOWHELP;
|
||||
|
||||
for (i=0; ConsoleKeys[i].name; i++)
|
||||
if (!Bstrcasecmp(parm->parms[0],ConsoleKeys[i].name))
|
||||
break;
|
||||
|
||||
if (!ConsoleKeys[i].name)
|
||||
for (auto ConsoleKey : sctokeylut)
|
||||
{
|
||||
for (i=0; i<MAXMOUSEBUTTONS; i++)
|
||||
if (!Bstrcasecmp(parm->parms[0],ConsoleButtons[i]))
|
||||
break;
|
||||
|
||||
if (i >= MAXMOUSEBUTTONS)
|
||||
return OSDCMD_SHOWHELP;
|
||||
|
||||
CONTROL_FreeMouseBind(i);
|
||||
|
||||
OSD_Printf("unbound %s\n",ConsoleButtons[i]);
|
||||
|
||||
return OSDCMD_OK;
|
||||
if (ConsoleKey.key && !Bstrcasecmp(parm->parms[0], ConsoleKey.key))
|
||||
{
|
||||
CONTROL_FreeKeyBind(ConsoleKey.sc);
|
||||
OSD_Printf("unbound key %s\n", ConsoleKey.key);
|
||||
return OSDCMD_OK;
|
||||
}
|
||||
}
|
||||
|
||||
CONTROL_FreeKeyBind(ConsoleKeys[i].id);
|
||||
for (int i = 0; i < MAXMOUSEBUTTONS; i++)
|
||||
{
|
||||
if (!Bstrcasecmp(parm->parms[0], ConsoleButtons[i]))
|
||||
{
|
||||
CONTROL_FreeMouseBind(i);
|
||||
OSD_Printf("unbound %s\n", ConsoleButtons[i]);
|
||||
return OSDCMD_OK;
|
||||
}
|
||||
}
|
||||
|
||||
OSD_Printf("unbound key %s\n",ConsoleKeys[i].name);
|
||||
|
||||
return OSDCMD_OK;
|
||||
return OSDCMD_SHOWHELP;
|
||||
}
|
||||
|
||||
static int32_t osdcmd_quicksave(osdfuncparm_t const * const UNUSED(parm))
|
||||
static int osdcmd_quicksave(osdcmdptr_t UNUSED(parm))
|
||||
{
|
||||
UNREFERENCED_CONST_PARAMETER(parm);
|
||||
if (!(g_player[myconnectindex].ps->gm & MODE_GAME))
|
||||
|
@ -1083,7 +981,7 @@ static int32_t osdcmd_quicksave(osdfuncparm_t const * const UNUSED(parm))
|
|||
return OSDCMD_OK;
|
||||
}
|
||||
|
||||
static int32_t osdcmd_quickload(osdfuncparm_t const * const UNUSED(parm))
|
||||
static int osdcmd_quickload(osdcmdptr_t UNUSED(parm))
|
||||
{
|
||||
UNREFERENCED_CONST_PARAMETER(parm);
|
||||
if (!(g_player[myconnectindex].ps->gm & MODE_GAME))
|
||||
|
@ -1092,7 +990,7 @@ static int32_t osdcmd_quickload(osdfuncparm_t const * const UNUSED(parm))
|
|||
return OSDCMD_OK;
|
||||
}
|
||||
|
||||
static int32_t osdcmd_screenshot(osdfuncparm_t const * const parm)
|
||||
static int osdcmd_screenshot(osdcmdptr_t parm)
|
||||
{
|
||||
// KB_ClearKeysDown();
|
||||
static const char *fn = "duke0000.png";
|
||||
|
@ -1105,14 +1003,14 @@ static int32_t osdcmd_screenshot(osdfuncparm_t const * const parm)
|
|||
}
|
||||
|
||||
#if 0
|
||||
static int32_t osdcmd_savestate(osdfuncparm_t const * const UNUSED(parm))
|
||||
static int osdcmd_savestate(osdcmdptr_t UNUSED(parm))
|
||||
{
|
||||
UNREFERENCED_PARAMETER(parm);
|
||||
G_SaveMapState();
|
||||
return OSDCMD_OK;
|
||||
}
|
||||
|
||||
static int32_t osdcmd_restorestate(osdfuncparm_t const * const UNUSED(parm))
|
||||
static int osdcmd_restorestate(osdcmdptr_t UNUSED(parm))
|
||||
{
|
||||
UNREFERENCED_PARAMETER(parm);
|
||||
G_RestoreMapState();
|
||||
|
@ -1121,7 +1019,7 @@ static int32_t osdcmd_restorestate(osdfuncparm_t const * const UNUSED(parm))
|
|||
#endif
|
||||
|
||||
#ifdef DEBUGGINGAIDS
|
||||
static int32_t osdcmd_inittimer(osdfuncparm_t const * const parm)
|
||||
static int osdcmd_inittimer(osdcmdptr_t parm)
|
||||
{
|
||||
if (parm->numparms != 1)
|
||||
{
|
||||
|
@ -1137,14 +1035,14 @@ static int32_t osdcmd_inittimer(osdfuncparm_t const * const parm)
|
|||
#endif
|
||||
|
||||
#if !defined NETCODE_DISABLE
|
||||
static int32_t osdcmd_disconnect(osdfuncparm_t const * const UNUSED(parm))
|
||||
static int osdcmd_disconnect(osdcmdptr_t UNUSED(parm))
|
||||
{
|
||||
UNREFERENCED_CONST_PARAMETER(parm);
|
||||
g_netDisconnect = 1;
|
||||
return OSDCMD_OK;
|
||||
}
|
||||
|
||||
static int32_t osdcmd_connect(osdfuncparm_t const * const parm)
|
||||
static int osdcmd_connect(osdcmdptr_t parm)
|
||||
{
|
||||
if (parm->numparms != 1)
|
||||
return OSDCMD_SHOWHELP;
|
||||
|
@ -1154,7 +1052,7 @@ static int32_t osdcmd_connect(osdfuncparm_t const * const parm)
|
|||
return OSDCMD_OK;
|
||||
}
|
||||
|
||||
static int32_t osdcmd_password(osdfuncparm_t const * const parm)
|
||||
static int osdcmd_password(osdcmdptr_t parm)
|
||||
{
|
||||
if (parm->numparms < 1)
|
||||
{
|
||||
|
@ -1166,7 +1064,7 @@ static int32_t osdcmd_password(osdfuncparm_t const * const parm)
|
|||
return OSDCMD_OK;
|
||||
}
|
||||
|
||||
static int32_t osdcmd_listplayers(osdfuncparm_t const * const parm)
|
||||
static int osdcmd_listplayers(osdcmdptr_t parm)
|
||||
{
|
||||
ENetPeer *currentPeer;
|
||||
char ipaddr[32];
|
||||
|
@ -1197,7 +1095,7 @@ static int32_t osdcmd_listplayers(osdfuncparm_t const * const parm)
|
|||
return OSDCMD_OK;
|
||||
}
|
||||
|
||||
static int32_t osdcmd_kick(osdfuncparm_t const * const parm)
|
||||
static int osdcmd_kick(osdcmdptr_t parm)
|
||||
{
|
||||
ENetPeer *currentPeer;
|
||||
uint32_t hexaddr;
|
||||
|
@ -1235,7 +1133,7 @@ static int32_t osdcmd_kick(osdfuncparm_t const * const parm)
|
|||
return OSDCMD_OK;
|
||||
}
|
||||
|
||||
static int32_t osdcmd_kickban(osdfuncparm_t const * const parm)
|
||||
static int osdcmd_kickban(osdcmdptr_t parm)
|
||||
{
|
||||
ENetPeer *currentPeer;
|
||||
uint32_t hexaddr;
|
||||
|
@ -1280,18 +1178,19 @@ static int32_t osdcmd_kickban(osdfuncparm_t const * const parm)
|
|||
}
|
||||
#endif
|
||||
|
||||
static int32_t osdcmd_purgesaves(osdfuncparm_t const * const UNUSED(parm))
|
||||
static int osdcmd_purgesaves(osdcmdptr_t UNUSED(parm))
|
||||
{
|
||||
UNREFERENCED_CONST_PARAMETER(parm);
|
||||
G_DeleteOldSaves();
|
||||
return OSDCMD_OK;
|
||||
}
|
||||
|
||||
static int32_t osdcmd_printtimes(osdfuncparm_t const * const UNUSED(parm))
|
||||
static int osdcmd_printtimes(osdcmdptr_t UNUSED(parm))
|
||||
{
|
||||
UNREFERENCED_CONST_PARAMETER(parm);
|
||||
|
||||
char buf[32];
|
||||
int32_t maxlen = 0;
|
||||
int32_t haveac=0;
|
||||
|
||||
for (int i=0; i<MAXTILES; i++)
|
||||
|
@ -1326,9 +1225,9 @@ static int32_t osdcmd_printtimes(osdfuncparm_t const * const UNUSED(parm))
|
|||
return OSDCMD_OK;
|
||||
}
|
||||
|
||||
static int32_t osdcmd_cvar_set_game(osdfuncparm_t const * const parm)
|
||||
static int osdcmd_cvar_set_game(osdcmdptr_t parm)
|
||||
{
|
||||
int32_t r = osdcmd_cvar_set(parm);
|
||||
int const r = osdcmd_cvar_set(parm);
|
||||
|
||||
if (r != OSDCMD_OK) return r;
|
||||
|
||||
|
@ -1344,10 +1243,10 @@ static int32_t osdcmd_cvar_set_game(osdfuncparm_t const * const parm)
|
|||
ud.statusbarmode = (ud.screen_size < 8);
|
||||
G_UpdateScreenArea();
|
||||
}
|
||||
else if (!Bstrcasecmp(parm->name, "r_maxfps"))
|
||||
else if (!Bstrcasecmp(parm->name, "r_maxfps") || !Bstrcasecmp(parm->name, "r_maxfpsoffset"))
|
||||
{
|
||||
if (r_maxfps != 0) r_maxfps = clamp(r_maxfps, 30, 1000);
|
||||
g_frameDelay = r_maxfps ? (timerGetFreqU64()/r_maxfps) : 0;
|
||||
g_frameDelay = calcFrameDelay(r_maxfps + r_maxfpsoffset);
|
||||
}
|
||||
else if (!Bstrcasecmp(parm->name, "r_ambientlight"))
|
||||
{
|
||||
|
@ -1357,11 +1256,11 @@ static int32_t osdcmd_cvar_set_game(osdfuncparm_t const * const parm)
|
|||
}
|
||||
else if (!Bstrcasecmp(parm->name, "in_mouse"))
|
||||
{
|
||||
CONTROL_MouseEnabled = (ud.config.UseMouse && CONTROL_MousePresent);
|
||||
CONTROL_MouseEnabled = (ud.setup.usemouse && CONTROL_MousePresent);
|
||||
}
|
||||
else if (!Bstrcasecmp(parm->name, "in_joystick"))
|
||||
{
|
||||
CONTROL_JoystickEnabled = (ud.config.UseJoystick && CONTROL_JoyPresent);
|
||||
CONTROL_JoystickEnabled = (ud.setup.usejoystick && CONTROL_JoyPresent);
|
||||
}
|
||||
else if (!Bstrcasecmp(parm->name, "vid_gamma"))
|
||||
{
|
||||
|
@ -1450,9 +1349,9 @@ static int32_t osdcmd_cvar_set_game(osdfuncparm_t const * const parm)
|
|||
return r;
|
||||
}
|
||||
|
||||
static int32_t osdcmd_cvar_set_multi(osdfuncparm_t const * const parm)
|
||||
static int osdcmd_cvar_set_multi(osdcmdptr_t parm)
|
||||
{
|
||||
int32_t r = osdcmd_cvar_set_game(parm);
|
||||
int const r = osdcmd_cvar_set_game(parm);
|
||||
|
||||
if (r != OSDCMD_OK) return r;
|
||||
|
||||
|
@ -1463,8 +1362,6 @@ static int32_t osdcmd_cvar_set_multi(osdfuncparm_t const * const parm)
|
|||
|
||||
int32_t registerosdcommands(void)
|
||||
{
|
||||
uint32_t i;
|
||||
|
||||
static osdcvardata_t cvars_game[] =
|
||||
{
|
||||
{ "crosshair", "enable/disable crosshair", (void *)&ud.crosshair, CVAR_BOOL, 0, 1 },
|
||||
|
@ -1517,6 +1414,8 @@ int32_t registerosdcommands(void)
|
|||
{ "demoplay_diffs","enable/disable application of diffs in demo playback",(void *)&demoplay_diffs, CVAR_BOOL, 0, 1 },
|
||||
{ "demoplay_showsync","enable/disable display of sync status",(void *)&demoplay_showsync, CVAR_BOOL, 0, 1 },
|
||||
|
||||
{ "fov", "change the field of view", (void *)&ud.fov, CVAR_INT|CVAR_FUNCPTR, 75, 120 },
|
||||
|
||||
{ "hud_althud", "enable/disable alternate mini-hud", (void *)&ud.althud, CVAR_BOOL, 0, 1 },
|
||||
{ "hud_custom", "change the custom hud", (void *)&ud.statusbarcustom, CVAR_INT, 0, ud.statusbarrange },
|
||||
{ "hud_position", "aligns the status bar to the bottom/top", (void *)&ud.hudontop, CVAR_BOOL, 0, 1 },
|
||||
|
@ -1538,8 +1437,8 @@ int32_t registerosdcommands(void)
|
|||
{ "hud_hidestick", "hide the touch input stick", (void *)&droidinput.hideStick, CVAR_BOOL, 0, 1 },
|
||||
#endif
|
||||
|
||||
{ "in_joystick","enables input from the joystick if it is present",(void *)&ud.config.UseJoystick, CVAR_BOOL|CVAR_FUNCPTR, 0, 1 },
|
||||
{ "in_mouse","enables input from the mouse if it is present",(void *)&ud.config.UseMouse, CVAR_BOOL|CVAR_FUNCPTR, 0, 1 },
|
||||
{ "in_joystick","enables input from the joystick if it is present",(void *)&ud.setup.usejoystick, CVAR_BOOL|CVAR_FUNCPTR, 0, 1 },
|
||||
{ "in_mouse","enables input from the mouse if it is present",(void *)&ud.setup.usemouse, CVAR_BOOL|CVAR_FUNCPTR, 0, 1 },
|
||||
|
||||
{ "in_aimmode", "0:toggle, 1:hold to aim", (void *)&ud.mouseaiming, CVAR_BOOL, 0, 1 },
|
||||
{
|
||||
|
@ -1560,6 +1459,7 @@ int32_t registerosdcommands(void)
|
|||
{ "r_camrefreshdelay", "minimum delay between security camera sprite updates, 120 = 1 second", (void *)&ud.camera_time, CVAR_INT, 1, 240 },
|
||||
{ "r_drawweapon", "enable/disable weapon drawing", (void *)&ud.drawweapon, CVAR_INT, 0, 2 },
|
||||
{ "r_showfps", "show the frame rate counter", (void *)&ud.showfps, CVAR_INT, 0, 3 },
|
||||
{ "r_showfpsperiod", "time in seconds before averaging min and max stats for r_showfps 2+", (void *)&ud.frameperiod, CVAR_INT, 0, 5 },
|
||||
{ "r_shadows", "enable/disable sprite and model shadows", (void *)&ud.shadows, CVAR_BOOL, 0, 1 },
|
||||
{ "r_size", "change size of viewable area", (void *)&ud.screen_size, CVAR_INT|CVAR_FUNCPTR, 0, 64 },
|
||||
{ "r_rotatespritenowidescreen", "pass bit 1024 to all CON rotatesprite calls", (void *)&g_rotatespriteNoWidescreen, CVAR_BOOL|CVAR_FUNCPTR, 0, 1 },
|
||||
|
@ -1568,6 +1468,7 @@ int32_t registerosdcommands(void)
|
|||
|
||||
{ "r_ambientlight", "sets the global map light level",(void *)&r_ambientlight, CVAR_FLOAT|CVAR_FUNCPTR, 0, 10 },
|
||||
{ "r_maxfps", "limit the frame rate",(void *)&r_maxfps, CVAR_INT|CVAR_FUNCPTR, 0, 1000 },
|
||||
{ "r_maxfpsoffset", "menu-controlled offset for r_maxfps",(void *)&r_maxfpsoffset, CVAR_INT|CVAR_FUNCPTR, -10, 10 },
|
||||
|
||||
{ "sensitivity","changes the mouse sensitivity", (void *)&CONTROL_MouseSensitivity, CVAR_FLOAT|CVAR_FUNCPTR, 0, 25 },
|
||||
|
||||
|
@ -1600,17 +1501,17 @@ int32_t registerosdcommands(void)
|
|||
|
||||
osdcmd_cheatsinfo_stat.cheatnum = -1;
|
||||
|
||||
for (i=0; i<ARRAY_SIZE(cvars_game); i++)
|
||||
for (auto & cv : cvars_game)
|
||||
{
|
||||
switch (cvars_game[i].flags & (CVAR_FUNCPTR|CVAR_MULTI))
|
||||
switch (cv.flags & (CVAR_FUNCPTR|CVAR_MULTI))
|
||||
{
|
||||
case CVAR_FUNCPTR:
|
||||
OSD_RegisterCvar(&cvars_game[i], osdcmd_cvar_set_game); break;
|
||||
OSD_RegisterCvar(&cv, osdcmd_cvar_set_game); break;
|
||||
case CVAR_MULTI:
|
||||
case CVAR_FUNCPTR|CVAR_MULTI:
|
||||
OSD_RegisterCvar(&cvars_game[i], osdcmd_cvar_set_multi); break;
|
||||
OSD_RegisterCvar(&cv, osdcmd_cvar_set_multi); break;
|
||||
default:
|
||||
OSD_RegisterCvar(&cvars_game[i], osdcmd_cvar_set); break;
|
||||
OSD_RegisterCvar(&cv, osdcmd_cvar_set); break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1633,21 +1534,19 @@ int32_t registerosdcommands(void)
|
|||
OSD_RegisterFunction("disconnect","disconnect: disconnects from the local multiplayer game", osdcmd_disconnect);
|
||||
#endif
|
||||
|
||||
for (i=0; i<NUMGAMEFUNCTIONS; i++)
|
||||
for (auto & func : gamefunctions)
|
||||
{
|
||||
char *t;
|
||||
int32_t j;
|
||||
|
||||
if (gamefunctions[i][0] == '\0')
|
||||
if (func[0] == '\0')
|
||||
continue;
|
||||
|
||||
// if (!Bstrcmp(gamefunctions[i],"Show_Console")) continue;
|
||||
|
||||
Bsprintf(tempbuf,"gamefunc_%s",gamefunctions[i]);
|
||||
t = Xstrdup(tempbuf);
|
||||
for (j=Bstrlen(t); j>=0; j--)
|
||||
t[j] = Btolower(t[j]);
|
||||
Bstrcat(tempbuf,": game button");
|
||||
Bsprintf(tempbuf, "gamefunc_%s", func);
|
||||
|
||||
char *const t = Bstrtolower(Xstrdup(tempbuf));
|
||||
|
||||
Bstrcat(tempbuf, ": game button");
|
||||
|
||||
OSD_RegisterFunction(t, Xstrdup(tempbuf), osdcmd_button);
|
||||
}
|
||||
|
||||
|
|
|
@ -45,7 +45,6 @@ typedef struct {
|
|||
int32_t id;
|
||||
} keydef_t;
|
||||
|
||||
extern const keydef_t ConsoleKeys[];
|
||||
extern const char *const ConsoleButtons[];
|
||||
|
||||
extern uint32_t cl_cheatmask;
|
||||
|
|
|
@ -24,6 +24,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
#define player_h_
|
||||
|
||||
#include "inv.h"
|
||||
#include "namesdyn.h"
|
||||
#include "fix16.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -2346,7 +2346,7 @@ int G_EnterLevel(int gameMode)
|
|||
FX_StopAllSounds();
|
||||
S_ClearSoundLocks();
|
||||
FX_SetReverb(0);
|
||||
videoSetGameMode(ud.config.ScreenMode, ud.config.ScreenWidth, ud.config.ScreenHeight, ud.config.ScreenBPP, upscalefactor);
|
||||
videoSetGameMode(ud.setup.fullscreen, ud.setup.xdim, ud.setup.ydim, ud.setup.bpp, upscalefactor);
|
||||
}
|
||||
|
||||
if (Menu_HaveUserMap())
|
||||
|
|
|
@ -778,12 +778,14 @@ static void G_ShowCacheLocks(void)
|
|||
|
||||
static void G_PrintFPS(void)
|
||||
{
|
||||
static int32_t frameCount = 0, lastFPS = 0, lastFrameTime = 0, cumulativeFrameDelay = 0;
|
||||
static int32_t minFPS = -1, maxFPS = 0;
|
||||
static uint32_t minGameUpdate = -1, maxGameUpdate = 0;
|
||||
static int32_t frameCount;
|
||||
static double cumulativeFrameDelay;
|
||||
static double lastFrameTime;
|
||||
static float lastFPS, minFPS = FLT_MAX, maxFPS;
|
||||
static double minGameUpdate = DBL_MAX, maxGameUpdate;
|
||||
|
||||
int32_t frameTime = timerGetTicks();
|
||||
int32_t frameDelay = frameTime - lastFrameTime;
|
||||
double frameTime = timerGetHiTicks();
|
||||
double frameDelay = frameTime - lastFrameTime;
|
||||
cumulativeFrameDelay += frameDelay;
|
||||
|
||||
if (frameDelay >= 0)
|
||||
|
@ -792,7 +794,7 @@ static void G_PrintFPS(void)
|
|||
|
||||
if (ud.showfps)
|
||||
{
|
||||
int32_t chars = Bsprintf(tempbuf, "%d ms (%3d fps)", frameDelay, lastFPS);
|
||||
int32_t chars = Bsprintf(tempbuf, "%.1f ms, %5.1f fps", frameDelay, lastFPS);
|
||||
|
||||
printext256(windowxy2.x-(chars<<(3-x))+1, windowxy1.y+2+FPS_YOFFSET, 0, -1, tempbuf, x);
|
||||
printext256(windowxy2.x-(chars<<(3-x)), windowxy1.y+1+FPS_YOFFSET,
|
||||
|
@ -800,13 +802,13 @@ static void G_PrintFPS(void)
|
|||
|
||||
if (ud.showfps > 1)
|
||||
{
|
||||
chars = Bsprintf(tempbuf, "max fps: %3d", maxFPS);
|
||||
chars = Bsprintf(tempbuf, "max: %5.1f fps", maxFPS);
|
||||
|
||||
printext256(windowxy2.x-(chars<<(3-x))+1, windowxy1.y+10+2+FPS_YOFFSET, 0, -1, tempbuf, x);
|
||||
printext256(windowxy2.x-(chars<<(3-x)), windowxy1.y+10+FPS_YOFFSET,
|
||||
FPS_COLOR(maxFPS < LOW_FPS), -1, tempbuf, x);
|
||||
|
||||
chars = Bsprintf(tempbuf, "min fps: %3d", minFPS);
|
||||
chars = Bsprintf(tempbuf, "min: %5.1f fps", minFPS);
|
||||
|
||||
printext256(windowxy2.x-(chars<<(3-x))+1, windowxy1.y+20+2+FPS_YOFFSET, 0, -1, tempbuf, x);
|
||||
printext256(windowxy2.x-(chars<<(3-x)), windowxy1.y+20+FPS_YOFFSET,
|
||||
|
@ -817,17 +819,29 @@ static void G_PrintFPS(void)
|
|||
if (g_gameUpdateTime > maxGameUpdate) maxGameUpdate = g_gameUpdateTime;
|
||||
if (g_gameUpdateTime < minGameUpdate) minGameUpdate = g_gameUpdateTime;
|
||||
|
||||
chars = Bsprintf(tempbuf, "Game Update: %2u ms GU & Draw: %2u ms", g_gameUpdateTime, g_gameUpdateAndDrawTime);
|
||||
chars = Bsprintf(tempbuf, "Game Update: %2.2f ms + draw: %2.2f ms", g_gameUpdateTime, g_gameUpdateAndDrawTime);
|
||||
|
||||
printext256(windowxy2.x-(chars<<(3-x))+1, windowxy1.y+30+2+FPS_YOFFSET, 0, -1, tempbuf, x);
|
||||
printext256(windowxy2.x-(chars<<(3-x)), windowxy1.y+30+FPS_YOFFSET,
|
||||
FPS_COLOR(g_gameUpdateAndDrawTime >= SLOW_FRAME_TIME), -1, tempbuf, x);
|
||||
|
||||
chars = Bsprintf(tempbuf, "Min GU: %2u ms Max GU: %2u ms Avg GU: %5.2f ms", minGameUpdate, maxGameUpdate, g_gameUpdateAvgTime);
|
||||
chars = Bsprintf(tempbuf, "GU min/max/avg: %5.2f/%5.2f/%5.2f ms", minGameUpdate, maxGameUpdate, g_gameUpdateAvgTime);
|
||||
|
||||
printext256(windowxy2.x-(chars<<(3-x))+1, windowxy1.y+40+2+FPS_YOFFSET, 0, -1, tempbuf, x);
|
||||
printext256(windowxy2.x-(chars<<(3-x)), windowxy1.y+40+FPS_YOFFSET,
|
||||
FPS_COLOR(maxGameUpdate >= SLOW_FRAME_TIME), -1, tempbuf, x);
|
||||
|
||||
chars = Bsprintf(tempbuf, "G_MoveActors(): %.3e ms", g_moveActorsTime);
|
||||
|
||||
printext256(windowxy2.x-(chars<<(3-x))+1, windowxy1.y+50+2+FPS_YOFFSET, 0, -1, tempbuf, x);
|
||||
printext256(windowxy2.x-(chars<<(3-x)), windowxy1.y+50+FPS_YOFFSET,
|
||||
COLOR_WHITE, -1, tempbuf, x);
|
||||
|
||||
chars = Bsprintf(tempbuf, "G_MoveWorld(): %.3e ms", g_moveWorldTime);
|
||||
|
||||
printext256(windowxy2.x-(chars<<(3-x))+1, windowxy1.y+60+2+FPS_YOFFSET, 0, -1, tempbuf, x);
|
||||
printext256(windowxy2.x-(chars<<(3-x)), windowxy1.y+60+FPS_YOFFSET,
|
||||
COLOR_WHITE, -1, tempbuf, x);
|
||||
}
|
||||
|
||||
// lag meter
|
||||
|
@ -841,24 +855,26 @@ static void G_PrintFPS(void)
|
|||
}
|
||||
}
|
||||
|
||||
if (cumulativeFrameDelay >= 1000)
|
||||
if (cumulativeFrameDelay >= 1000.0)
|
||||
{
|
||||
g_frameRate = lastFPS = tabledivide32_noinline(1000*frameCount, cumulativeFrameDelay);
|
||||
lastFPS = 1000.f * frameCount / cumulativeFrameDelay;
|
||||
g_frameRate = Blrintf(lastFPS);
|
||||
frameCount = 0;
|
||||
cumulativeFrameDelay = 0;
|
||||
cumulativeFrameDelay = 0.0;
|
||||
|
||||
if (ud.showfps > 1)
|
||||
{
|
||||
if (lastFPS > maxFPS) maxFPS = lastFPS;
|
||||
if ((unsigned) lastFPS < (unsigned) minFPS) minFPS = lastFPS;
|
||||
if (lastFPS < minFPS) minFPS = lastFPS;
|
||||
|
||||
static int secondCounter;
|
||||
|
||||
if (++secondCounter == 3)
|
||||
if (++secondCounter >= ud.frameperiod)
|
||||
{
|
||||
maxFPS = (lastFPS + maxFPS) >> 1;
|
||||
minFPS = (lastFPS + minFPS) >> 1;
|
||||
maxGameUpdate = (g_gameUpdateTime + maxGameUpdate) >> 1;
|
||||
minGameUpdate = (g_gameUpdateTime + minGameUpdate) >> 1;
|
||||
maxFPS = (lastFPS + maxFPS) * .5f;
|
||||
minFPS = (lastFPS + minFPS) * .5f;
|
||||
maxGameUpdate = (g_gameUpdateTime + maxGameUpdate) * 0.5;
|
||||
minGameUpdate = (g_gameUpdateTime + minGameUpdate) * 0.5;
|
||||
secondCounter = 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,10 +23,11 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
#ifndef sector_h_
|
||||
#define sector_h_
|
||||
|
||||
#include "gamevars.h"
|
||||
#include "actors.h" // actor_t
|
||||
#include "player.h" // playerspawn_t
|
||||
#include "gamevars.h"
|
||||
#include "macros.h"
|
||||
#include "namesdyn.h" // for G_GetForcefieldPicnum()
|
||||
#include "player.h" // playerspawn_t
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
|
|
@ -920,7 +920,7 @@ void S_Callback(intptr_t num)
|
|||
if (num == MUSIC_ID)
|
||||
return;
|
||||
|
||||
dq[dnum & (DQSIZE - 1)] = num;
|
||||
dq[dnum & (DQSIZE - 1)] = (uint32_t)num;
|
||||
dnum++;
|
||||
}
|
||||
|
||||
|
|
|
@ -20,19 +20,16 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
*/
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
#include "compat.h"
|
||||
|
||||
#include "gtkpixdata.h"
|
||||
|
||||
#include "dynamicgtk.h"
|
||||
|
||||
#include "duke3d.h"
|
||||
#include "grpscan.h"
|
||||
#include "build.h"
|
||||
|
||||
#include "game.h"
|
||||
#include "cmdline.h"
|
||||
#include "common.h"
|
||||
#include "common_game.h"
|
||||
#include "compat.h"
|
||||
#include "duke3d.h"
|
||||
#include "dynamicgtk.h"
|
||||
#include "game.h"
|
||||
#include "grpscan.h"
|
||||
#include "gtkpixdata.h"
|
||||
|
||||
enum
|
||||
{
|
||||
|
@ -105,15 +102,9 @@ static struct
|
|||
static struct
|
||||
{
|
||||
grpfile_t const * grp;
|
||||
int32_t fullscreen;
|
||||
#ifdef POLYMER
|
||||
int32_t polymer;
|
||||
#endif
|
||||
int32_t xdim3d, ydim3d, bpp3d;
|
||||
int32_t forcesetup;
|
||||
int32_t autoload;
|
||||
int32_t usemouse, usejoy;
|
||||
char *custommoddir;
|
||||
char *gamedir;
|
||||
ud_setup_t shared;
|
||||
int polymer;
|
||||
} settings;
|
||||
|
||||
static int32_t retval = -1, mode = TAB_MESSAGES;
|
||||
|
@ -133,14 +124,14 @@ static void on_vmode3dcombo_changed(GtkComboBox *combobox, gpointer user_data)
|
|||
if (!gtk_combo_box_get_active_iter(combobox, &iter)) return;
|
||||
if (!(data = gtk_combo_box_get_model(combobox))) return;
|
||||
gtk_tree_model_get(data, &iter, 1, &val, -1);
|
||||
settings.xdim3d = validmode[val].xdim;
|
||||
settings.ydim3d = validmode[val].ydim;
|
||||
settings.shared.xdim = validmode[val].xdim;
|
||||
settings.shared.ydim = validmode[val].ydim;
|
||||
}
|
||||
|
||||
static void on_fullscreencheck_toggled(GtkToggleButton *togglebutton, gpointer user_data)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(user_data);
|
||||
settings.fullscreen = gtk_toggle_button_get_active(togglebutton);
|
||||
settings.shared.fullscreen = gtk_toggle_button_get_active(togglebutton);
|
||||
PopulateForm(POPULATE_VIDEO);
|
||||
}
|
||||
|
||||
|
@ -152,9 +143,9 @@ static void on_polymercheck_toggled(GtkToggleButton *togglebutton, gpointer user
|
|||
{
|
||||
glrendmode = REND_POLYMER;
|
||||
settings.polymer = TRUE;
|
||||
if (settings.bpp3d == 8)
|
||||
if (settings.shared.bpp == 8)
|
||||
{
|
||||
settings.bpp3d = 32;
|
||||
settings.shared.bpp = 32;
|
||||
PopulateForm(POPULATE_VIDEO);
|
||||
}
|
||||
}
|
||||
|
@ -171,10 +162,10 @@ static void on_inputdevcombo_changed(GtkComboBox *combobox, gpointer user_data)
|
|||
UNREFERENCED_PARAMETER(user_data);
|
||||
switch (gtk_combo_box_get_active(combobox))
|
||||
{
|
||||
case 0: settings.usemouse = 0; settings.usejoy = 0; break;
|
||||
case 1: settings.usemouse = 1; settings.usejoy = 0; break;
|
||||
case 2: settings.usemouse = 0; settings.usejoy = 1; break;
|
||||
case 3: settings.usemouse = 1; settings.usejoy = 1; break;
|
||||
case 0: settings.shared.usemouse = 0; settings.shared.usejoystick = 0; break;
|
||||
case 1: settings.shared.usemouse = 1; settings.shared.usejoystick = 0; break;
|
||||
case 2: settings.shared.usemouse = 0; settings.shared.usejoystick = 1; break;
|
||||
case 3: settings.shared.usemouse = 1; settings.shared.usejoystick = 1; break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -193,21 +184,21 @@ static void on_custommodcombo_changed(GtkComboBox *combobox, gpointer user_data)
|
|||
path = gtk_tree_model_get_path(model, &iter);
|
||||
|
||||
if (*gtk_tree_path_get_indices(path) == NONE)
|
||||
settings.custommoddir = NULL;
|
||||
else settings.custommoddir = value;
|
||||
settings.gamedir = NULL;
|
||||
else settings.gamedir = value;
|
||||
}
|
||||
}
|
||||
|
||||
static void on_autoloadcheck_toggled(GtkToggleButton *togglebutton, gpointer user_data)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(user_data);
|
||||
settings.autoload = gtk_toggle_button_get_active(togglebutton);
|
||||
settings.shared.noautoload = !gtk_toggle_button_get_active(togglebutton);
|
||||
}
|
||||
|
||||
static void on_alwaysshowcheck_toggled(GtkToggleButton *togglebutton, gpointer user_data)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(user_data);
|
||||
settings.forcesetup = gtk_toggle_button_get_active(togglebutton);
|
||||
settings.shared.forcesetup = gtk_toggle_button_get_active(togglebutton);
|
||||
}
|
||||
|
||||
static void on_cancelbutton_clicked(GtkButton *button, gpointer user_data)
|
||||
|
@ -316,17 +307,17 @@ static void PopulateForm(unsigned char pgs)
|
|||
GtkTreeIter iter;
|
||||
char buf[64];
|
||||
|
||||
mode3d = videoCheckMode(&settings.xdim3d, &settings.ydim3d, settings.bpp3d, settings.fullscreen, 1);
|
||||
mode3d = videoCheckMode(&settings.shared.xdim, &settings.shared.ydim, settings.shared.bpp, settings.shared.fullscreen, 1);
|
||||
if (mode3d < 0)
|
||||
{
|
||||
int32_t i, cd[] = { 32, 24, 16, 15, 8, 0 };
|
||||
|
||||
for (i=0; cd[i];) { if (cd[i] >= settings.bpp3d) i++; else break; }
|
||||
for (i=0; cd[i];) { if (cd[i] >= settings.shared.bpp) i++; else break; }
|
||||
for (; cd[i]; i++)
|
||||
{
|
||||
mode3d = videoCheckMode(&settings.xdim3d, &settings.ydim3d, cd[i], settings.fullscreen, 1);
|
||||
mode3d = videoCheckMode(&settings.shared.xdim, &settings.shared.ydim, cd[i], settings.shared.fullscreen, 1);
|
||||
if (mode3d < 0) continue;
|
||||
settings.bpp3d = cd[i];
|
||||
settings.shared.bpp = cd[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -336,7 +327,7 @@ static void PopulateForm(unsigned char pgs)
|
|||
|
||||
for (i=0; i<validmodecnt; i++)
|
||||
{
|
||||
if (validmode[i].fs != settings.fullscreen) continue;
|
||||
if (validmode[i].fs != settings.shared.fullscreen) continue;
|
||||
|
||||
// all modes get added to the 3D mode list
|
||||
Bsprintf(buf, "%dx%d %s", validmode[i].xdim, validmode[i].ydim, validmode[i].bpp == 8 ? "software" : "OpenGL");
|
||||
|
@ -375,14 +366,14 @@ static void PopulateForm(unsigned char pgs)
|
|||
gtk_list_store_append(devlist, &iter);
|
||||
gtk_list_store_set(devlist, &iter, 0,availabledev[i], -1);
|
||||
}
|
||||
switch (settings.usemouse)
|
||||
switch (settings.shared.usemouse)
|
||||
{
|
||||
case 0: if (settings.usejoy)
|
||||
case 0: if (settings.shared.usejoystick)
|
||||
gtk_combo_box_set_active(GTK_COMBO_BOX(stwidgets.inputdevcombo), INPUT_JOYSTICK);
|
||||
else
|
||||
gtk_combo_box_set_active(GTK_COMBO_BOX(stwidgets.inputdevcombo), INPUT_KB);
|
||||
break;
|
||||
case 1: if (settings.usejoy)
|
||||
case 1: if (settings.shared.usejoystick)
|
||||
gtk_combo_box_set_active(GTK_COMBO_BOX(stwidgets.inputdevcombo), INPUT_ALL);
|
||||
else
|
||||
gtk_combo_box_set_active(GTK_COMBO_BOX(stwidgets.inputdevcombo), INPUT_MOUSE);
|
||||
|
@ -403,14 +394,14 @@ static void PopulateForm(unsigned char pgs)
|
|||
gtk_tree_model_get_iter(GTK_TREE_MODEL(modsdir), &iter, path);
|
||||
gtk_tree_model_get(GTK_TREE_MODEL(modsdir), &iter, 0,&value, -1);
|
||||
|
||||
if (Bstrcmp(settings.custommoddir, "/") == 0)
|
||||
if (Bstrcmp(settings.gamedir, "/") == 0)
|
||||
{
|
||||
gtk_combo_box_set_active(GTK_COMBO_BOX(stwidgets.custommodcombo), NONE);
|
||||
settings.custommoddir = NULL;
|
||||
settings.gamedir = NULL;
|
||||
|
||||
break;
|
||||
}
|
||||
if (Bstrcmp(settings.custommoddir, value) == 0)
|
||||
if (Bstrcmp(settings.gamedir, value) == 0)
|
||||
{
|
||||
gtk_combo_box_set_active_iter(GTK_COMBO_BOX(stwidgets.custommodcombo),
|
||||
&iter);
|
||||
|
@ -420,12 +411,12 @@ static void PopulateForm(unsigned char pgs)
|
|||
}
|
||||
|
||||
// populate check buttons
|
||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(stwidgets.fullscreencheck), settings.fullscreen);
|
||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(stwidgets.fullscreencheck), settings.shared.fullscreen);
|
||||
#ifdef POLYMER
|
||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(stwidgets.polymercheck), settings.polymer);
|
||||
#endif
|
||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(stwidgets.autoloadcheck), settings.autoload);
|
||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(stwidgets.alwaysshowcheck), settings.forcesetup);
|
||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(stwidgets.autoloadcheck), !settings.shared.noautoload);
|
||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(stwidgets.alwaysshowcheck), settings.shared.forcesetup);
|
||||
}
|
||||
|
||||
if ((pgs == ALL) || (pgs == POPULATE_GAME))
|
||||
|
@ -867,23 +858,13 @@ int32_t startwin_run(void)
|
|||
|
||||
SetPage(TAB_CONFIG);
|
||||
|
||||
settings.xdim3d = ud.config.ScreenWidth;
|
||||
settings.ydim3d = ud.config.ScreenHeight;
|
||||
settings.bpp3d = ud.config.ScreenBPP;
|
||||
settings.fullscreen = ud.config.ScreenMode;
|
||||
settings.usemouse = ud.config.UseMouse;
|
||||
settings.usejoy = ud.config.UseJoystick;
|
||||
settings.custommoddir = g_modDir;
|
||||
settings.forcesetup = ud.config.ForceSetup;
|
||||
settings.shared = ud.setup;
|
||||
settings.gamedir = g_modDir;
|
||||
settings.grp = g_selectedGrp;
|
||||
if (ud.config.NoAutoLoad) settings.autoload = FALSE;
|
||||
else settings.autoload = TRUE;
|
||||
#ifdef POLYMER
|
||||
if (glrendmode == REND_POLYMER)
|
||||
{
|
||||
if (settings.bpp3d == 8) settings.bpp3d = 32;
|
||||
settings.polymer = TRUE;
|
||||
}
|
||||
settings.polymer = (glrendmode == REND_POLYMER);
|
||||
#else
|
||||
settings.polymer = 0;
|
||||
#endif
|
||||
PopulateForm(ALL);
|
||||
|
||||
|
@ -892,21 +873,11 @@ int32_t startwin_run(void)
|
|||
SetPage(TAB_MESSAGES);
|
||||
if (retval) // launch the game with these parameters
|
||||
{
|
||||
ud.config.ScreenWidth = settings.xdim3d;
|
||||
ud.config.ScreenHeight = settings.ydim3d;
|
||||
ud.config.ScreenBPP = settings.bpp3d;
|
||||
ud.config.ScreenMode = settings.fullscreen;
|
||||
ud.config.UseMouse = settings.usemouse;
|
||||
ud.config.UseJoystick = settings.usejoy;
|
||||
ud.config.ForceSetup = settings.forcesetup;
|
||||
ud.setup = settings.shared;
|
||||
glrendmode = (settings.polymer) ? REND_POLYMER : REND_POLYMOST;
|
||||
g_selectedGrp = settings.grp;
|
||||
|
||||
if (settings.custommoddir != NULL)
|
||||
Bstrcpy(g_modDir, settings.custommoddir);
|
||||
else Bsprintf(g_modDir, "/");
|
||||
|
||||
if (settings.autoload) ud.config.NoAutoLoad = FALSE;
|
||||
else ud.config.NoAutoLoad = TRUE;
|
||||
Bstrcpy(g_modDir, (g_noSetup == 0 && settings.gamedir != NULL) ? settings.gamedir : "/");
|
||||
}
|
||||
|
||||
return retval;
|
||||
|
|
|
@ -24,59 +24,47 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
#error Only for Windows
|
||||
#endif
|
||||
|
||||
#include "compat.h"
|
||||
|
||||
#define NEED_WINDOWSX_H
|
||||
#define NEED_COMMCTRL_H
|
||||
#include "windows_inc.h"
|
||||
|
||||
#include "renderlayer.h"
|
||||
|
||||
#ifdef STARTUP_SETUP_WINDOW
|
||||
|
||||
#define NEED_WINDOWSX_H
|
||||
#define NEED_COMMCTRL_H
|
||||
#define ONLY_USERDEFS
|
||||
|
||||
#include "_control.h"
|
||||
#include "build.h"
|
||||
#include "cache1d.h"
|
||||
|
||||
#include "grpscan.h"
|
||||
|
||||
#include "startwin.game.h"
|
||||
|
||||
// for ud
|
||||
#include "keyboard.h"
|
||||
#include "control.h"
|
||||
#include "_control.h"
|
||||
#include "function.h"
|
||||
#include "inv.h"
|
||||
#include "namesdyn.h"
|
||||
#define ONLY_USERDEFS
|
||||
#include "game.h"
|
||||
|
||||
#include "common_game.h"
|
||||
#include "cmdline.h"
|
||||
#include "common_game.h"
|
||||
#include "compat.h"
|
||||
#include "control.h"
|
||||
#include "function.h"
|
||||
#include "game.h"
|
||||
#include "grpscan.h"
|
||||
#include "inv.h"
|
||||
#include "keyboard.h"
|
||||
#include "startwin.game.h"
|
||||
#include "windows_inc.h"
|
||||
|
||||
#define TAB_CONFIG 0
|
||||
// #define TAB_GAME 1
|
||||
#define TAB_MESSAGES 1
|
||||
|
||||
static struct
|
||||
{
|
||||
struct grpfile_t const * grp;
|
||||
int32_t flags; // bitfield
|
||||
int32_t xdim, ydim, bpp;
|
||||
int32_t forcesetup;
|
||||
int32_t usemouse, usejoy;
|
||||
char *gamedir;
|
||||
ud_setup_t shared;
|
||||
int polymer;
|
||||
}
|
||||
settings;
|
||||
|
||||
static HWND startupdlg = NULL;
|
||||
static HWND pages[3] =
|
||||
{
|
||||
NULL, NULL, NULL
|
||||
};
|
||||
static int32_t done = -1, mode = TAB_CONFIG;
|
||||
static HWND startupdlg;
|
||||
static HWND pages[3];
|
||||
static int done = -1;
|
||||
static int mode = TAB_CONFIG;
|
||||
|
||||
static CACHE1D_FIND_REC *finddirs=NULL;
|
||||
static CACHE1D_FIND_REC *finddirs;
|
||||
|
||||
static inline void clearfilenames(void)
|
||||
{
|
||||
|
@ -84,11 +72,10 @@ static inline void clearfilenames(void)
|
|||
finddirs = NULL;
|
||||
}
|
||||
|
||||
static inline int32_t getfilenames(char const *path)
|
||||
static inline void getfilenames(char const *path)
|
||||
{
|
||||
clearfilenames();
|
||||
finddirs = klistpath(path,"*",CACHE1D_FIND_DIR);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define POPULATE_VIDEO 1
|
||||
|
@ -109,22 +96,19 @@ const char *controlstrings[] = { "Keyboard only", "Keyboard and mouse", "Keyboar
|
|||
|
||||
static void PopulateForm(int32_t pgs)
|
||||
{
|
||||
HWND hwnd;
|
||||
char buf[512];
|
||||
int32_t i,j;
|
||||
|
||||
if (pgs & POPULATE_GAMEDIRS)
|
||||
{
|
||||
CACHE1D_FIND_REC *dirs = NULL;
|
||||
|
||||
hwnd = GetDlgItem(pages[TAB_CONFIG], IDCGAMEDIR);
|
||||
HWND hwnd = GetDlgItem(pages[TAB_CONFIG], IDCGAMEDIR);
|
||||
|
||||
getfilenames("/");
|
||||
(void)ComboBox_ResetContent(hwnd);
|
||||
j = ComboBox_AddString(hwnd, "None");
|
||||
(void)ComboBox_SetItemData(hwnd, j, 0);
|
||||
(void)ComboBox_SetCurSel(hwnd, j);
|
||||
for (dirs=finddirs,i=1,j=1; dirs != NULL; dirs=dirs->next)
|
||||
int const r = ComboBox_AddString(hwnd, "None");
|
||||
(void)ComboBox_SetItemData(hwnd, r, 0);
|
||||
(void)ComboBox_SetCurSel(hwnd, r);
|
||||
auto dirs = finddirs;
|
||||
for (int i=1, j=1; dirs != NULL; dirs=dirs->next)
|
||||
{
|
||||
if (Bstrcasecmp(dirs->name, "autoload") == 0)
|
||||
{
|
||||
|
@ -134,7 +118,7 @@ static void PopulateForm(int32_t pgs)
|
|||
|
||||
(void)ComboBox_AddString(hwnd, dirs->name);
|
||||
(void)ComboBox_SetItemData(hwnd, i, j);
|
||||
if (Bstrcasecmp(dirs->name,settings.gamedir) == 0)
|
||||
if (Bstrcasecmp(dirs->name, settings.gamedir) == 0)
|
||||
(void)ComboBox_SetCurSel(hwnd, i);
|
||||
|
||||
i++;
|
||||
|
@ -144,41 +128,41 @@ static void PopulateForm(int32_t pgs)
|
|||
|
||||
if (pgs & POPULATE_VIDEO)
|
||||
{
|
||||
int32_t mode;
|
||||
HWND hwnd = GetDlgItem(pages[TAB_CONFIG], IDCVMODE);
|
||||
int mode = videoCheckMode(&settings.shared.xdim, &settings.shared.ydim, settings.shared.bpp, settings.shared.fullscreen, 1);
|
||||
|
||||
hwnd = GetDlgItem(pages[TAB_CONFIG], IDCVMODE);
|
||||
|
||||
mode = videoCheckMode(&settings.xdim, &settings.ydim, settings.bpp, settings.flags&1, 1);
|
||||
if (mode < 0 || (settings.bpp < 15 && (settings.flags & 2)))
|
||||
if (mode < 0 || (settings.shared.bpp < 15 && (settings.polymer)))
|
||||
{
|
||||
int32_t cd[] = { 32, 24, 16, 15, 8, 0 };
|
||||
int CONSTEXPR cd[] = { 32, 24, 16, 15, 8, 0 };
|
||||
int i;
|
||||
|
||||
for (i=0; cd[i];)
|
||||
{
|
||||
if (cd[i] >= settings.bpp) i++;
|
||||
if (cd[i] >= settings.shared.bpp) i++;
|
||||
else break;
|
||||
}
|
||||
for (; cd[i]; i++)
|
||||
{
|
||||
mode = videoCheckMode(&settings.xdim, &settings.ydim, cd[i], settings.flags&1, 1);
|
||||
mode = videoCheckMode(&settings.shared.xdim, &settings.shared.ydim, cd[i], settings.shared.fullscreen, 1);
|
||||
if (mode < 0) continue;
|
||||
settings.bpp = cd[i];
|
||||
settings.shared.bpp = cd[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Button_SetCheck(GetDlgItem(pages[TAB_CONFIG], IDCFULLSCREEN), ((settings.flags&1) ? BST_CHECKED : BST_UNCHECKED));
|
||||
Button_SetCheck(GetDlgItem(pages[TAB_CONFIG], IDCPOLYMER), ((settings.flags&2) ? BST_CHECKED : BST_UNCHECKED));
|
||||
Button_SetCheck(GetDlgItem(pages[TAB_CONFIG], IDCFULLSCREEN), ((settings.shared.fullscreen) ? BST_CHECKED : BST_UNCHECKED));
|
||||
Button_SetCheck(GetDlgItem(pages[TAB_CONFIG], IDCPOLYMER), ((settings.polymer) ? BST_CHECKED : BST_UNCHECKED));
|
||||
|
||||
(void)ComboBox_ResetContent(hwnd);
|
||||
|
||||
for (i=0; i<validmodecnt; i++)
|
||||
for (int i=0; i<validmodecnt; i++)
|
||||
{
|
||||
if (validmode[i].fs != (settings.flags & 1)) continue;
|
||||
if ((validmode[i].bpp < 15) && (settings.flags & 2)) continue;
|
||||
if (validmode[i].fs != (settings.shared.fullscreen)) continue;
|
||||
if ((validmode[i].bpp < 15) && (settings.polymer)) continue;
|
||||
|
||||
// all modes get added to the 3D mode list
|
||||
Bsprintf(buf, "%dx%d %s", validmode[i].xdim, validmode[i].ydim, validmode[i].bpp == 8 ? "software" : "OpenGL");
|
||||
j = ComboBox_AddString(hwnd, buf);
|
||||
int const j = ComboBox_AddString(hwnd, buf);
|
||||
(void)ComboBox_SetItemData(hwnd, j, i);
|
||||
if (i == mode)(void)ComboBox_SetCurSel(hwnd, j);
|
||||
}
|
||||
|
@ -186,21 +170,21 @@ static void PopulateForm(int32_t pgs)
|
|||
|
||||
if (pgs & POPULATE_CONFIG)
|
||||
{
|
||||
Button_SetCheck(GetDlgItem(pages[TAB_CONFIG], IDCALWAYSSHOW), (settings.forcesetup ? BST_CHECKED : BST_UNCHECKED));
|
||||
Button_SetCheck(GetDlgItem(pages[TAB_CONFIG], IDCAUTOLOAD), (!(settings.flags & 4) ? BST_CHECKED : BST_UNCHECKED));
|
||||
Button_SetCheck(GetDlgItem(pages[TAB_CONFIG], IDCALWAYSSHOW), (settings.shared.forcesetup ? BST_CHECKED : BST_UNCHECKED));
|
||||
Button_SetCheck(GetDlgItem(pages[TAB_CONFIG], IDCAUTOLOAD), (!(settings.shared.noautoload) ? BST_CHECKED : BST_UNCHECKED));
|
||||
|
||||
hwnd = GetDlgItem(pages[TAB_CONFIG], IDCINPUT);
|
||||
HWND hwnd = GetDlgItem(pages[TAB_CONFIG], IDCINPUT);
|
||||
|
||||
(void)ComboBox_ResetContent(hwnd);
|
||||
(void)ComboBox_SetCurSel(hwnd, 0);
|
||||
|
||||
j = 4;
|
||||
int j = 4;
|
||||
|
||||
#ifdef RENDERTYPEWIN
|
||||
if (di_disabled) j = 2;
|
||||
#endif
|
||||
|
||||
for (i=0; i<j; i++)
|
||||
for (int i=0; i<j; i++)
|
||||
{
|
||||
(void)ComboBox_InsertString(hwnd, i, controlstrings[i]);
|
||||
(void)ComboBox_SetItemData(hwnd, i, i);
|
||||
|
@ -208,13 +192,13 @@ static void PopulateForm(int32_t pgs)
|
|||
switch (i)
|
||||
{
|
||||
case INPUT_MOUSE:
|
||||
if (settings.usemouse && !settings.usejoy)(void)ComboBox_SetCurSel(hwnd, i);
|
||||
if (settings.shared.usemouse && !settings.shared.usejoystick)(void)ComboBox_SetCurSel(hwnd, i);
|
||||
break;
|
||||
case INPUT_JOYSTICK:
|
||||
if (!settings.usemouse && settings.usejoy)(void)ComboBox_SetCurSel(hwnd, i);
|
||||
if (!settings.shared.usemouse && settings.shared.usejoystick)(void)ComboBox_SetCurSel(hwnd, i);
|
||||
break;
|
||||
case INPUT_ALL:
|
||||
if (settings.usemouse && settings.usejoy)(void)ComboBox_SetCurSel(hwnd, i);
|
||||
if (settings.shared.usemouse && settings.shared.usejoystick)(void)ComboBox_SetCurSel(hwnd, i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -222,20 +206,15 @@ static void PopulateForm(int32_t pgs)
|
|||
|
||||
if (pgs & POPULATE_GAME)
|
||||
{
|
||||
int32_t j;
|
||||
char buf[1024];
|
||||
HWND hwnd = GetDlgItem(pages[TAB_CONFIG], IDCDATA);
|
||||
|
||||
hwnd = GetDlgItem(pages[TAB_CONFIG], IDCDATA);
|
||||
|
||||
for (grpfile_t const * fg = foundgrps; fg; fg=fg->next)
|
||||
for (auto fg = foundgrps; fg; fg=fg->next)
|
||||
{
|
||||
Bsprintf(buf, "%s\t%s", fg->type->name, fg->filename);
|
||||
j = ListBox_AddString(hwnd, buf);
|
||||
int const j = ListBox_AddString(hwnd, buf);
|
||||
(void)ListBox_SetItemData(hwnd, j, (LPARAM)fg);
|
||||
if (settings.grp == fg)
|
||||
{
|
||||
(void)ListBox_SetCurSel(hwnd, j);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -248,61 +227,55 @@ static INT_PTR CALLBACK ConfigPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L
|
|||
switch (LOWORD(wParam))
|
||||
{
|
||||
case IDCFULLSCREEN:
|
||||
if (settings.flags & 1) settings.flags &= ~1;
|
||||
else settings.flags |= 1;
|
||||
settings.shared.fullscreen = !settings.shared.fullscreen;
|
||||
PopulateForm(POPULATE_VIDEO);
|
||||
return TRUE;
|
||||
case IDCPOLYMER:
|
||||
if (settings.flags & 2) settings.flags &= ~2;
|
||||
else settings.flags |= 2;
|
||||
if (settings.bpp == 8) settings.bpp = 32;
|
||||
settings.polymer = !settings.polymer;
|
||||
if (settings.shared.bpp == 8) settings.shared.bpp = 32;
|
||||
PopulateForm(POPULATE_VIDEO);
|
||||
return TRUE;
|
||||
case IDCVMODE:
|
||||
if (HIWORD(wParam) == CBN_SELCHANGE)
|
||||
{
|
||||
int32_t i;
|
||||
i = ComboBox_GetCurSel((HWND)lParam);
|
||||
int i = ComboBox_GetCurSel((HWND)lParam);
|
||||
if (i != CB_ERR) i = ComboBox_GetItemData((HWND)lParam, i);
|
||||
if (i != CB_ERR)
|
||||
{
|
||||
settings.xdim = validmode[i].xdim;
|
||||
settings.ydim = validmode[i].ydim;
|
||||
settings.bpp = validmode[i].bpp;
|
||||
settings.shared.xdim = validmode[i].xdim;
|
||||
settings.shared.ydim = validmode[i].ydim;
|
||||
settings.shared.bpp = validmode[i].bpp;
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
case IDCALWAYSSHOW:
|
||||
settings.forcesetup = IsDlgButtonChecked(hwndDlg, IDCALWAYSSHOW) == BST_CHECKED;
|
||||
settings.shared.forcesetup = IsDlgButtonChecked(hwndDlg, IDCALWAYSSHOW) == BST_CHECKED;
|
||||
return TRUE;
|
||||
case IDCAUTOLOAD:
|
||||
if (IsDlgButtonChecked(hwndDlg, IDCAUTOLOAD) == BST_CHECKED)
|
||||
settings.flags &= ~4;
|
||||
else settings.flags |= 4;
|
||||
settings.shared.noautoload = (IsDlgButtonChecked(hwndDlg, IDCAUTOLOAD) != BST_CHECKED);
|
||||
return TRUE;
|
||||
case IDCINPUT:
|
||||
if (HIWORD(wParam) == CBN_SELCHANGE)
|
||||
{
|
||||
int32_t i;
|
||||
i = ComboBox_GetCurSel((HWND)lParam);
|
||||
int i = ComboBox_GetCurSel((HWND)lParam);
|
||||
if (i != CB_ERR) i = ComboBox_GetItemData((HWND)lParam, i);
|
||||
if (i != CB_ERR)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case INPUT_KB:
|
||||
settings.usemouse = settings.usejoy = 0;
|
||||
settings.shared.usemouse = settings.shared.usejoystick = 0;
|
||||
break;
|
||||
case INPUT_MOUSE:
|
||||
settings.usemouse = 1;
|
||||
settings.usejoy = 0;
|
||||
settings.shared.usemouse = 1;
|
||||
settings.shared.usejoystick = 0;
|
||||
break;
|
||||
case INPUT_JOYSTICK:
|
||||
settings.usemouse = 0;
|
||||
settings.usejoy = 1;
|
||||
settings.shared.usemouse = 0;
|
||||
settings.shared.usejoystick = 1;
|
||||
break;
|
||||
case INPUT_ALL:
|
||||
settings.usemouse = settings.usejoy = 1;
|
||||
settings.shared.usemouse = settings.shared.usejoystick = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -312,9 +285,7 @@ static INT_PTR CALLBACK ConfigPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L
|
|||
case IDCGAMEDIR:
|
||||
if (HIWORD(wParam) == CBN_SELCHANGE)
|
||||
{
|
||||
int32_t i,j;
|
||||
CACHE1D_FIND_REC *dir = NULL;
|
||||
i = ComboBox_GetCurSel((HWND)lParam);
|
||||
int i = ComboBox_GetCurSel((HWND)lParam);
|
||||
if (i != CB_ERR) i = ComboBox_GetItemData((HWND)lParam, i);
|
||||
if (i != CB_ERR)
|
||||
{
|
||||
|
@ -322,21 +293,23 @@ static INT_PTR CALLBACK ConfigPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L
|
|||
settings.gamedir = NULL;
|
||||
else
|
||||
{
|
||||
for (j=1,dir=finddirs; dir != NULL; dir=dir->next,j++)
|
||||
CACHE1D_FIND_REC *dir = finddirs;
|
||||
for (int j = 1; dir != NULL; dir = dir->next, j++)
|
||||
{
|
||||
if (j == i)
|
||||
{
|
||||
settings.gamedir = dir->name;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
case IDCDATA:
|
||||
{
|
||||
intptr_t i;
|
||||
if (HIWORD(wParam) != LBN_SELCHANGE) break;
|
||||
i = ListBox_GetCurSel((HWND)lParam);
|
||||
intptr_t i = ListBox_GetCurSel((HWND)lParam);
|
||||
if (i != CB_ERR) i = ListBox_GetItemData((HWND)lParam, i);
|
||||
if (i != CB_ERR)
|
||||
{
|
||||
|
@ -355,53 +328,43 @@ static INT_PTR CALLBACK ConfigPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L
|
|||
}
|
||||
|
||||
|
||||
static void SetPage(int32_t n)
|
||||
static void SetPage(int pageNum)
|
||||
{
|
||||
HWND tab;
|
||||
int32_t cur;
|
||||
tab = GetDlgItem(startupdlg, WIN_STARTWIN_TABCTL);
|
||||
cur = (int32_t)SendMessage(tab, TCM_GETCURSEL,0,0);
|
||||
ShowWindow(pages[cur],SW_HIDE);
|
||||
SendMessage(tab, TCM_SETCURSEL, n, 0);
|
||||
ShowWindow(pages[n],SW_SHOW);
|
||||
mode = n;
|
||||
HWND tab = GetDlgItem(startupdlg, WIN_STARTWIN_TABCTL);
|
||||
auto const cur = SendMessage(tab, TCM_GETCURSEL, 0, 0);
|
||||
ShowWindow(pages[cur], SW_HIDE);
|
||||
SendMessage(tab, TCM_SETCURSEL, pageNum, 0);
|
||||
ShowWindow(pages[pageNum], SW_SHOW);
|
||||
mode = pageNum;
|
||||
|
||||
SetFocus(GetDlgItem(startupdlg, WIN_STARTWIN_TABCTL));
|
||||
}
|
||||
|
||||
static void EnableConfig(int32_t n)
|
||||
static void EnableConfig(bool n)
|
||||
{
|
||||
//EnableWindow(GetDlgItem(startupdlg, WIN_STARTWIN_CANCEL), n);
|
||||
EnableWindow(GetDlgItem(startupdlg, WIN_STARTWIN_START), n);
|
||||
EnableWindow(GetDlgItem(pages[TAB_CONFIG], IDCDATA), n);
|
||||
EnableWindow(GetDlgItem(pages[TAB_CONFIG], IDCFULLSCREEN), n);
|
||||
EnableWindow(GetDlgItem(pages[TAB_CONFIG], IDCGAMEDIR), n);
|
||||
EnableWindow(GetDlgItem(pages[TAB_CONFIG], IDCINPUT), n);
|
||||
EnableWindow(GetDlgItem(pages[TAB_CONFIG], IDCPOLYMER), n);
|
||||
EnableWindow(GetDlgItem(pages[TAB_CONFIG], IDCVMODE), n);
|
||||
EnableWindow(GetDlgItem(pages[TAB_CONFIG], IDCINPUT), n);
|
||||
|
||||
EnableWindow(GetDlgItem(pages[TAB_CONFIG], IDCDATA), n);
|
||||
EnableWindow(GetDlgItem(pages[TAB_CONFIG], IDCGAMEDIR), n);
|
||||
}
|
||||
|
||||
static INT_PTR CALLBACK startup_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
static HBITMAP hbmp = NULL;
|
||||
HDC hdc;
|
||||
|
||||
switch (uMsg)
|
||||
{
|
||||
case WM_INITDIALOG:
|
||||
{
|
||||
HWND hwnd;
|
||||
RECT r, rdlg, chrome, rtab, rcancel, rstart;
|
||||
int32_t xoffset = 0, yoffset = 0;
|
||||
|
||||
// Fetch the positions (in screen coordinates) of all the windows we need to tweak
|
||||
ZeroMemory(&chrome, sizeof(chrome));
|
||||
RECT chrome = {};
|
||||
AdjustWindowRect(&chrome, GetWindowLong(hwndDlg, GWL_STYLE), FALSE);
|
||||
RECT rdlg;
|
||||
GetWindowRect(hwndDlg, &rdlg);
|
||||
GetWindowRect(GetDlgItem(hwndDlg, WIN_STARTWIN_TABCTL), &rtab);
|
||||
GetWindowRect(GetDlgItem(hwndDlg, WIN_STARTWIN_CANCEL), &rcancel);
|
||||
GetWindowRect(GetDlgItem(hwndDlg, WIN_STARTWIN_START), &rstart);
|
||||
|
||||
// Knock off the non-client area of the main dialogue to give just the client area
|
||||
rdlg.left -= chrome.left;
|
||||
|
@ -409,17 +372,26 @@ static INT_PTR CALLBACK startup_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam,
|
|||
rdlg.right -= chrome.right;
|
||||
rdlg.bottom -= chrome.bottom;
|
||||
|
||||
RECT rtab;
|
||||
GetWindowRect(GetDlgItem(hwndDlg, WIN_STARTWIN_TABCTL), &rtab);
|
||||
|
||||
// Translate them to client-relative coordinates wrt the main dialogue window
|
||||
rtab.right -= rtab.left - 1;
|
||||
rtab.bottom -= rtab.top - 1;
|
||||
rtab.left -= rdlg.left;
|
||||
rtab.top -= rdlg.top;
|
||||
|
||||
RECT rcancel;
|
||||
GetWindowRect(GetDlgItem(hwndDlg, WIN_STARTWIN_CANCEL), &rcancel);
|
||||
|
||||
rcancel.right -= rcancel.left - 1;
|
||||
rcancel.bottom -= rcancel.top - 1;
|
||||
rcancel.left -= rdlg.left;
|
||||
rcancel.top -= rdlg.top;
|
||||
|
||||
RECT rstart;
|
||||
GetWindowRect(GetDlgItem(hwndDlg, WIN_STARTWIN_START), &rstart);
|
||||
|
||||
rstart.right -= rstart.left - 1;
|
||||
rstart.bottom -= rstart.top - 1;
|
||||
rstart.left -= rdlg.left;
|
||||
|
@ -433,11 +405,15 @@ static INT_PTR CALLBACK startup_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam,
|
|||
|
||||
// Load the bitmap into the bitmap control and fetch its dimensions
|
||||
hbmp = LoadBitmap((HINSTANCE)win_gethinstance(), MAKEINTRESOURCE(RSRC_BMP));
|
||||
hwnd = GetDlgItem(hwndDlg,WIN_STARTWIN_BITMAP);
|
||||
|
||||
HWND hwnd = GetDlgItem(hwndDlg, WIN_STARTWIN_BITMAP);
|
||||
SendMessage(hwnd, STM_SETIMAGE, IMAGE_BITMAP, (LPARAM)hbmp);
|
||||
|
||||
RECT r;
|
||||
GetClientRect(hwnd, &r);
|
||||
xoffset = r.right;
|
||||
yoffset = r.bottom - rdlg.bottom;
|
||||
|
||||
int const xoffset = r.right;
|
||||
int const yoffset = r.bottom - rdlg.bottom;
|
||||
|
||||
// Shift and resize the controls that require it
|
||||
rtab.left += xoffset;
|
||||
|
@ -455,7 +431,7 @@ static INT_PTR CALLBACK startup_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam,
|
|||
MoveWindow(GetDlgItem(hwndDlg, WIN_STARTWIN_START), rstart.left, rstart.top, rstart.right, rstart.bottom, FALSE);
|
||||
|
||||
// Move the main dialogue to the centre of the screen
|
||||
hdc = GetDC(NULL);
|
||||
HDC hdc = GetDC(NULL);
|
||||
rdlg.left = (GetDeviceCaps(hdc, HORZRES) - rdlg.right) / 2;
|
||||
rdlg.top = (GetDeviceCaps(hdc, VERTRES) - rdlg.bottom) / 2;
|
||||
ReleaseDC(NULL, hdc);
|
||||
|
@ -464,17 +440,16 @@ static INT_PTR CALLBACK startup_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam,
|
|||
|
||||
// Add tabs to the tab control
|
||||
{
|
||||
TCITEM tab;
|
||||
static char textSetup[] = TEXT("Setup");
|
||||
static char textMessageLog[] = TEXT("Message Log");
|
||||
|
||||
hwnd = GetDlgItem(hwndDlg, WIN_STARTWIN_TABCTL);
|
||||
|
||||
ZeroMemory(&tab, sizeof(tab));
|
||||
TCITEM tab = {};
|
||||
tab.mask = TCIF_TEXT;
|
||||
static char textSetup[] = TEXT("Setup");
|
||||
tab.pszText = textSetup;
|
||||
SendMessage(hwnd, TCM_INSERTITEM, (WPARAM)TAB_CONFIG, (LPARAM)&tab);
|
||||
tab.mask = TCIF_TEXT;
|
||||
static char textMessageLog[] = TEXT("Message Log");
|
||||
tab.pszText = textMessageLog;
|
||||
SendMessage(hwnd, TCM_INSERTITEM, (WPARAM)TAB_MESSAGES, (LPARAM)&tab);
|
||||
|
||||
|
@ -488,14 +463,14 @@ static INT_PTR CALLBACK startup_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam,
|
|||
r.left += rtab.left;
|
||||
|
||||
// Create the pages and position them in the tab control, but hide them
|
||||
pages[TAB_CONFIG] = CreateDialog((HINSTANCE)win_gethinstance(),
|
||||
MAKEINTRESOURCE(WIN_STARTWINPAGE_CONFIG), hwndDlg, ConfigPageProc);
|
||||
pages[TAB_CONFIG] = CreateDialog((HINSTANCE)win_gethinstance(), MAKEINTRESOURCE(WIN_STARTWINPAGE_CONFIG), hwndDlg, ConfigPageProc);
|
||||
SetWindowPos(pages[TAB_CONFIG], hwnd, r.left, r.top, r.right, r.bottom, SWP_HIDEWINDOW);
|
||||
|
||||
pages[TAB_MESSAGES] = GetDlgItem(hwndDlg, WIN_STARTWIN_MESSAGES);
|
||||
SetWindowPos(pages[TAB_CONFIG], hwnd,r.left,r.top,r.right,r.bottom,SWP_HIDEWINDOW);
|
||||
SetWindowPos(pages[TAB_MESSAGES], hwnd,r.left,r.top,r.right,r.bottom,SWP_HIDEWINDOW);
|
||||
SetWindowPos(pages[TAB_MESSAGES], hwnd, r.left, r.top, r.right, r.bottom, SWP_HIDEWINDOW);
|
||||
|
||||
// Tell the editfield acting as the console to exclude the width of the scrollbar
|
||||
GetClientRect(pages[TAB_MESSAGES],&r);
|
||||
GetClientRect(pages[TAB_MESSAGES], &r);
|
||||
r.right -= GetSystemMetrics(SM_CXVSCROLL)+4;
|
||||
r.left = r.top = 0;
|
||||
SendMessage(pages[TAB_MESSAGES], EM_SETRECTNP,0,(LPARAM)&r);
|
||||
|
@ -514,24 +489,17 @@ static INT_PTR CALLBACK startup_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam,
|
|||
|
||||
case WM_NOTIFY:
|
||||
{
|
||||
LPNMHDR nmhdr = (LPNMHDR)lParam;
|
||||
int32_t cur;
|
||||
auto nmhdr = (LPNMHDR)lParam;
|
||||
if (nmhdr->idFrom != WIN_STARTWIN_TABCTL) break;
|
||||
cur = (int32_t)SendMessage(nmhdr->hwndFrom, TCM_GETCURSEL,0,0);
|
||||
int const cur = SendMessage(nmhdr->hwndFrom, TCM_GETCURSEL,0,0);
|
||||
switch (nmhdr->code)
|
||||
{
|
||||
case TCN_SELCHANGING:
|
||||
{
|
||||
if (cur < 0 || !pages[cur]) break;
|
||||
ShowWindow(pages[cur],SW_HIDE);
|
||||
return TRUE;
|
||||
}
|
||||
case TCN_SELCHANGE:
|
||||
{
|
||||
if (cur < 0 || !pages[cur]) break;
|
||||
ShowWindow(pages[cur],SW_SHOW);
|
||||
return TRUE;
|
||||
}
|
||||
case TCN_SELCHANGING:
|
||||
case TCN_SELCHANGE:
|
||||
if (cur < 0 || !pages[cur])
|
||||
break;
|
||||
ShowWindow(pages[cur], nmhdr->code == TCN_SELCHANGING ? SW_HIDE : SW_SHOW);
|
||||
return TRUE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -585,10 +553,8 @@ static INT_PTR CALLBACK startup_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam,
|
|||
|
||||
int32_t startwin_open(void)
|
||||
{
|
||||
INITCOMMONCONTROLSEX icc;
|
||||
if (startupdlg) return 1;
|
||||
icc.dwSize = sizeof(icc);
|
||||
icc.dwICC = ICC_TAB_CLASSES;
|
||||
INITCOMMONCONTROLSEX icc = { sizeof(icc), ICC_TAB_CLASSES };
|
||||
InitCommonControlsEx(&icc);
|
||||
startupdlg = CreateDialog((HINSTANCE)win_gethinstance(), MAKEINTRESOURCE(WIN_STARTWIN), NULL, startup_dlgproc);
|
||||
if (startupdlg)
|
||||
|
@ -610,43 +576,43 @@ int32_t startwin_close(void)
|
|||
|
||||
int32_t startwin_puts(const char *buf)
|
||||
{
|
||||
const char *p = NULL, *q = NULL;
|
||||
static char workbuf[1024];
|
||||
static int32_t newline = 0;
|
||||
int32_t curlen, linesbefore, linesafter;
|
||||
HWND edctl;
|
||||
int32_t vis;
|
||||
static HWND dactrl = NULL;
|
||||
|
||||
if (!startupdlg) return 1;
|
||||
|
||||
edctl = pages[TAB_MESSAGES];
|
||||
const HWND edctl = pages[TAB_MESSAGES];
|
||||
|
||||
if (!edctl) return -1;
|
||||
|
||||
static HWND dactrl = NULL;
|
||||
if (!dactrl) dactrl = GetDlgItem(startupdlg, WIN_STARTWIN_TABCTL);
|
||||
|
||||
vis = ((int32_t)SendMessage(dactrl, TCM_GETCURSEL,0,0) == TAB_MESSAGES);
|
||||
int const vis = ((int)SendMessage(dactrl, TCM_GETCURSEL,0,0) == TAB_MESSAGES);
|
||||
|
||||
if (vis) SendMessage(edctl, WM_SETREDRAW, FALSE,0);
|
||||
curlen = SendMessage(edctl, WM_GETTEXTLENGTH, 0,0);
|
||||
if (vis)
|
||||
SendMessage(edctl, WM_SETREDRAW, FALSE, 0);
|
||||
|
||||
int const curlen = SendMessage(edctl, WM_GETTEXTLENGTH, 0,0);
|
||||
SendMessage(edctl, EM_SETSEL, (WPARAM)curlen, (LPARAM)curlen);
|
||||
linesbefore = SendMessage(edctl, EM_GETLINECOUNT, 0,0);
|
||||
p = buf;
|
||||
|
||||
int const numlines = SendMessage(edctl, EM_GETLINECOUNT, 0, 0);
|
||||
static bool newline = false;
|
||||
const char *p = buf;
|
||||
|
||||
while (*p)
|
||||
{
|
||||
if (newline)
|
||||
{
|
||||
SendMessage(edctl, EM_REPLACESEL, 0, (LPARAM)"\r\n");
|
||||
newline = 0;
|
||||
newline = false;
|
||||
}
|
||||
q = p;
|
||||
const char *q = p;
|
||||
while (*q && *q != '\n') q++;
|
||||
static char workbuf[1024];
|
||||
Bmemcpy(workbuf, p, q-p);
|
||||
if (*q == '\n')
|
||||
{
|
||||
if (!q[1])
|
||||
{
|
||||
newline = 1;
|
||||
newline = true;
|
||||
workbuf[q-p] = 0;
|
||||
}
|
||||
else
|
||||
|
@ -664,9 +630,13 @@ int32_t startwin_puts(const char *buf)
|
|||
}
|
||||
SendMessage(edctl, EM_REPLACESEL, 0, (LPARAM)workbuf);
|
||||
}
|
||||
linesafter = SendMessage(edctl, EM_GETLINECOUNT, 0,0);
|
||||
SendMessage(edctl, EM_LINESCROLL, 0, linesafter-linesbefore);
|
||||
if (vis) SendMessage(edctl, WM_SETREDRAW, TRUE,0);
|
||||
|
||||
int const newnumlines = SendMessage(edctl, EM_GETLINECOUNT, 0, 0);
|
||||
SendMessage(edctl, EM_LINESCROLL, 0, newnumlines - numlines);
|
||||
|
||||
if (vis)
|
||||
SendMessage(edctl, WM_SETREDRAW, TRUE, 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -686,7 +656,6 @@ int32_t startwin_idle(void *v)
|
|||
|
||||
int32_t startwin_run(void)
|
||||
{
|
||||
MSG msg;
|
||||
if (!startupdlg) return 1;
|
||||
|
||||
done = -1;
|
||||
|
@ -694,24 +663,22 @@ int32_t startwin_run(void)
|
|||
SetPage(TAB_CONFIG);
|
||||
EnableConfig(1);
|
||||
|
||||
settings.flags = 0;
|
||||
if (ud.config.ScreenMode) settings.flags |= 1;
|
||||
#ifdef POLYMER
|
||||
if (glrendmode == REND_POLYMER) settings.flags |= 2;
|
||||
settings.polymer = (glrendmode == REND_POLYMER);
|
||||
#else
|
||||
settings.polymer = 0;
|
||||
#endif
|
||||
if (ud.config.NoAutoLoad) settings.flags |= 4;
|
||||
settings.xdim = ud.config.ScreenWidth;
|
||||
settings.ydim = ud.config.ScreenHeight;
|
||||
settings.bpp = ud.config.ScreenBPP;
|
||||
settings.forcesetup = ud.config.ForceSetup;
|
||||
settings.usemouse = ud.config.UseMouse;
|
||||
settings.usejoy = ud.config.UseJoystick;
|
||||
|
||||
settings.shared = ud.setup;
|
||||
settings.grp = g_selectedGrp;
|
||||
settings.gamedir = g_modDir;
|
||||
|
||||
PopulateForm(-1);
|
||||
|
||||
while (done < 0)
|
||||
do
|
||||
{
|
||||
MSG msg;
|
||||
|
||||
switch (GetMessage(&msg, NULL, 0,0))
|
||||
{
|
||||
case 0:
|
||||
|
@ -720,35 +687,24 @@ int32_t startwin_run(void)
|
|||
case -1:
|
||||
return -1;
|
||||
default:
|
||||
if (IsWindow(startupdlg) && IsDialogMessage(startupdlg, &msg)) break;
|
||||
if (IsWindow(startupdlg) && IsDialogMessage(startupdlg, &msg))
|
||||
break;
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
break;
|
||||
}
|
||||
}
|
||||
while (done < 0);
|
||||
|
||||
SetPage(TAB_MESSAGES);
|
||||
EnableConfig(0);
|
||||
|
||||
if (done)
|
||||
{
|
||||
ud.config.ScreenMode = (settings.flags&1);
|
||||
#ifdef POLYMER
|
||||
if (settings.flags & 2) glrendmode = REND_POLYMER;
|
||||
else glrendmode = REND_POLYMOST;
|
||||
#endif
|
||||
if (settings.flags & 4) ud.config.NoAutoLoad = 1;
|
||||
else ud.config.NoAutoLoad = 0;
|
||||
ud.config.ScreenWidth = settings.xdim;
|
||||
ud.config.ScreenHeight = settings.ydim;
|
||||
ud.config.ScreenBPP = settings.bpp;
|
||||
ud.config.ForceSetup = settings.forcesetup;
|
||||
ud.config.UseMouse = settings.usemouse;
|
||||
ud.config.UseJoystick = settings.usejoy;
|
||||
ud.setup = settings.shared;
|
||||
glrendmode = (settings.polymer) ? REND_POLYMER : REND_POLYMOST;
|
||||
g_selectedGrp = settings.grp;
|
||||
|
||||
if (g_noSetup == 0 && settings.gamedir != NULL)
|
||||
Bstrcpy(g_modDir,settings.gamedir);
|
||||
else Bsprintf(g_modDir,"/");
|
||||
Bstrcpy(g_modDir, (g_noSetup == 0 && settings.gamedir != NULL) ? settings.gamedir : "/");
|
||||
}
|
||||
|
||||
return done;
|
||||
|
|
Loading…
Reference in a new issue