mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-24 02:30:46 +00:00
- making more things compile.
This commit is contained in:
parent
6280b0b516
commit
40772d9f0c
50 changed files with 402 additions and 2116 deletions
|
@ -408,12 +408,19 @@ FStringCVar* const CombatMacros[] = { &combatmacro0, &combatmacro1, &combatmacro
|
|||
void CONFIG_ReadCombatMacros()
|
||||
{
|
||||
FScanner sc;
|
||||
sc.Open("demolition/combatmacros.txt");
|
||||
for (auto s : CombatMacros)
|
||||
try
|
||||
{
|
||||
sc.MustGetToken(TK_StringConst);
|
||||
if (strlen(*s) == 0)
|
||||
*s = sc.String;
|
||||
sc.Open("demolition/combatmacros.txt");
|
||||
for (auto s : CombatMacros)
|
||||
{
|
||||
sc.MustGetToken(TK_StringConst);
|
||||
if (strlen(*s) == 0)
|
||||
*s = sc.String;
|
||||
}
|
||||
}
|
||||
catch (const std::runtime_error &)
|
||||
{
|
||||
// We do not want this to error out. Just ignore if it fails.
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -119,7 +119,10 @@ enum
|
|||
GAMEFLAG_RRRA = 0x00000200,
|
||||
GAMEFLAG_BLOOD = 0x00000400,
|
||||
GAMEFLAG_SW = 0x00000800,
|
||||
GAMEFLAG_STANDALONE = 0x00001000,
|
||||
GAMEFLAG_POWERSLAVE = 0x00001000,
|
||||
GAMEFLAG_EXHUMED = 0x00002000,
|
||||
GAMEFLAG_PSEXHUMED = 0x00003000, // the two games really are the same, except for the name and the publisher.
|
||||
GAMEFLAG_STANDALONE = 0x00004000,
|
||||
GAMEFLAGMASK = 0x00000FFF, // flags allowed from grpinfo
|
||||
|
||||
};
|
||||
|
|
|
@ -267,7 +267,7 @@ static void D_AddDirectory (TArray<FString> &wadfiles, const char *dir)
|
|||
{
|
||||
skindir[stuffstart++] = '/';
|
||||
int savedstart = stuffstart;
|
||||
const char* validexts[] = { "*.grp", "*.zip", "*.pk3", "*.pk4", "*.7z", "*.pk7" };
|
||||
const char* validexts[] = { "*.grp", "*.zip", "*.pk3", "*.pk4", "*.7z", "*.pk7", "*.dat" };
|
||||
for (auto ext : validexts)
|
||||
{
|
||||
stuffstart = savedstart;
|
||||
|
|
|
@ -1061,6 +1061,9 @@ const char* G_DefaultDefFile(void)
|
|||
if (g_gameType & GAMEFLAG_SW)
|
||||
return "sw.def";
|
||||
|
||||
if (g_gameType & GAMEFLAG_PSEXHUMED)
|
||||
return "exhumed.def";
|
||||
|
||||
if (g_gameType & GAMEFLAG_NAM)
|
||||
return fileSystem.FindFile("nam.def") ? "nam.def" : "napalm.def";
|
||||
|
||||
|
|
|
@ -40,6 +40,7 @@ enum
|
|||
void I_Error(const char *fmt, ...) ATTRIBUTE((format(printf,1,2)));
|
||||
|
||||
int PrintString (int iprintlevel, const char *outline);
|
||||
int VPrintf(int printlevel, const char* format, va_list parms);
|
||||
int Printf (int printlevel, const char *format, ...) ATTRIBUTE((format(printf,2,3)));
|
||||
int Printf (const char *format, ...) ATTRIBUTE((format(printf,1,2)));
|
||||
int DPrintf (int level, const char *format, ...) ATTRIBUTE((format(printf,2,3)));
|
||||
|
|
|
@ -51,7 +51,6 @@ set( PCH_SOURCES
|
|||
src/exscript.cpp
|
||||
src/fish.cpp
|
||||
src/grenade.cpp
|
||||
src/grpscan.cpp
|
||||
src/gun.cpp
|
||||
src/init.cpp
|
||||
src/input.cpp
|
||||
|
|
|
@ -269,7 +269,7 @@ loc_2D755:
|
|||
|
||||
default:
|
||||
{
|
||||
DebugOut("unknown msg %x for anim\n", a & 0x7F0000);
|
||||
Printf("unknown msg %x for anim\n", a & 0x7F0000);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -483,7 +483,7 @@ void FuncAnubis(int a, int nDamage, int nRun)
|
|||
}
|
||||
default:
|
||||
{
|
||||
DebugOut("unknown msg %d for Anubis\n", a & 0x7F0000);
|
||||
Printf("unknown msg %d for Anubis\n", a & 0x7F0000);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -194,7 +194,7 @@ void FuncBubble(int a, int b, int nRun)
|
|||
return;
|
||||
|
||||
default:
|
||||
DebugOut("unknown msg %d for Bubble\n", nMessage);
|
||||
Printf("unknown msg %d for Bubble\n", nMessage);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -218,7 +218,7 @@ void DoBubbleMachines()
|
|||
void BuildBubbleMachine(int nSprite)
|
||||
{
|
||||
if (nMachineCount >= kMaxMachines) {
|
||||
bail2dos("too many bubble machines in level %d\n", levelnew);
|
||||
I_Error("too many bubble machines in level %d\n", levelnew);
|
||||
}
|
||||
|
||||
Machine[nMachineCount]._4 = 75;
|
||||
|
|
|
@ -845,7 +845,7 @@ void FuncBullet(int a, int b, int nRun)
|
|||
|
||||
default:
|
||||
{
|
||||
DebugOut("unknown msg %x for bullet\n", a & 0x7F0000);
|
||||
Printf("unknown msg %x for bullet\n", a & 0x7F0000);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,7 +15,6 @@ along with this program; if not, write to the Free Software
|
|||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
//-------------------------------------------------------------------------
|
||||
#if 0
|
||||
|
||||
#include "ns.h"
|
||||
#include "compat.h"
|
||||
|
@ -27,7 +26,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
#include "control.h"
|
||||
#include "exhumed.h"
|
||||
#include "typedefs.h"
|
||||
#include "scriplib.h"
|
||||
|
||||
#include "config.h"
|
||||
|
||||
|
@ -38,167 +36,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
|
||||
BEGIN_PS_NS
|
||||
|
||||
const char gamefunctions[kMaxGameFunctions][kMaxGameFuncLen] =
|
||||
{
|
||||
"Move_Forward",
|
||||
"Move_Backward",
|
||||
"Turn_Left",
|
||||
"Turn_Right",
|
||||
"Strafe",
|
||||
"Strafe_Left",
|
||||
"Strafe_Right",
|
||||
"Run",
|
||||
"Jump",
|
||||
"Crouch",
|
||||
"Fire",
|
||||
"Open",
|
||||
"Look_Up",
|
||||
"Look_Down",
|
||||
"Look_Straight",
|
||||
"Aim_Up",
|
||||
"Aim_Down",
|
||||
"SendMessage",
|
||||
"Weapon_1",
|
||||
"Weapon_2",
|
||||
"Weapon_3",
|
||||
"Weapon_4",
|
||||
"Weapon_5",
|
||||
"Weapon_6",
|
||||
"Weapon_7",
|
||||
"Mouseview",
|
||||
"Pause",
|
||||
"Map",
|
||||
"Zoom_In",
|
||||
"Zoom_Out",
|
||||
"Gamma_Correction",
|
||||
"Escape",
|
||||
"Shrink_Screen",
|
||||
"Enlarge_Screen",
|
||||
"Inventory",
|
||||
"Inventory_Left",
|
||||
"Inventory_Right",
|
||||
"Mouse_Sensitivity_Up",
|
||||
"Mouse_Sensitivity_Down",
|
||||
"Show_Console",
|
||||
};
|
||||
|
||||
const char keydefaults[kMaxGameFunctions * 2][kMaxGameFuncLen] =
|
||||
{
|
||||
"W", "Kpad8",
|
||||
"S", "Kpad2",
|
||||
"Left", "Kpad4",
|
||||
"Right", "KPad6",
|
||||
"LAlt", "RAlt",
|
||||
"A", "",
|
||||
"D", "",
|
||||
"LShift", "RShift",
|
||||
"Space", "",
|
||||
"LCtrl", "",
|
||||
"RCtrl", "",
|
||||
"E", "",
|
||||
"PgUp", "",
|
||||
"PgDn", "",
|
||||
"Home", "",
|
||||
"Insert", "",
|
||||
"Delete", "",
|
||||
"T", "",
|
||||
"1", "",
|
||||
"2", "",
|
||||
"3", "",
|
||||
"4", "",
|
||||
"5", "",
|
||||
"6", "",
|
||||
"7", "",
|
||||
"/", "",
|
||||
"Pause", "",
|
||||
"Tab", "",
|
||||
"=", "",
|
||||
"-", "",
|
||||
"F11", "",
|
||||
"Escape", "",
|
||||
"Kpad-", "",
|
||||
"Kpad+", "",
|
||||
"Enter", "",
|
||||
"[", "",
|
||||
"]", "",
|
||||
"F7", "",
|
||||
"F8", "",
|
||||
"`", "",
|
||||
};
|
||||
|
||||
const char oldkeydefaults[kMaxGameFunctions * 2][kMaxGameFuncLen] =
|
||||
{
|
||||
"Up", "Kpad8",
|
||||
"Down", "Kpad2",
|
||||
"Left", "Kpad4",
|
||||
"Right", "KPad6",
|
||||
"LAlt", "RAlt",
|
||||
",", "",
|
||||
".", "",
|
||||
"LShift", "RShift",
|
||||
"A", "",
|
||||
"Z", "",
|
||||
"LCtrl", "RCtrl",
|
||||
"Space", "",
|
||||
"PgUp", "",
|
||||
"PgDn", "",
|
||||
"Home", "",
|
||||
"Insert", "",
|
||||
"Delete", "",
|
||||
"T", "",
|
||||
"1", "",
|
||||
"2", "",
|
||||
"3", "",
|
||||
"4", "",
|
||||
"5", "",
|
||||
"6", "",
|
||||
"7", "",
|
||||
"/", "",
|
||||
"Pause", "",
|
||||
"Tab", "",
|
||||
"=", "",
|
||||
"-", "",
|
||||
"F11", "",
|
||||
"Escape", "",
|
||||
"Kpad-", "",
|
||||
"Kpad+", "",
|
||||
"Enter", "",
|
||||
"[", "",
|
||||
"]", "",
|
||||
"F7", "",
|
||||
"F8", "",
|
||||
"`", "",
|
||||
};
|
||||
|
||||
static const char *mousedefaults[MAXMOUSEBUTTONS] =
|
||||
{
|
||||
"Fire",
|
||||
"Strafe",
|
||||
"Move_Forward"
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
};
|
||||
|
||||
static const char *mouseclickeddefaults[MAXMOUSEBUTTONS] =
|
||||
{
|
||||
};
|
||||
|
||||
static const char* mouseanalogdefaults[MAXMOUSEAXES] =
|
||||
{
|
||||
"analog_strafing",
|
||||
"analog_moving",
|
||||
};
|
||||
|
||||
|
||||
static const char* mousedigitaldefaults[MAXMOUSEDIGITAL] =
|
||||
{
|
||||
};
|
||||
|
||||
ud_setup_t gSetup;
|
||||
|
||||
char setupfilename[128] = {kSetupFilename};
|
||||
|
||||
int lMouseSens = 32;
|
||||
unsigned int dword_1B82E0 = 0;
|
||||
|
||||
|
@ -221,199 +62,6 @@ int32_t useprecache;
|
|||
int32_t MouseDeadZone, MouseBias;
|
||||
int32_t SmoothInput;
|
||||
|
||||
// JBF 20031211: Store the input settings because
|
||||
// (currently) mact can't regurgitate them
|
||||
int32_t MouseFunctions[MAXMOUSEBUTTONS][2];
|
||||
int32_t MouseDigitalFunctions[MAXMOUSEAXES][2];
|
||||
int32_t MouseAnalogueAxes[MAXMOUSEAXES];
|
||||
int32_t MouseAnalogueScale[MAXMOUSEAXES];
|
||||
int32_t JoystickFunctions[MAXJOYBUTTONSANDHATS][2];
|
||||
int32_t JoystickDigitalFunctions[MAXJOYAXES][2];
|
||||
int32_t JoystickAnalogueAxes[MAXJOYAXES];
|
||||
int32_t JoystickAnalogueScale[MAXJOYAXES];
|
||||
int32_t JoystickAnalogueInvert[MAXJOYAXES];
|
||||
int32_t JoystickAnalogueDead[MAXJOYAXES];
|
||||
int32_t JoystickAnalogueSaturate[MAXJOYAXES];
|
||||
uint8_t KeyboardKeys[kMaxGameFunctions][2];
|
||||
|
||||
int32_t MAXCACHE1DSIZE = (96*1024*1024);
|
||||
|
||||
|
||||
void SetupGameButtons()
|
||||
{
|
||||
CONTROL_DefineFlag(gamefunc_Move_Forward, kFalse);
|
||||
CONTROL_DefineFlag(gamefunc_Move_Backward, kFalse);
|
||||
CONTROL_DefineFlag(gamefunc_Turn_Left, kFalse);
|
||||
CONTROL_DefineFlag(gamefunc_Turn_Right, kFalse);
|
||||
CONTROL_DefineFlag(gamefunc_Strafe, kFalse);
|
||||
CONTROL_DefineFlag(gamefunc_Strafe_Left, kFalse);
|
||||
CONTROL_DefineFlag(gamefunc_Strafe_Right, kFalse);
|
||||
CONTROL_DefineFlag(gamefunc_Jump, kFalse);
|
||||
CONTROL_DefineFlag(gamefunc_Crouch, kFalse);
|
||||
CONTROL_DefineFlag(gamefunc_Fire, kFalse);
|
||||
CONTROL_DefineFlag(gamefunc_Open, kFalse);
|
||||
CONTROL_DefineFlag(gamefunc_Aim_Up, kFalse);
|
||||
CONTROL_DefineFlag(gamefunc_Aim_Down, kFalse);
|
||||
CONTROL_DefineFlag(gamefunc_Look_Up, kFalse);
|
||||
CONTROL_DefineFlag(gamefunc_Look_Down, kFalse);
|
||||
CONTROL_DefineFlag(gamefunc_Look_Straight, kFalse);
|
||||
CONTROL_DefineFlag(gamefunc_Run, kFalse);
|
||||
CONTROL_DefineFlag(gamefunc_SendMessage, kFalse);
|
||||
CONTROL_DefineFlag(gamefunc_Weapon_1, kFalse);
|
||||
CONTROL_DefineFlag(gamefunc_Weapon_2, kFalse);
|
||||
CONTROL_DefineFlag(gamefunc_Weapon_3, kFalse);
|
||||
CONTROL_DefineFlag(gamefunc_Weapon_4, kFalse);
|
||||
CONTROL_DefineFlag(gamefunc_Weapon_5, kFalse);
|
||||
CONTROL_DefineFlag(gamefunc_Weapon_6, kFalse);
|
||||
CONTROL_DefineFlag(gamefunc_Weapon_7, kFalse);
|
||||
CONTROL_DefineFlag(gamefunc_Map, kFalse);
|
||||
CONTROL_DefineFlag(gamefunc_Escape, kFalse);
|
||||
CONTROL_DefineFlag(gamefunc_Shrink_Screen, kFalse);
|
||||
CONTROL_DefineFlag(gamefunc_Enlarge_Screen, kFalse);
|
||||
CONTROL_DefineFlag(gamefunc_Zoom_In, kFalse);
|
||||
CONTROL_DefineFlag(gamefunc_Zoom_Out, kFalse);
|
||||
CONTROL_DefineFlag(gamefunc_Inventory_Left, kFalse);
|
||||
CONTROL_DefineFlag(gamefunc_Inventory_Right, kFalse);
|
||||
CONTROL_DefineFlag(gamefunc_Mouseview, kFalse);
|
||||
CONTROL_DefineFlag(gamefunc_Inventory, kFalse);
|
||||
}
|
||||
|
||||
hashtable_t h_gamefuncs = { kMaxGameFunctions<<1, NULL };
|
||||
|
||||
int32_t CONFIG_FunctionNameToNum(const char *func)
|
||||
{
|
||||
if (!func)
|
||||
return -1;
|
||||
|
||||
return hash_findcase(&h_gamefuncs, func);
|
||||
}
|
||||
|
||||
|
||||
static char const * CONFIG_FunctionNumToName(int32_t func)
|
||||
{
|
||||
if ((unsigned)func >= (unsigned)kMaxGameFunctions)
|
||||
return "";
|
||||
return gamefunctions[func];
|
||||
}
|
||||
|
||||
|
||||
int32_t CONFIG_AnalogNameToNum(const char *func)
|
||||
{
|
||||
if (!func)
|
||||
return -1;
|
||||
else if (!Bstrcasecmp(func, "analog_turning"))
|
||||
return analog_turning;
|
||||
else if (!Bstrcasecmp(func, "analog_strafing"))
|
||||
return analog_strafing;
|
||||
else if (!Bstrcasecmp(func, "analog_moving"))
|
||||
return analog_moving;
|
||||
else if (!Bstrcasecmp(func, "analog_lookingupanddown"))
|
||||
return analog_lookingupanddown;
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
static char const * CONFIG_AnalogNumToName(int32_t func)
|
||||
{
|
||||
switch (func)
|
||||
{
|
||||
case analog_turning:
|
||||
return "analog_turning";
|
||||
case analog_strafing:
|
||||
return "analog_strafing";
|
||||
case analog_moving:
|
||||
return "analog_moving";
|
||||
case analog_lookingupanddown:
|
||||
return "analog_lookingupanddown";
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
static void CONFIG_SetJoystickButtonFunction(int i, int j, int function)
|
||||
{
|
||||
JoystickFunctions[i][j] = function;
|
||||
CONTROL_MapButton(function, i, j, controldevice_joystick);
|
||||
}
|
||||
static void CONFIG_SetJoystickAnalogAxisScale(int i, int scale)
|
||||
{
|
||||
JoystickAnalogueScale[i] = scale;
|
||||
CONTROL_SetAnalogAxisScale(i, scale, controldevice_joystick);
|
||||
}
|
||||
static void CONFIG_SetJoystickAnalogAxisInvert(int i, int invert)
|
||||
{
|
||||
JoystickAnalogueInvert[i] = invert;
|
||||
CONTROL_SetAnalogAxisInvert(i, invert, controldevice_joystick);
|
||||
}
|
||||
static void CONFIG_SetJoystickAnalogAxisDeadSaturate(int i, int dead, int saturate)
|
||||
{
|
||||
JoystickAnalogueDead[i] = dead;
|
||||
JoystickAnalogueSaturate[i] = saturate;
|
||||
joySetDeadZone(i, dead, saturate);
|
||||
}
|
||||
static void CONFIG_SetJoystickDigitalAxisFunction(int i, int j, int function)
|
||||
{
|
||||
JoystickDigitalFunctions[i][j] = function;
|
||||
CONTROL_MapDigitalAxis(i, function, j, controldevice_joystick);
|
||||
}
|
||||
static void CONFIG_SetJoystickAnalogAxisFunction(int i, int function)
|
||||
{
|
||||
JoystickAnalogueAxes[i] = function;
|
||||
CONTROL_MapAnalogAxis(i, function, controldevice_joystick);
|
||||
}
|
||||
|
||||
|
||||
void CONFIG_SetDefaultKeys(const char (*keyptr)[kMaxGameFuncLen], bool lazy/*=false*/)
|
||||
{
|
||||
static char const s_gamefunc_[] = "gamefunc_";
|
||||
int constexpr strlen_gamefunc_ = ARRAY_SIZE(s_gamefunc_) - 1;
|
||||
|
||||
if (!lazy)
|
||||
{
|
||||
Bmemset(KeyboardKeys, 0xff, sizeof(KeyboardKeys));
|
||||
CONTROL_ClearAllBinds();
|
||||
}
|
||||
|
||||
for (int i=0; i < ARRAY_SSIZE(gamefunctions); ++i)
|
||||
{
|
||||
if (gamefunctions[i][0] == '\0')
|
||||
continue;
|
||||
|
||||
auto &key = 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(key[0]);
|
||||
else
|
||||
CONFIG_MapKey(i, key[0], 0, key[1], 0);
|
||||
}
|
||||
}
|
||||
|
||||
void CONFIG_SetDefaults()
|
||||
{
|
||||
scripthandle = -1;
|
||||
|
@ -437,12 +85,6 @@ void CONFIG_SetDefaults()
|
|||
gSetup.ydim = 768;
|
||||
}
|
||||
|
||||
#ifdef USE_OPENGL
|
||||
gSetup.bpp = 32;
|
||||
#else
|
||||
gSetup.bpp = 8;
|
||||
#endif
|
||||
|
||||
// currently settings.cfg is only read after the startup window launches the game,
|
||||
// and rereading binds might be fickle so just enable this
|
||||
gSetup.usejoystick = 1;
|
||||
|
@ -465,556 +107,18 @@ void CONFIG_SetDefaults()
|
|||
runkey_mode = 0;
|
||||
auto_run = 1;
|
||||
|
||||
CONFIG_SetDefaultKeys(keydefaults);
|
||||
|
||||
memset(MouseFunctions, -1, sizeof(MouseFunctions));
|
||||
memset(MouseDigitalFunctions, -1, sizeof(MouseDigitalFunctions));
|
||||
memset(JoystickFunctions, -1, sizeof(JoystickFunctions));
|
||||
memset(JoystickDigitalFunctions, -1, sizeof(JoystickDigitalFunctions));
|
||||
|
||||
CONTROL_MouseSensitivity = DEFAULTMOUSESENSITIVITY;
|
||||
|
||||
for (int i=0; i<MAXMOUSEBUTTONS; i++)
|
||||
{
|
||||
MouseFunctions[i][0] = CONFIG_FunctionNameToNum(mousedefaults[i]);
|
||||
CONTROL_MapButton(MouseFunctions[i][0], i, 0, controldevice_mouse);
|
||||
if (i>=4) continue;
|
||||
MouseFunctions[i][1] = CONFIG_FunctionNameToNum(mouseclickeddefaults[i]);
|
||||
CONTROL_MapButton(MouseFunctions[i][1], i, 1, controldevice_mouse);
|
||||
}
|
||||
|
||||
for (int i=0; i<MAXMOUSEAXES; i++)
|
||||
{
|
||||
MouseAnalogueScale[i] = DEFAULTMOUSEANALOGUESCALE;
|
||||
CONTROL_SetAnalogAxisScale(i, MouseAnalogueScale[i], controldevice_mouse);
|
||||
|
||||
MouseDigitalFunctions[i][0] = CONFIG_FunctionNameToNum(mousedigitaldefaults[i*2]);
|
||||
MouseDigitalFunctions[i][1] = CONFIG_FunctionNameToNum(mousedigitaldefaults[i*2+1]);
|
||||
CONTROL_MapDigitalAxis(i, MouseDigitalFunctions[i][0], 0, controldevice_mouse);
|
||||
CONTROL_MapDigitalAxis(i, MouseDigitalFunctions[i][1], 1, controldevice_mouse);
|
||||
|
||||
MouseAnalogueAxes[i] = CONFIG_AnalogNameToNum(mouseanalogdefaults[i]);
|
||||
CONTROL_MapAnalogAxis(i, MouseAnalogueAxes[i], controldevice_mouse);
|
||||
}
|
||||
|
||||
// TODO:
|
||||
//CONFIG_SetGameControllerDefaultsStandard();
|
||||
|
||||
#if 0
|
||||
FXVolume = 128;
|
||||
MusicVolume = 128;
|
||||
ReverseStereo = 0;
|
||||
ControllerType = controltype_keyboardandmouse;
|
||||
lMouseSens = 8;
|
||||
#endif
|
||||
}
|
||||
|
||||
int CONFIG_ReadSetup()
|
||||
int CONFIG_ReadSetup(void)
|
||||
{
|
||||
char tempbuf[1024];
|
||||
|
||||
CONTROL_ClearAssignments();
|
||||
CONFIG_SetDefaults();
|
||||
|
||||
setupread = 1;
|
||||
pathsearchmode = 1;
|
||||
|
||||
if (scripthandle < 0)
|
||||
{
|
||||
if (buildvfs_exists(setupfilename)) // JBF 20031211
|
||||
scripthandle = SCRIPT_Load(setupfilename);
|
||||
else if (buildvfs_exists(kSetupFilename))
|
||||
{
|
||||
int const i = wm_ynbox("Import Configuration Settings",
|
||||
"The configuration file \"%s\" was not found. "
|
||||
"Import configuration data from \"%s\"?",
|
||||
setupfilename, kSetupFilename);
|
||||
if (i)
|
||||
scripthandle = SCRIPT_Load(kSetupFilename);
|
||||
}
|
||||
}
|
||||
|
||||
pathsearchmode = 0;
|
||||
|
||||
if (scripthandle < 0)
|
||||
return -1;
|
||||
|
||||
SCRIPT_GetNumber(scripthandle, "Setup", "ForceSetup", &gSetup.forcesetup);
|
||||
SCRIPT_GetNumber(scripthandle, "Setup", "NoAutoLoad", &gSetup.noautoload);
|
||||
|
||||
int32_t cachesize;
|
||||
SCRIPT_GetNumber(scripthandle, "Setup", "CacheSize", &cachesize);
|
||||
|
||||
if (cachesize > MAXCACHE1DSIZE)
|
||||
MAXCACHE1DSIZE = cachesize;
|
||||
|
||||
|
||||
if (g_noSetup == 0 && g_modDir[0] == '/')
|
||||
{
|
||||
SCRIPT_GetString(scripthandle, "Setup","ModDir",&g_modDir[0]);
|
||||
|
||||
if (!buildvfs_isdir(g_modDir))
|
||||
{
|
||||
initprintf("Invalid mod dir in cfg!\n");
|
||||
Bsprintf(g_modDir,"/");
|
||||
}
|
||||
}
|
||||
|
||||
windowx = -1;
|
||||
windowy = -1;
|
||||
|
||||
SCRIPT_GetNumber(scripthandle, "Screen Setup", "MaxRefreshFreq", (int32_t *)&maxrefreshfreq);
|
||||
SCRIPT_GetNumber(scripthandle, "Screen Setup", "ScreenBPP", &gSetup.bpp);
|
||||
SCRIPT_GetNumber(scripthandle, "Screen Setup", "ScreenHeight", &gSetup.ydim);
|
||||
SCRIPT_GetNumber(scripthandle, "Screen Setup", "ScreenMode", &gSetup.fullscreen);
|
||||
SCRIPT_GetNumber(scripthandle, "Screen Setup", "ScreenWidth", &gSetup.xdim);
|
||||
SCRIPT_GetNumber(scripthandle, "Screen Setup", "WindowPosX", (int32_t *)&windowx);
|
||||
SCRIPT_GetNumber(scripthandle, "Screen Setup", "WindowPosY", (int32_t *)&windowy);
|
||||
SCRIPT_GetNumber(scripthandle, "Screen Setup", "WindowPositioning", (int32_t *)&windowpos);
|
||||
|
||||
if (gSetup.bpp < 8) gSetup.bpp = 32;
|
||||
|
||||
setupread = 1;
|
||||
return 0;
|
||||
CONFIG_SetDefaults();
|
||||
if (ScreenBPP < 8) ScreenBPP = 32;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// wrapper for CONTROL_MapKey(), generates key bindings to reflect changes to keyboard setup
|
||||
void CONFIG_MapKey(int which, kb_scancode key1, kb_scancode oldkey1, kb_scancode key2, kb_scancode oldkey2)
|
||||
{
|
||||
char tempbuf[256];
|
||||
int const keys[] = { key1, key2, oldkey1, oldkey2 };
|
||||
char buf[2*kMaxGameFuncLen];
|
||||
|
||||
if (which == gamefunc_Show_Console)
|
||||
OSD_CaptureKey(key1);
|
||||
|
||||
for (int k = 0; (unsigned)k < ARRAY_SIZE(keys); k++)
|
||||
{
|
||||
if (keys[k] == 0xff || !keys[k])
|
||||
continue;
|
||||
|
||||
int match = 0;
|
||||
|
||||
for (; match < ARRAY_SSIZE(sctokeylut); ++match)
|
||||
{
|
||||
if (keys[k] == sctokeylut[match].sc)
|
||||
break;
|
||||
}
|
||||
|
||||
tempbuf[0] = 0;
|
||||
|
||||
for (int i=kMaxGameFunctions-1; i>=0; i--)
|
||||
{
|
||||
if (KeyboardKeys[i][0] == keys[k] || KeyboardKeys[i][1] == keys[k])
|
||||
{
|
||||
Bsprintf(buf, "gamefunc_%s; ", CONFIG_FunctionNumToName(i));
|
||||
Bstrcat(tempbuf,buf);
|
||||
}
|
||||
}
|
||||
|
||||
int const len = Bstrlen(tempbuf);
|
||||
|
||||
if (len >= 2)
|
||||
{
|
||||
tempbuf[len-2] = 0; // cut off the trailing "; "
|
||||
CONTROL_BindKey(keys[k], tempbuf, 1, sctokeylut[match].key ? sctokeylut[match].key : "<?>");
|
||||
}
|
||||
else
|
||||
{
|
||||
CONTROL_FreeKeyBind(keys[k]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CONFIG_SetupMouse(void)
|
||||
{
|
||||
if (scripthandle < 0)
|
||||
return;
|
||||
|
||||
char str[80];
|
||||
char temp[80];
|
||||
|
||||
for (int i=0; i<MAXMOUSEBUTTONS; i++)
|
||||
{
|
||||
Bsprintf(str,"MouseButton%d",i);
|
||||
temp[0] = 0;
|
||||
if (!SCRIPT_GetString(scripthandle,"Controls", str,temp))
|
||||
MouseFunctions[i][0] = CONFIG_FunctionNameToNum(temp);
|
||||
|
||||
Bsprintf(str,"MouseButtonClicked%d",i);
|
||||
temp[0] = 0;
|
||||
if (!SCRIPT_GetString(scripthandle,"Controls", str,temp))
|
||||
MouseFunctions[i][1] = CONFIG_FunctionNameToNum(temp);
|
||||
}
|
||||
|
||||
// map over the axes
|
||||
for (int i=0; i<MAXMOUSEAXES; i++)
|
||||
{
|
||||
Bsprintf(str,"MouseAnalogAxes%d",i);
|
||||
temp[0] = 0;
|
||||
if (!SCRIPT_GetString(scripthandle, "Controls", str,temp))
|
||||
MouseAnalogueAxes[i] = CONFIG_AnalogNameToNum(temp);
|
||||
|
||||
Bsprintf(str,"MouseDigitalAxes%d_0",i);
|
||||
temp[0] = 0;
|
||||
if (!SCRIPT_GetString(scripthandle, "Controls", str,temp))
|
||||
MouseDigitalFunctions[i][0] = CONFIG_FunctionNameToNum(temp);
|
||||
|
||||
Bsprintf(str,"MouseDigitalAxes%d_1",i);
|
||||
temp[0] = 0;
|
||||
if (!SCRIPT_GetString(scripthandle, "Controls", str,temp))
|
||||
MouseDigitalFunctions[i][1] = CONFIG_FunctionNameToNum(temp);
|
||||
|
||||
Bsprintf(str,"MouseAnalogScale%d",i);
|
||||
int32_t scale = MouseAnalogueScale[i];
|
||||
SCRIPT_GetNumber(scripthandle, "Controls", str, &scale);
|
||||
MouseAnalogueScale[i] = scale;
|
||||
}
|
||||
|
||||
for (int i=0; i<MAXMOUSEBUTTONS; i++)
|
||||
{
|
||||
CONTROL_MapButton(MouseFunctions[i][0], i, 0, controldevice_mouse);
|
||||
CONTROL_MapButton(MouseFunctions[i][1], i, 1, controldevice_mouse);
|
||||
}
|
||||
for (int i=0; i<MAXMOUSEAXES; i++)
|
||||
{
|
||||
CONTROL_MapAnalogAxis(i, MouseAnalogueAxes[i], controldevice_mouse);
|
||||
CONTROL_MapDigitalAxis(i, MouseDigitalFunctions[i][0], 0,controldevice_mouse);
|
||||
CONTROL_MapDigitalAxis(i, MouseDigitalFunctions[i][1], 1,controldevice_mouse);
|
||||
CONTROL_SetAnalogAxisScale(i, MouseAnalogueScale[i], controldevice_mouse);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CONFIG_SetupJoystick(void)
|
||||
{
|
||||
int32_t i;
|
||||
char str[80];
|
||||
char temp[80];
|
||||
int32_t scale;
|
||||
|
||||
if (scripthandle < 0) return;
|
||||
|
||||
for (i=0; i<MAXJOYBUTTONSANDHATS; i++)
|
||||
{
|
||||
Bsprintf(str,"ControllerButton%d",i);
|
||||
temp[0] = 0;
|
||||
if (!SCRIPT_GetString(scripthandle,"Controls", str,temp))
|
||||
JoystickFunctions[i][0] = CONFIG_FunctionNameToNum(temp);
|
||||
|
||||
Bsprintf(str,"ControllerButtonClicked%d",i);
|
||||
temp[0] = 0;
|
||||
if (!SCRIPT_GetString(scripthandle,"Controls", str,temp))
|
||||
JoystickFunctions[i][1] = CONFIG_FunctionNameToNum(temp);
|
||||
}
|
||||
|
||||
// map over the axes
|
||||
for (i=0; i<MAXJOYAXES; i++)
|
||||
{
|
||||
Bsprintf(str,"ControllerAnalogAxes%d",i);
|
||||
temp[0] = 0;
|
||||
if (!SCRIPT_GetString(scripthandle, "Controls", str,temp))
|
||||
JoystickAnalogueAxes[i] = CONFIG_AnalogNameToNum(temp);
|
||||
|
||||
Bsprintf(str,"ControllerDigitalAxes%d_0",i);
|
||||
temp[0] = 0;
|
||||
if (!SCRIPT_GetString(scripthandle, "Controls", str,temp))
|
||||
JoystickDigitalFunctions[i][0] = CONFIG_FunctionNameToNum(temp);
|
||||
|
||||
Bsprintf(str,"ControllerDigitalAxes%d_1",i);
|
||||
temp[0] = 0;
|
||||
if (!SCRIPT_GetString(scripthandle, "Controls", str,temp))
|
||||
JoystickDigitalFunctions[i][1] = CONFIG_FunctionNameToNum(temp);
|
||||
|
||||
Bsprintf(str,"ControllerAnalogScale%d",i);
|
||||
scale = JoystickAnalogueScale[i];
|
||||
SCRIPT_GetNumber(scripthandle, "Controls", str,&scale);
|
||||
JoystickAnalogueScale[i] = scale;
|
||||
|
||||
Bsprintf(str,"ControllerAnalogInvert%d",i);
|
||||
scale = JoystickAnalogueInvert[i];
|
||||
SCRIPT_GetNumber(scripthandle, "Controls", str,&scale);
|
||||
JoystickAnalogueInvert[i] = scale;
|
||||
|
||||
Bsprintf(str,"ControllerAnalogDead%d",i);
|
||||
scale = JoystickAnalogueDead[i];
|
||||
SCRIPT_GetNumber(scripthandle, "Controls", str,&scale);
|
||||
JoystickAnalogueDead[i] = scale;
|
||||
|
||||
Bsprintf(str,"ControllerAnalogSaturate%d",i);
|
||||
scale = JoystickAnalogueSaturate[i];
|
||||
SCRIPT_GetNumber(scripthandle, "Controls", str,&scale);
|
||||
JoystickAnalogueSaturate[i] = scale;
|
||||
}
|
||||
|
||||
for (i=0; i<MAXJOYBUTTONSANDHATS; i++)
|
||||
{
|
||||
CONTROL_MapButton(JoystickFunctions[i][0], i, 0, controldevice_joystick);
|
||||
CONTROL_MapButton(JoystickFunctions[i][1], i, 1, controldevice_joystick);
|
||||
}
|
||||
for (i=0; i<MAXJOYAXES; i++)
|
||||
{
|
||||
CONTROL_MapAnalogAxis(i, JoystickAnalogueAxes[i], controldevice_joystick);
|
||||
CONTROL_MapDigitalAxis(i, JoystickDigitalFunctions[i][0], 0, controldevice_joystick);
|
||||
CONTROL_MapDigitalAxis(i, JoystickDigitalFunctions[i][1], 1, controldevice_joystick);
|
||||
CONTROL_SetAnalogAxisScale(i, JoystickAnalogueScale[i], controldevice_joystick);
|
||||
CONTROL_SetAnalogAxisInvert(i, JoystickAnalogueInvert[i], controldevice_joystick);
|
||||
}
|
||||
}
|
||||
|
||||
void SetupInput()
|
||||
{
|
||||
if (CONTROL_Startup(controltype_keyboardandmouse, &BGetTime, kTimerTicks))
|
||||
{
|
||||
ERRprintf("There was an error initializing the CONTROL system.\n");
|
||||
engineUnInit();
|
||||
Bexit(5);
|
||||
}
|
||||
SetupGameButtons();
|
||||
CONFIG_SetupMouse();
|
||||
CONFIG_SetupJoystick();
|
||||
|
||||
CONTROL_JoystickEnabled = (gSetup.usejoystick && CONTROL_JoyPresent);
|
||||
CONTROL_MouseEnabled = (gSetup.usemouse && CONTROL_MousePresent);
|
||||
|
||||
// JBF 20040215: evil and nasty place to do this, but joysticks are evil and nasty too
|
||||
for (int i=0; i<joystick.numAxes; i++)
|
||||
joySetDeadZone(i,JoystickAnalogueDead[i],JoystickAnalogueSaturate[i]);
|
||||
}
|
||||
|
||||
void CONFIG_WriteSettings(void) // save binds and aliases to <cfgname>_settings.cfg
|
||||
{
|
||||
char filename[BMAX_PATH];
|
||||
}
|
||||
|
||||
if (!Bstrcmp(setupfilename, kSetupFilename))
|
||||
Bsprintf(filename, "settings.cfg");
|
||||
else
|
||||
Bsprintf(filename, "%s_settings.cfg", strtok(setupfilename, "."));
|
||||
|
||||
buildvfs_FILE fp = buildvfs_fopen_write(filename);
|
||||
|
||||
if (fp)
|
||||
{
|
||||
buildvfs_fputstr(fp, "// this file is automatically generated by ");
|
||||
buildvfs_fputstrptr(fp, AppProperName);
|
||||
buildvfs_fputstr(fp,"\nunbindall\n");
|
||||
|
||||
for (int i=0; i<MAXBOUNDKEYS+MAXMOUSEBUTTONS; i++)
|
||||
{
|
||||
if (CONTROL_KeyIsBound(i))
|
||||
{
|
||||
buildvfs_fputstr(fp, "bind \"");
|
||||
buildvfs_fputstrptr(fp, CONTROL_KeyBinds[i].key);
|
||||
if (CONTROL_KeyBinds[i].repeat)
|
||||
buildvfs_fputstr(fp, "\" \"");
|
||||
else
|
||||
buildvfs_fputstr(fp, "\" norepeat \"");
|
||||
buildvfs_fputstrptr(fp, CONTROL_KeyBinds[i].cmdstr);
|
||||
buildvfs_fputstr(fp, "\"\n");
|
||||
}
|
||||
}
|
||||
|
||||
for (int i=0; i<kMaxGameFunctions; ++i)
|
||||
{
|
||||
char const * name = CONFIG_FunctionNumToName(i);
|
||||
if (name && name[0] != '\0' && (KeyboardKeys[i][0] == 0xff || !KeyboardKeys[i][0]))
|
||||
{
|
||||
buildvfs_fputstr(fp, "unbound ");
|
||||
buildvfs_fputstrptr(fp, name);
|
||||
buildvfs_fputstr(fp, "\n");
|
||||
}
|
||||
}
|
||||
|
||||
OSD_WriteAliases(fp);
|
||||
|
||||
//if (g_crosshairSum != -1 && g_crosshairSum != DefaultCrosshairColors.r+(DefaultCrosshairColors.g<<8)+(DefaultCrosshairColors.b<<16))
|
||||
//{
|
||||
// buildvfs_fputstr(fp, "crosshaircolor ");
|
||||
// char buf[64];
|
||||
// snprintf(buf, sizeof(buf), "%d %d %d\n", CrosshairColors.r, CrosshairColors.g, CrosshairColors.b);
|
||||
// buildvfs_fputstrptr(fp, buf);
|
||||
//}
|
||||
|
||||
OSD_WriteCvars(fp);
|
||||
|
||||
buildvfs_fclose(fp);
|
||||
|
||||
OSD_Printf("Wrote %s\n", filename);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
OSD_Printf("Error writing %s: %s\n", filename, strerror(errno));
|
||||
}
|
||||
|
||||
void CONFIG_WriteSetup(uint32_t flags)
|
||||
{
|
||||
char buf[256];
|
||||
if (!setupread) return;
|
||||
|
||||
if (scripthandle < 0)
|
||||
scripthandle = SCRIPT_Init(setupfilename);
|
||||
|
||||
SCRIPT_PutNumber(scripthandle, "Setup", "CacheSize", MAXCACHE1DSIZE, FALSE, FALSE);
|
||||
//SCRIPT_PutNumber(scripthandle, "Setup", "ConfigVersion", BYTEVERSION_EDUKE32, FALSE, FALSE);
|
||||
SCRIPT_PutNumber(scripthandle, "Setup", "ForceSetup", gSetup.forcesetup, FALSE, FALSE);
|
||||
SCRIPT_PutNumber(scripthandle, "Setup", "NoAutoLoad", gSetup.noautoload, FALSE, FALSE);
|
||||
|
||||
//#ifdef POLYMER
|
||||
// SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "Polymer", glrendmode == REND_POLYMER, FALSE, FALSE);
|
||||
//#endif
|
||||
|
||||
SCRIPT_PutNumber(scripthandle, "Screen Setup", "ScreenBPP", gSetup.bpp, FALSE, FALSE);
|
||||
SCRIPT_PutNumber(scripthandle, "Screen Setup", "ScreenHeight", gSetup.ydim, FALSE, FALSE);
|
||||
SCRIPT_PutNumber(scripthandle, "Screen Setup", "ScreenMode", gSetup.fullscreen, FALSE, FALSE);
|
||||
SCRIPT_PutNumber(scripthandle, "Screen Setup", "ScreenWidth", gSetup.xdim, FALSE, FALSE);
|
||||
|
||||
//if (g_grpNamePtr && !g_addonNum)
|
||||
// SCRIPT_PutString(ud.config.scripthandle, "Setup", "SelectedGRP", g_grpNamePtr);
|
||||
|
||||
#ifdef STARTUP_SETUP_WINDOW
|
||||
if (g_noSetup == 0)
|
||||
SCRIPT_PutString(scripthandle, "Setup", "ModDir", &g_modDir[0]);
|
||||
#endif
|
||||
// exit early after only updating the values that can be changed from the startup window
|
||||
if (flags & 1)
|
||||
{
|
||||
SCRIPT_Save(scripthandle, setupfilename);
|
||||
SCRIPT_Free(scripthandle);
|
||||
return;
|
||||
}
|
||||
|
||||
SCRIPT_PutNumber(scripthandle, "Screen Setup", "MaxRefreshFreq", maxrefreshfreq, FALSE, FALSE);
|
||||
SCRIPT_PutNumber(scripthandle, "Screen Setup", "WindowPosX", windowx, FALSE, FALSE);
|
||||
SCRIPT_PutNumber(scripthandle, "Screen Setup", "WindowPosY", windowy, FALSE, FALSE);
|
||||
SCRIPT_PutNumber(scripthandle, "Screen Setup", "WindowPositioning", windowpos, FALSE, FALSE);
|
||||
|
||||
//if (!NAM_WW2GI)
|
||||
//{
|
||||
// SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "Out",ud.lockout,FALSE,FALSE);
|
||||
// SCRIPT_PutString(ud.config.scripthandle, "Screen Setup", "Password",ud.pwlockout);
|
||||
//}
|
||||
|
||||
//#ifdef _WIN32
|
||||
// SCRIPT_PutNumber(ud.config.scripthandle, "Updates", "CheckForUpdates", ud.config.CheckForUpdates, FALSE, FALSE);
|
||||
// SCRIPT_PutNumber(ud.config.scripthandle, "Updates", "LastUpdateCheck", ud.config.LastUpdateCheck, FALSE, FALSE);
|
||||
//#endif
|
||||
|
||||
if (gSetup.usemouse)
|
||||
{
|
||||
for (int i=0; i<MAXMOUSEBUTTONS; i++)
|
||||
{
|
||||
if (CONFIG_FunctionNumToName(MouseFunctions[i][0]))
|
||||
{
|
||||
Bsprintf(buf, "MouseButton%d", i);
|
||||
SCRIPT_PutString(scripthandle, "Controls", buf, CONFIG_FunctionNumToName(MouseFunctions[i][0]));
|
||||
}
|
||||
|
||||
if (i >= (MAXMOUSEBUTTONS-2)) continue;
|
||||
|
||||
if (CONFIG_FunctionNumToName(MouseFunctions[i][1]))
|
||||
{
|
||||
Bsprintf(buf, "MouseButtonClicked%d", i);
|
||||
SCRIPT_PutString(scripthandle, "Controls", buf, CONFIG_FunctionNumToName(MouseFunctions[i][1]));
|
||||
}
|
||||
}
|
||||
|
||||
for (int i=0; i<MAXMOUSEAXES; i++)
|
||||
{
|
||||
if (CONFIG_AnalogNumToName(MouseAnalogueAxes[i]))
|
||||
{
|
||||
Bsprintf(buf, "MouseAnalogAxes%d", i);
|
||||
SCRIPT_PutString(scripthandle, "Controls", buf, CONFIG_AnalogNumToName(MouseAnalogueAxes[i]));
|
||||
}
|
||||
|
||||
if (CONFIG_FunctionNumToName(MouseDigitalFunctions[i][0]))
|
||||
{
|
||||
Bsprintf(buf, "MouseDigitalAxes%d_0", i);
|
||||
SCRIPT_PutString(scripthandle, "Controls", buf, CONFIG_FunctionNumToName(MouseDigitalFunctions[i][0]));
|
||||
}
|
||||
|
||||
if (CONFIG_FunctionNumToName(MouseDigitalFunctions[i][1]))
|
||||
{
|
||||
Bsprintf(buf, "MouseDigitalAxes%d_1", i);
|
||||
SCRIPT_PutString(scripthandle, "Controls", buf, CONFIG_FunctionNumToName(MouseDigitalFunctions[i][1]));
|
||||
}
|
||||
|
||||
Bsprintf(buf, "MouseAnalogScale%d", i);
|
||||
SCRIPT_PutNumber(scripthandle, "Controls", buf, MouseAnalogueScale[i], FALSE, FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
if (gSetup.usejoystick)
|
||||
{
|
||||
for (int dummy=0; dummy<MAXJOYBUTTONSANDHATS; dummy++)
|
||||
{
|
||||
if (CONFIG_FunctionNumToName(JoystickFunctions[dummy][0]))
|
||||
{
|
||||
Bsprintf(buf, "ControllerButton%d", dummy);
|
||||
SCRIPT_PutString(scripthandle, "Controls", buf, CONFIG_FunctionNumToName(JoystickFunctions[dummy][0]));
|
||||
}
|
||||
|
||||
if (CONFIG_FunctionNumToName(JoystickFunctions[dummy][1]))
|
||||
{
|
||||
Bsprintf(buf, "ControllerButtonClicked%d", dummy);
|
||||
SCRIPT_PutString(scripthandle, "Controls", buf, CONFIG_FunctionNumToName(JoystickFunctions[dummy][1]));
|
||||
}
|
||||
}
|
||||
for (int dummy=0; dummy<MAXJOYAXES; dummy++)
|
||||
{
|
||||
if (CONFIG_AnalogNumToName(JoystickAnalogueAxes[dummy]))
|
||||
{
|
||||
Bsprintf(buf, "ControllerAnalogAxes%d", dummy);
|
||||
SCRIPT_PutString(scripthandle, "Controls", buf, CONFIG_AnalogNumToName(JoystickAnalogueAxes[dummy]));
|
||||
}
|
||||
|
||||
if (CONFIG_FunctionNumToName(JoystickDigitalFunctions[dummy][0]))
|
||||
{
|
||||
Bsprintf(buf, "ControllerDigitalAxes%d_0", dummy);
|
||||
SCRIPT_PutString(scripthandle, "Controls", buf, CONFIG_FunctionNumToName(JoystickDigitalFunctions[dummy][0]));
|
||||
}
|
||||
|
||||
if (CONFIG_FunctionNumToName(JoystickDigitalFunctions[dummy][1]))
|
||||
{
|
||||
Bsprintf(buf, "ControllerDigitalAxes%d_1", dummy);
|
||||
SCRIPT_PutString(scripthandle, "Controls", buf, CONFIG_FunctionNumToName(JoystickDigitalFunctions[dummy][1]));
|
||||
}
|
||||
|
||||
Bsprintf(buf, "ControllerAnalogScale%d", dummy);
|
||||
SCRIPT_PutNumber(scripthandle, "Controls", buf, JoystickAnalogueScale[dummy], FALSE, FALSE);
|
||||
|
||||
Bsprintf(buf, "ControllerAnalogInvert%d", dummy);
|
||||
SCRIPT_PutNumber(scripthandle, "Controls", buf, JoystickAnalogueInvert[dummy], FALSE, FALSE);
|
||||
|
||||
Bsprintf(buf, "ControllerAnalogDead%d", dummy);
|
||||
SCRIPT_PutNumber(scripthandle, "Controls", buf, JoystickAnalogueDead[dummy], FALSE, FALSE);
|
||||
|
||||
Bsprintf(buf, "ControllerAnalogSaturate%d", dummy);
|
||||
SCRIPT_PutNumber(scripthandle, "Controls", buf, JoystickAnalogueSaturate[dummy], FALSE, FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
//SCRIPT_PutString(ud.config.scripthandle, "Comm Setup","PlayerName",&szPlayerName[0]);
|
||||
|
||||
//SCRIPT_PutString(ud.config.scripthandle, "Comm Setup","RTSName",&ud.rtsname[0]);
|
||||
|
||||
// char commmacro[] = "CommbatMacro# ";
|
||||
|
||||
//for (int dummy = 0; dummy < MAXRIDECULE; dummy++)
|
||||
//{
|
||||
// commmacro[13] = dummy+'0';
|
||||
// SCRIPT_PutString(ud.config.scripthandle, "Comm Setup",commmacro,&ud.ridecule[dummy][0]);
|
||||
//}
|
||||
|
||||
SCRIPT_Save(scripthandle, setupfilename);
|
||||
|
||||
if ((flags & 2) == 0)
|
||||
SCRIPT_Free(scripthandle);
|
||||
|
||||
OSD_Printf("Wrote %s\n",setupfilename);
|
||||
CONFIG_WriteSettings();
|
||||
Bfflush(NULL);
|
||||
}
|
||||
END_PS_NS
|
||||
#endif
|
||||
END_PS_NS
|
|
@ -24,32 +24,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
|
||||
BEGIN_PS_NS
|
||||
|
||||
#define kMaxGameFunctions 40
|
||||
#define kMaxGameFuncLen 64
|
||||
|
||||
// KEEPINSYNC mact/include/_control.h, build/src/sdlayer.cpp
|
||||
#define MAXJOYBUTTONS 32
|
||||
#define MAXJOYBUTTONSANDHATS (MAXJOYBUTTONS+4)
|
||||
|
||||
// KEEPINSYNC mact/include/_control.h, build/src/sdlayer.cpp
|
||||
#define MAXMOUSEAXES 2
|
||||
#define MAXMOUSEDIGITAL (MAXMOUSEAXES*2)
|
||||
|
||||
// KEEPINSYNC mact/include/_control.h, build/src/sdlayer.cpp
|
||||
#define MAXJOYAXES 9
|
||||
#define MAXJOYDIGITAL (MAXJOYAXES*2)
|
||||
|
||||
// default mouse scale
|
||||
#define DEFAULTMOUSEANALOGUESCALE 65536
|
||||
|
||||
// default joystick settings
|
||||
#define DEFAULTJOYSTICKANALOGUESCALE 65536
|
||||
#define DEFAULTJOYSTICKANALOGUEDEAD 2000
|
||||
#define DEFAULTJOYSTICKANALOGUESATURATE 9500
|
||||
|
||||
extern const char gamefunctions[kMaxGameFunctions][kMaxGameFuncLen];
|
||||
extern const char keydefaults[kMaxGameFunctions*2][kMaxGameFuncLen];
|
||||
extern const char oldkeydefaults[kMaxGameFunctions*2][kMaxGameFuncLen];
|
||||
|
||||
|
||||
typedef struct {
|
||||
|
@ -63,57 +37,16 @@ typedef struct {
|
|||
int32_t noautoload;
|
||||
} ud_setup_t;
|
||||
|
||||
#define kSetupFilename "SETUP.CFG"
|
||||
extern char setupfilename[];
|
||||
|
||||
extern hashtable_t h_gamefuncs;
|
||||
|
||||
void SetupInput();
|
||||
|
||||
void LoadConfig();
|
||||
int CONFIG_ReadSetup();
|
||||
void CONFIG_WriteSetup(uint32_t flags);
|
||||
|
||||
extern int lMouseSens;
|
||||
|
||||
extern ud_setup_t gSetup;
|
||||
extern int32_t scripthandle;
|
||||
extern int32_t setupread;
|
||||
extern int32_t useprecache;
|
||||
extern int32_t MouseDeadZone, MouseBias;
|
||||
extern int32_t SmoothInput;
|
||||
|
||||
extern int32_t FXVolume;
|
||||
extern int32_t MusicVolume;
|
||||
extern int32_t MixRate;
|
||||
extern int32_t MidiPort;
|
||||
extern int32_t NumVoices;
|
||||
extern int32_t NumChannels;
|
||||
extern int32_t NumBits;
|
||||
extern int32_t ReverseStereo;
|
||||
extern int32_t MusicDevice;
|
||||
extern int32_t FXDevice;
|
||||
|
||||
// JBF 20031211: Store the input settings because
|
||||
// (currently) mact can't regurgitate them
|
||||
extern int32_t MouseFunctions[MAXMOUSEBUTTONS][2];
|
||||
extern int32_t MouseDigitalFunctions[MAXMOUSEAXES][2];
|
||||
extern int32_t MouseAnalogueAxes[MAXMOUSEAXES];
|
||||
extern int32_t MouseAnalogueScale[MAXMOUSEAXES];
|
||||
extern int32_t JoystickFunctions[MAXJOYBUTTONSANDHATS][2];
|
||||
extern int32_t JoystickDigitalFunctions[MAXJOYAXES][2];
|
||||
extern int32_t JoystickAnalogueAxes[MAXJOYAXES];
|
||||
extern int32_t JoystickAnalogueScale[MAXJOYAXES];
|
||||
extern int32_t JoystickAnalogueInvert[MAXJOYAXES];
|
||||
extern int32_t JoystickAnalogueDead[MAXJOYAXES];
|
||||
extern int32_t JoystickAnalogueSaturate[MAXJOYAXES];
|
||||
extern uint8_t KeyboardKeys[kMaxGameFunctions][2];
|
||||
|
||||
extern int32_t MAXCACHE1DSIZE;
|
||||
|
||||
void CONFIG_SetDefaultKeys(const char(*keyptr)[kMaxGameFuncLen], bool lazy=false);
|
||||
void CONFIG_MapKey(int which, kb_scancode key1, kb_scancode oldkey1, kb_scancode key2, kb_scancode oldkey2);
|
||||
int32_t CONFIG_FunctionNameToNum(const char* func);
|
||||
int CONFIG_ReadSetup(void);
|
||||
void CONFIG_SetDefaults(void);
|
||||
|
||||
END_PS_NS
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
#include "menu.h"
|
||||
#include "player.h"
|
||||
#include "network.h"
|
||||
#include "input.h"
|
||||
#include "ps_input.h"
|
||||
#include "sound.h"
|
||||
#include "cd.h"
|
||||
#include "view.h"
|
||||
|
@ -68,7 +68,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
#include "trigdat.h"
|
||||
#include "record.h"
|
||||
#include "lighting.h"
|
||||
#include "grpscan.h"
|
||||
#include <string.h>
|
||||
#include <cstdio> // for printf
|
||||
#include <cstdlib>
|
||||
|
@ -446,64 +445,13 @@ const char *gString[] =
|
|||
"",
|
||||
};
|
||||
|
||||
static char g_rootDir[BMAX_PATH];
|
||||
char g_modDir[BMAX_PATH] = "/";
|
||||
|
||||
buildvfs_kfd kopen4loadfrommod(const char *fileName, char searchfirst)
|
||||
{
|
||||
buildvfs_kfd kFile = buildvfs_kfd_invalid;
|
||||
|
||||
if (g_modDir[0] != '/' || g_modDir[1] != 0)
|
||||
{
|
||||
static char staticFileName[BMAX_PATH];
|
||||
Bsnprintf(staticFileName, sizeof(staticFileName), "%s/%s", g_modDir, fileName);
|
||||
kFile = kopen4load(staticFileName, searchfirst);
|
||||
}
|
||||
|
||||
return (kFile == buildvfs_kfd_invalid) ? kopen4load(fileName, searchfirst) : kFile;
|
||||
}
|
||||
|
||||
struct grpfile_t const *g_selectedGrp;
|
||||
|
||||
int32_t g_gameType = GAMEFLAG_POWERSLAVE;
|
||||
|
||||
// g_gameNamePtr can point to one of: grpfiles[].name (string literal), string
|
||||
// literal, malloc'd block (XXX: possible leak)
|
||||
const char *g_gameNamePtr = NULL;
|
||||
|
||||
// grp handling
|
||||
|
||||
static const char *defaultgamegrp = "STUFF.DAT";
|
||||
static const char *defaultdeffilename = "exhumed.def";
|
||||
|
||||
// g_grpNamePtr can ONLY point to a malloc'd block (length BMAX_PATH)
|
||||
char *g_grpNamePtr = NULL;
|
||||
|
||||
void clearGrpNamePtr(void)
|
||||
{
|
||||
Xfree(g_grpNamePtr);
|
||||
// g_grpNamePtr assumed to be assigned to right after
|
||||
}
|
||||
|
||||
const char *G_DefaultGrpFile(void)
|
||||
{
|
||||
return defaultgamegrp;
|
||||
}
|
||||
const char *G_DefaultDefFile(void)
|
||||
{
|
||||
return defaultdeffilename;
|
||||
}
|
||||
|
||||
const char *G_GrpFile(void)
|
||||
{
|
||||
return (g_grpNamePtr == NULL) ? G_DefaultGrpFile() : g_grpNamePtr;
|
||||
}
|
||||
|
||||
const char *G_DefFile(void)
|
||||
{
|
||||
return (g_defNamePtr == NULL) ? G_DefaultDefFile() : g_defNamePtr;
|
||||
}
|
||||
|
||||
int32_t g_commandSetup = 0;
|
||||
int32_t g_noSetup = 0;
|
||||
int32_t g_noAutoLoad = 0;
|
||||
|
@ -514,301 +462,10 @@ static struct strllist *CommandPaths, *CommandGrps;
|
|||
|
||||
void G_ExtPreInit(int32_t argc,char const * const * argv)
|
||||
{
|
||||
g_useCwd = G_CheckCmdSwitch(argc, argv, "-usecwd");
|
||||
|
||||
#ifdef _WIN32
|
||||
GetModuleFileName(NULL,g_rootDir,BMAX_PATH);
|
||||
Bcorrectfilename(g_rootDir,1);
|
||||
//buildvfs_chdir(g_rootDir);
|
||||
#else
|
||||
buildvfs_getcwd(g_rootDir,BMAX_PATH);
|
||||
strcat(g_rootDir,"/");
|
||||
#endif
|
||||
}
|
||||
|
||||
void G_ExtInit(void)
|
||||
{
|
||||
char cwd[BMAX_PATH];
|
||||
|
||||
#ifdef EDUKE32_OSX
|
||||
char *appdir = Bgetappdir();
|
||||
addsearchpath(appdir);
|
||||
Xfree(appdir);
|
||||
#endif
|
||||
|
||||
#ifdef USE_PHYSFS
|
||||
strncpy(cwd, PHYSFS_getBaseDir(), ARRAY_SIZE(cwd));
|
||||
cwd[ARRAY_SIZE(cwd)-1] = '\0';
|
||||
#else
|
||||
if (buildvfs_getcwd(cwd, ARRAY_SIZE(cwd)) && Bstrcmp(cwd, "/") != 0)
|
||||
#endif
|
||||
addsearchpath(cwd);
|
||||
|
||||
if (CommandPaths)
|
||||
{
|
||||
int32_t i;
|
||||
struct strllist *s;
|
||||
while (CommandPaths)
|
||||
{
|
||||
s = CommandPaths->next;
|
||||
i = addsearchpath(CommandPaths->str);
|
||||
if (i < 0)
|
||||
{
|
||||
initprintf("Failed adding %s for game data: %s\n", CommandPaths->str,
|
||||
i==-1 ? "not a directory" : "no such directory");
|
||||
}
|
||||
|
||||
Xfree(CommandPaths->str);
|
||||
Xfree(CommandPaths);
|
||||
CommandPaths = s;
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(_WIN32) && !defined(EDUKE32_STANDALONE)
|
||||
if (buildvfs_exists("user_profiles_enabled"))
|
||||
#else
|
||||
if (g_useCwd == 0 && !buildvfs_exists("user_profiles_disabled"))
|
||||
#endif
|
||||
{
|
||||
char *homedir;
|
||||
int32_t asperr;
|
||||
|
||||
if ((homedir = Bgethomedir()))
|
||||
{
|
||||
Bsnprintf(cwd, ARRAY_SIZE(cwd), "%s/"
|
||||
#if defined(_WIN32)
|
||||
APPNAME
|
||||
#elif defined(GEKKO)
|
||||
"apps/" APPBASENAME
|
||||
#else
|
||||
".config/" APPBASENAME
|
||||
#endif
|
||||
,homedir);
|
||||
asperr = addsearchpath(cwd);
|
||||
if (asperr == -2)
|
||||
{
|
||||
if (buildvfs_mkdir(cwd,S_IRWXU) == 0) asperr = addsearchpath(cwd);
|
||||
else asperr = -1;
|
||||
}
|
||||
if (asperr == 0)
|
||||
buildvfs_chdir(cwd);
|
||||
Xfree(homedir);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void G_ScanGroups(void)
|
||||
{
|
||||
ScanGroups();
|
||||
|
||||
g_selectedGrp = NULL;
|
||||
|
||||
char const * const currentGrp = G_GrpFile();
|
||||
|
||||
for (grpfile_t const *fg = foundgrps; fg; fg=fg->next)
|
||||
{
|
||||
if (!Bstrcasecmp(fg->filename, currentGrp))
|
||||
{
|
||||
g_selectedGrp = fg;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (g_selectedGrp == NULL)
|
||||
g_selectedGrp = foundgrps;
|
||||
}
|
||||
|
||||
static int32_t G_TryLoadingGrp(char const * const grpfile)
|
||||
{
|
||||
int32_t i;
|
||||
|
||||
if ((i = initgroupfile(grpfile)) == -1)
|
||||
initprintf("Warning: could not find main data file \"%s\"!\n", grpfile);
|
||||
else
|
||||
initprintf("Using \"%s\" as main game data file.\n", grpfile);
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
static int32_t G_LoadGrpDependencyChain(grpfile_t const * const grp)
|
||||
{
|
||||
if (!grp)
|
||||
return -1;
|
||||
|
||||
if (grp->type->dependency && grp->type->dependency != grp->type->crcval)
|
||||
G_LoadGrpDependencyChain(FindGroup(grp->type->dependency));
|
||||
|
||||
int32_t const i = G_TryLoadingGrp(grp->filename);
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
void G_LoadGroups(int32_t autoload)
|
||||
{
|
||||
if (g_modDir[0] != '/')
|
||||
{
|
||||
char cwd[BMAX_PATH];
|
||||
|
||||
Bstrcat(g_rootDir, g_modDir);
|
||||
addsearchpath(g_rootDir);
|
||||
// addsearchpath(mod_dir);
|
||||
|
||||
char path[BMAX_PATH];
|
||||
|
||||
if (buildvfs_getcwd(cwd, BMAX_PATH))
|
||||
{
|
||||
Bsnprintf(path, sizeof(path), "%s/%s", cwd, g_modDir);
|
||||
if (!Bstrcmp(g_rootDir, path))
|
||||
{
|
||||
if (addsearchpath(path) == -2)
|
||||
if (buildvfs_mkdir(path, S_IRWXU) == 0)
|
||||
addsearchpath(path);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef USE_OPENGL
|
||||
Bsnprintf(path, sizeof(path), "%s/%s", g_modDir, TEXCACHEFILE);
|
||||
Bstrcpy(TEXCACHEFILE, path);
|
||||
#endif
|
||||
}
|
||||
|
||||
const char *grpfile;
|
||||
int32_t i;
|
||||
|
||||
if ((i = G_LoadGrpDependencyChain(g_selectedGrp)) != -1)
|
||||
{
|
||||
grpfile = g_selectedGrp->filename;
|
||||
|
||||
clearGrpNamePtr();
|
||||
g_grpNamePtr = dup_filename(grpfile);
|
||||
|
||||
grpinfo_t const * const type = g_selectedGrp->type;
|
||||
|
||||
g_gameType = type->game;
|
||||
g_gameNamePtr = type->name;
|
||||
|
||||
if (type->defname && g_defNamePtr == NULL)
|
||||
g_defNamePtr = dup_filename(type->defname);
|
||||
}
|
||||
else
|
||||
{
|
||||
grpfile = G_GrpFile();
|
||||
i = G_TryLoadingGrp(grpfile);
|
||||
}
|
||||
|
||||
if (autoload)
|
||||
{
|
||||
G_LoadGroupsInDir("autoload");
|
||||
|
||||
if (i != -1)
|
||||
G_DoAutoload(grpfile);
|
||||
}
|
||||
|
||||
if (g_modDir[0] != '/')
|
||||
G_LoadGroupsInDir(g_modDir);
|
||||
|
||||
loaddefinitions_game(G_DefFile(), TRUE);
|
||||
|
||||
struct strllist *s;
|
||||
|
||||
int const bakpathsearchmode = pathsearchmode;
|
||||
pathsearchmode = 1;
|
||||
|
||||
while (CommandGrps)
|
||||
{
|
||||
int32_t j;
|
||||
|
||||
s = CommandGrps->next;
|
||||
|
||||
if ((j = initgroupfile(CommandGrps->str)) == -1)
|
||||
initprintf("Could not find file \"%s\".\n", CommandGrps->str);
|
||||
else
|
||||
{
|
||||
g_groupFileHandle = j;
|
||||
initprintf("Using file \"%s\" as game data.\n", CommandGrps->str);
|
||||
if (autoload)
|
||||
G_DoAutoload(CommandGrps->str);
|
||||
}
|
||||
|
||||
Xfree(CommandGrps->str);
|
||||
Xfree(CommandGrps);
|
||||
CommandGrps = s;
|
||||
}
|
||||
pathsearchmode = bakpathsearchmode;
|
||||
}
|
||||
|
||||
//////////
|
||||
|
||||
void G_AddGroup(const char *buffer)
|
||||
{
|
||||
char buf[BMAX_PATH];
|
||||
|
||||
struct strllist *s = (struct strllist *)Xcalloc(1,sizeof(struct strllist));
|
||||
|
||||
Bstrcpy(buf, buffer);
|
||||
|
||||
if (Bstrchr(buf,'.') == 0)
|
||||
Bstrcat(buf,".grp");
|
||||
|
||||
s->str = Xstrdup(buf);
|
||||
|
||||
if (CommandGrps)
|
||||
{
|
||||
struct strllist *t;
|
||||
for (t = CommandGrps; t->next; t=t->next) ;
|
||||
t->next = s;
|
||||
return;
|
||||
}
|
||||
CommandGrps = s;
|
||||
}
|
||||
|
||||
void G_AddPath(const char *buffer)
|
||||
{
|
||||
struct strllist *s = (struct strllist *)Xcalloc(1,sizeof(struct strllist));
|
||||
s->str = Xstrdup(buffer);
|
||||
|
||||
if (CommandPaths)
|
||||
{
|
||||
struct strllist *t;
|
||||
for (t = CommandPaths; t->next; t=t->next) ;
|
||||
t->next = s;
|
||||
return;
|
||||
}
|
||||
CommandPaths = s;
|
||||
}
|
||||
|
||||
//////////
|
||||
|
||||
// loads all group (grp, zip, pk3/4) files in the given directory
|
||||
void G_LoadGroupsInDir(const char *dirname)
|
||||
{
|
||||
static const char *extensions[] = { "*.grp", "*.zip", "*.ssi", "*.pk3", "*.pk4" };
|
||||
char buf[BMAX_PATH];
|
||||
fnlist_t fnlist = FNLIST_INITIALIZER;
|
||||
|
||||
for (auto & extension : extensions)
|
||||
{
|
||||
BUILDVFS_FIND_REC *rec;
|
||||
|
||||
fnlist_getnames(&fnlist, dirname, extension, -1, 0);
|
||||
|
||||
for (rec=fnlist.findfiles; rec; rec=rec->next)
|
||||
{
|
||||
Bsnprintf(buf, sizeof(buf), "%s/%s", dirname, rec->name);
|
||||
initprintf("Using group file \"%s\".\n", buf);
|
||||
initgroupfile(buf);
|
||||
}
|
||||
|
||||
fnlist_clearnames(&fnlist);
|
||||
}
|
||||
}
|
||||
|
||||
void G_DoAutoload(const char *dirname)
|
||||
{
|
||||
char buf[BMAX_PATH];
|
||||
|
||||
Bsnprintf(buf, sizeof(buf), "autoload/%s", dirname);
|
||||
G_LoadGroupsInDir(buf);
|
||||
}
|
||||
|
||||
//////////
|
||||
|
@ -909,20 +566,10 @@ static int parsedefinitions_game(scriptfile *pScript, int firstPass)
|
|||
{
|
||||
char *fileName;
|
||||
|
||||
pathsearchmode = 1;
|
||||
if (!scriptfile_getstring(pScript,&fileName) && firstPass)
|
||||
{
|
||||
if (initgroupfile(fileName) == -1)
|
||||
initprintf("Could not find file \"%s\".\n", fileName);
|
||||
else
|
||||
{
|
||||
initprintf("Using file \"%s\" as game data.\n", fileName);
|
||||
if (!g_noAutoLoad && !gSetup.noautoload)
|
||||
G_DoAutoload(fileName);
|
||||
}
|
||||
fileSystem.AddAdditionalFile(fileName);
|
||||
}
|
||||
|
||||
pathsearchmode = 0;
|
||||
}
|
||||
break;
|
||||
case T_CACHESIZE:
|
||||
|
@ -931,9 +578,6 @@ static int parsedefinitions_game(scriptfile *pScript, int firstPass)
|
|||
|
||||
if (scriptfile_getnumber(pScript, &cacheSize) || !firstPass)
|
||||
break;
|
||||
|
||||
if (cacheSize > 0)
|
||||
MAXCACHE1DSIZE = cacheSize << 10;
|
||||
}
|
||||
break;
|
||||
case T_INCLUDE:
|
||||
|
@ -971,7 +615,7 @@ int loaddefinitions_game(const char *fileName, int32_t firstPass)
|
|||
if (pScript)
|
||||
parsedefinitions_game(pScript, firstPass);
|
||||
|
||||
for (char const * m : g_defModules)
|
||||
for (auto &m : *userConfig.AddDefs)
|
||||
parsedefinitions_game_include(m, NULL, "null", firstPass);
|
||||
|
||||
if (pScript)
|
||||
|
@ -1165,21 +809,12 @@ void DebugOut(const char *fmt, ...)
|
|||
#ifdef _DEBUG
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
|
||||
debugBuffer[0] = '\0';
|
||||
|
||||
vsprintf(debugBuffer, fmt, args);
|
||||
|
||||
initprintf("%s", debugBuffer);
|
||||
fflush(stdout);
|
||||
|
||||
va_end(args);
|
||||
VPrintf(PRINT_HIGH, fmt, args);
|
||||
#endif
|
||||
}
|
||||
|
||||
void ShutDown(void)
|
||||
{
|
||||
CONFIG_WriteSetup(0);
|
||||
StopCD();
|
||||
if (bSerialPlay)
|
||||
{
|
||||
|
@ -1189,13 +824,12 @@ void ShutDown(void)
|
|||
UnInitSerial();
|
||||
}
|
||||
|
||||
KB_Shutdown();
|
||||
RemoveEngine();
|
||||
UnInitNet();
|
||||
UnInitFX();
|
||||
}
|
||||
|
||||
void bail2dos(const char *fmt, ...)
|
||||
void I_Error(const char *fmt, ...)
|
||||
{
|
||||
char buf[256];
|
||||
|
||||
|
@ -1417,9 +1051,7 @@ void mysetbrightness(char nBrightness)
|
|||
|
||||
void CheckKeys()
|
||||
{
|
||||
int eax;
|
||||
|
||||
if (BUTTON(gamefunc_Enlarge_Screen))
|
||||
if (buttonMap.ButtonDown(gamefunc_Enlarge_Screen))
|
||||
{
|
||||
if (screensize == 0)
|
||||
{
|
||||
|
@ -1438,12 +1070,12 @@ void CheckKeys()
|
|||
|
||||
UpdateScreenSize();
|
||||
}
|
||||
CONTROL_ClearButton(gamefunc_Enlarge_Screen);
|
||||
buttonMap.ClearButton(gamefunc_Enlarge_Screen);
|
||||
}
|
||||
|
||||
// F11?
|
||||
#if 0
|
||||
if (BUTTON(gamefunc_Gamma_Correction))
|
||||
if (buttonMap.ButtonDown(gamefunc_Gamma_Correction))
|
||||
{
|
||||
nGamma++;
|
||||
|
||||
|
@ -1451,11 +1083,11 @@ void CheckKeys()
|
|||
nGamma = 0;
|
||||
|
||||
mysetbrightness((uint8_t)nGamma);
|
||||
CONTROL_ClearButton(gamefunc_Gamma_Correction);
|
||||
#endif
|
||||
buttonMap.ClearButton(gamefunc_Gamma_Correction);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (BUTTON(gamefunc_Shrink_Screen))
|
||||
if (buttonMap.ButtonDown(gamefunc_Shrink_Screen))
|
||||
{
|
||||
if (bFullScreen)
|
||||
{
|
||||
|
@ -1468,19 +1100,11 @@ void CheckKeys()
|
|||
}
|
||||
|
||||
UpdateScreenSize();
|
||||
CONTROL_ClearButton(gamefunc_Shrink_Screen);
|
||||
}
|
||||
|
||||
// print version string?
|
||||
if (KB_KeyDown[sc_V] && KB_KeyDown[sc_LeftAlt])
|
||||
{
|
||||
KB_KeyDown[sc_V] = 0;
|
||||
StatusMessage(300, versionstr);
|
||||
return;
|
||||
buttonMap.ClearButton(gamefunc_Shrink_Screen);
|
||||
}
|
||||
|
||||
// go to 3rd person view?
|
||||
if (KB_KeyDown[sc_C] && KB_KeyDown[sc_LeftAlt])
|
||||
if (buttonMap.ButtonDown(gamefunc_Third_Person_View))
|
||||
{
|
||||
if (!nFreeze)
|
||||
{
|
||||
|
@ -1494,11 +1118,11 @@ void CheckKeys()
|
|||
if (bCamera)
|
||||
GrabPalette();
|
||||
}
|
||||
KB_KeyDown[sc_C] = 0;
|
||||
return;
|
||||
buttonMap.ClearButton(gamefunc_Third_Person_View);
|
||||
return;
|
||||
}
|
||||
|
||||
if (KB_KeyDown[sc_Pause])
|
||||
if (inputState.GetKeyStatus(sc_Pause))
|
||||
{
|
||||
if (!nNetPlayerCount)
|
||||
{
|
||||
|
@ -1516,15 +1140,15 @@ void CheckKeys()
|
|||
// Clip();
|
||||
// videoNextPage();
|
||||
}
|
||||
KB_KeyDown[sc_Pause] = 0;
|
||||
inputState.ClearKeyStatus(sc_Pause);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Handle cheat codes
|
||||
if (!bInDemo && KB_KeyWaiting())
|
||||
if (!bInDemo && inputState.keyBufferWaiting())
|
||||
{
|
||||
char ch = KB_GetCh();
|
||||
char ch = inputState.keyGetChar();
|
||||
|
||||
if (bHolly)
|
||||
{
|
||||
|
@ -1667,7 +1291,7 @@ void CheckKeys()
|
|||
}
|
||||
else
|
||||
{
|
||||
KB_GetCh();
|
||||
inputState.keyGetChar(); //???
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1771,11 +1395,11 @@ void DoCredits()
|
|||
|
||||
while ((int)totalclock + 600 > (int)totalclock)
|
||||
{
|
||||
if (KB_KeyDown[sc_F12])
|
||||
if(inputState.GetKeyStatus(sc_F12))
|
||||
{
|
||||
var_20++;
|
||||
|
||||
KB_KeyDown[sc_F12] = 0;
|
||||
inputState.ClearKeyStatus(sc_F12);
|
||||
|
||||
if (var_20 > 5) {
|
||||
return;
|
||||
|
@ -1788,9 +1412,7 @@ void DoCredits()
|
|||
|
||||
while (CDplaying())
|
||||
{
|
||||
if (KB_KeyWaiting()) {
|
||||
KB_GetCh();
|
||||
}
|
||||
inputState.keyGetChar();
|
||||
}
|
||||
|
||||
Clip();
|
||||
|
@ -2624,7 +2246,7 @@ int app_main(int argc, char const* const* argv)
|
|||
GrabPalette();
|
||||
|
||||
if (bSerialPlay && !InitSerial()) {
|
||||
bail2dos("Unable to connect");
|
||||
I_Error("Unable to connect");
|
||||
}
|
||||
|
||||
if (doTitle)
|
||||
|
@ -2689,7 +2311,7 @@ STARTGAME2:
|
|||
{
|
||||
int nPlayer = GrabPlayer();
|
||||
if (nPlayer < 0) {
|
||||
bail2dos("Can't create local player\n");
|
||||
I_Error("Can't create local player\n");
|
||||
}
|
||||
|
||||
InitPlayerInventory(nPlayer);
|
||||
|
@ -2780,7 +2402,7 @@ LOOP3:
|
|||
Query(2, 0, "Insert CD into drive", "(ESC to abort)");
|
||||
KB_ClearKeysDown();
|
||||
if (KB_GetCh() == asc_Escape) {
|
||||
bail2dos("Aborted\n");
|
||||
I_Error("Aborted\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2962,9 +2584,9 @@ LOOP3:
|
|||
// }
|
||||
// else if (nNetTime == 0)
|
||||
// {
|
||||
// if (BUTTON(gamefunc_Open))
|
||||
// if (buttonMap.ButtonDown(gamefunc_Open))
|
||||
// {
|
||||
// CONTROL_ClearButton(gamefunc_Open);
|
||||
// buttonMap.ClearButton(gamefunc_Open);
|
||||
// goto MENU2;
|
||||
// }
|
||||
// }
|
||||
|
@ -3035,9 +2657,9 @@ LOOP3:
|
|||
}
|
||||
if (!bInDemo)
|
||||
{
|
||||
if (BUTTON(gamefunc_Escape))
|
||||
if (buttonMap.ButtonDown(gamefunc_Escape))
|
||||
{
|
||||
CONTROL_ClearButton(gamefunc_Escape);
|
||||
buttonMap.ClearButton(gamefunc_Escape);
|
||||
// MENU2:
|
||||
CONTROL_BindsEnabled = 0;
|
||||
bInMove = kTrue;
|
||||
|
@ -3076,9 +2698,9 @@ LOOP3:
|
|||
KB_ClearKeyDown(sc_F12);
|
||||
videoCaptureScreen("captxxxx.png", 0);
|
||||
}
|
||||
else if (BUTTON(gamefunc_Map)) // e.g. TAB (to show 2D map)
|
||||
else if (buttonMap.ButtonDown(gamefunc_Map)) // e.g. TAB (to show 2D map)
|
||||
{
|
||||
CONTROL_ClearButton(gamefunc_Map);
|
||||
buttonMap.ClearButton(gamefunc_Map);
|
||||
|
||||
if (!nFreeze) {
|
||||
nMapMode = (nMapMode+1)%3;
|
||||
|
@ -3090,10 +2712,10 @@ LOOP3:
|
|||
int const timerOffset = ((int) totalclock - nonsharedtimer);
|
||||
nonsharedtimer += timerOffset;
|
||||
|
||||
if (BUTTON(gamefunc_Zoom_In))
|
||||
if (buttonMap.ButtonDown(gamefunc_Zoom_In))
|
||||
lMapZoom += mulscale6(timerOffset, max<int>(lMapZoom, 256));
|
||||
|
||||
if (BUTTON(gamefunc_Zoom_Out))
|
||||
if (buttonMap.ButtonDown(gamefunc_Zoom_Out))
|
||||
lMapZoom -= mulscale6(timerOffset, max<int>(lMapZoom, 256));
|
||||
|
||||
lMapZoom = clamp(lMapZoom, 48, 2048);
|
||||
|
@ -3101,20 +2723,20 @@ LOOP3:
|
|||
|
||||
if (PlayerList[nLocalPlayer].nHealth > 0)
|
||||
{
|
||||
if (BUTTON(gamefunc_Inventory_Left))
|
||||
if (buttonMap.ButtonDown(gamefunc_Inventory_Left))
|
||||
{
|
||||
SetPrevItem(nLocalPlayer);
|
||||
CONTROL_ClearButton(gamefunc_Inventory_Left);
|
||||
buttonMap.ClearButton(gamefunc_Inventory_Left);
|
||||
}
|
||||
if (BUTTON(gamefunc_Inventory_Right))
|
||||
if (buttonMap.ButtonDown(gamefunc_Inventory_Right))
|
||||
{
|
||||
SetNextItem(nLocalPlayer);
|
||||
CONTROL_ClearButton(gamefunc_Inventory_Right);
|
||||
buttonMap.ClearButton(gamefunc_Inventory_Right);
|
||||
}
|
||||
if (BUTTON(gamefunc_Inventory))
|
||||
if (buttonMap.ButtonDown(gamefunc_Inventory))
|
||||
{
|
||||
UseCurItem(nLocalPlayer);
|
||||
CONTROL_ClearButton(gamefunc_Inventory);
|
||||
buttonMap.ClearButton(gamefunc_Inventory);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -3168,7 +2790,7 @@ void mychangespritesect(int nSprite, int nSector)
|
|||
void mydeletesprite(int nSprite)
|
||||
{
|
||||
if (nSprite < 0 || nSprite > kMaxSprites) {
|
||||
bail2dos("bad sprite value %d handed to mydeletesprite", nSprite);
|
||||
I_Error("bad sprite value %d handed to mydeletesprite", nSprite);
|
||||
}
|
||||
|
||||
deletesprite(nSprite);
|
||||
|
|
|
@ -21,7 +21,13 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
|
||||
#include "compat.h"
|
||||
#include "cache1d.h"
|
||||
#include "grpscan.h"
|
||||
#include "v_text.h"
|
||||
#include "printf.h"
|
||||
#include "gamecvars.h"
|
||||
#include "m_argv.h"
|
||||
#include "gamecontrol.h"
|
||||
#include "c_buttons.h"
|
||||
#include "filesystem/filesystem.h"
|
||||
|
||||
BEGIN_PS_NS
|
||||
|
||||
|
@ -31,17 +37,6 @@ BEGIN_PS_NS
|
|||
void handleevents();
|
||||
#endif
|
||||
|
||||
// TODO:
|
||||
#define OSDTEXT_DEFAULT "^00"
|
||||
#define OSDTEXT_DARKRED "^00"
|
||||
#define OSDTEXT_GREEN "^00"
|
||||
#define OSDTEXT_RED "^00"
|
||||
#define OSDTEXT_YELLOW "^00"
|
||||
|
||||
#define OSDTEXT_BRIGHT "^S0"
|
||||
|
||||
#define OSD_ERROR OSDTEXT_DARKRED OSDTEXT_BRIGHT
|
||||
|
||||
enum basepal_t {
|
||||
BASEPAL = 0,
|
||||
ANIMPAL,
|
||||
|
@ -50,7 +45,6 @@ enum basepal_t {
|
|||
|
||||
void ShutDown(void);
|
||||
void DebugOut(const char *fmt, ...);
|
||||
void bail2dos(const char *fmt, ...);
|
||||
int ExhumedMain(int argc, char *argv[]);
|
||||
|
||||
void FinishLevel();
|
||||
|
|
|
@ -325,7 +325,7 @@ void FuncFish(int a, int nDamage, int nRun)
|
|||
{
|
||||
default:
|
||||
{
|
||||
DebugOut("unknown msg %d for Fish\n", a & 0x7F0000);
|
||||
Printf("unknown msg %d for Fish\n", a & 0x7F0000);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -295,7 +295,7 @@ void FuncGrenade(int a, int nDamage, int nRun)
|
|||
|
||||
default:
|
||||
{
|
||||
DebugOut("unknown msg %d for bullet\n", a & 0x7F0000); // TODO - change 'bullet' to 'grenade' ?
|
||||
Printf("unknown msg %d for bullet\n", a & 0x7F0000); // TODO - change 'bullet' to 'grenade' ?
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,474 +0,0 @@
|
|||
//-------------------------------------------------------------------------
|
||||
/*
|
||||
Copyright (C) 2010 EDuke32 developers and contributors
|
||||
|
||||
This file is part of EDuke32.
|
||||
|
||||
EDuke32 is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License version 2
|
||||
as published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
//-------------------------------------------------------------------------
|
||||
#include "ns.h"
|
||||
#include "baselayer.h"
|
||||
#include "cache1d.h"
|
||||
#include "exhumed.h"
|
||||
#include "common.h"
|
||||
#include "compat.h"
|
||||
//#include "crc32.h"
|
||||
#include "grpscan.h"
|
||||
#include "scriptfile.h"
|
||||
|
||||
BEGIN_PS_NS
|
||||
|
||||
|
||||
#ifndef EDUKE32_STANDALONE
|
||||
static void process_vaca13(int32_t crcval);
|
||||
static void process_vacapp15(int32_t crcval);
|
||||
|
||||
// custom GRP support for the startup window, file format reflects the structure below
|
||||
#define GAMELISTFILE "games.list"
|
||||
// name crc size flags dependency
|
||||
static internalgrpinfo_t const internalgrpfiles[] =
|
||||
{
|
||||
{ "Powerslave", POWERSLAVE_CRC, 27020745, GAMEFLAG_POWERSLAVE, 0 },
|
||||
{ "Exhumed", EXHUMED_CRC, 27108170, GAMEFLAG_EXHUMED, 0 },
|
||||
};
|
||||
#endif
|
||||
|
||||
struct grpfile_t *foundgrps = NULL;
|
||||
struct grpinfo_t *listgrps = NULL;
|
||||
|
||||
static void LoadList(const char * filename)
|
||||
{
|
||||
scriptfile *script = scriptfile_fromfile(filename);
|
||||
|
||||
if (!script)
|
||||
return;
|
||||
|
||||
#ifndef EDUKE32_STANDALONE
|
||||
scriptfile_addsymbolvalue("GAMEFLAG_POWERSLAVE", GAMEFLAG_POWERSLAVE);
|
||||
scriptfile_addsymbolvalue("POWERSLAVE_CRC", POWERSLAVE_CRC);
|
||||
scriptfile_addsymbolvalue("EXHUMED_CRC", EXHUMED_CRC);
|
||||
#endif
|
||||
|
||||
while (!scriptfile_eof(script))
|
||||
{
|
||||
enum
|
||||
{
|
||||
T_GRPINFO,
|
||||
T_GAMENAME,
|
||||
T_CRC,
|
||||
T_SIZE,
|
||||
T_DEPCRC,
|
||||
T_DEFNAME,
|
||||
T_FLAGS,
|
||||
};
|
||||
|
||||
static const tokenlist profiletokens[] =
|
||||
{
|
||||
{ "grpinfo", T_GRPINFO },
|
||||
};
|
||||
|
||||
int32_t token = getatoken(script,profiletokens,ARRAY_SIZE(profiletokens));
|
||||
switch (token)
|
||||
{
|
||||
case T_GRPINFO:
|
||||
{
|
||||
int32_t gsize = 0, gcrcval = 0, gflags = GAMEFLAG_POWERSLAVE, gdepcrc = POWERSLAVE_CRC;
|
||||
char *gname = NULL, *gdef = NULL;
|
||||
char *grpend = NULL;
|
||||
|
||||
static const tokenlist grpinfotokens[] =
|
||||
{
|
||||
{ "name", T_GAMENAME },
|
||||
{ "defname", T_DEFNAME },
|
||||
{ "crc", T_CRC },
|
||||
{ "dependency", T_DEPCRC },
|
||||
{ "size", T_SIZE },
|
||||
{ "flags", T_FLAGS },
|
||||
|
||||
};
|
||||
|
||||
if (scriptfile_getbraces(script,&grpend)) break;
|
||||
|
||||
while (script->textptr < grpend)
|
||||
{
|
||||
int32_t token = getatoken(script,grpinfotokens,ARRAY_SIZE(grpinfotokens));
|
||||
|
||||
switch (token)
|
||||
{
|
||||
case T_GAMENAME:
|
||||
scriptfile_getstring(script,&gname); break;
|
||||
case T_DEFNAME:
|
||||
scriptfile_getstring(script,&gdef); break;
|
||||
|
||||
case T_FLAGS:
|
||||
scriptfile_getsymbol(script,&gflags); gflags &= GAMEFLAGMASK; break;
|
||||
case T_DEPCRC:
|
||||
scriptfile_getsymbol(script,&gdepcrc); break;
|
||||
case T_CRC:
|
||||
scriptfile_getsymbol(script,&gcrcval); break;
|
||||
case T_SIZE:
|
||||
scriptfile_getnumber(script,&gsize); break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
grpinfo_t * const fg = (grpinfo_t *)Xcalloc(1, sizeof(grpinfo_t));
|
||||
fg->next = listgrps;
|
||||
listgrps = fg;
|
||||
|
||||
if (gname)
|
||||
fg->name = Xstrdup(gname);
|
||||
|
||||
fg->size = gsize;
|
||||
fg->crcval = gcrcval;
|
||||
fg->dependency = gdepcrc;
|
||||
fg->game = gflags;
|
||||
|
||||
if (gdef)
|
||||
fg->defname = dup_filename(gdef);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
scriptfile_close(script);
|
||||
scriptfile_clearsymbols();
|
||||
}
|
||||
|
||||
static void LoadGameList(void)
|
||||
{
|
||||
#ifndef EDUKE32_STANDALONE
|
||||
for (size_t i = 0; i < ARRAY_SIZE(internalgrpfiles); i++)
|
||||
{
|
||||
grpinfo_t * const fg = (grpinfo_t *)Xcalloc(1, sizeof(grpinfo_t));
|
||||
|
||||
fg->name = Xstrdup(internalgrpfiles[i].name);
|
||||
fg->crcval = internalgrpfiles[i].crcval;
|
||||
fg->size = internalgrpfiles[i].size;
|
||||
fg->game = internalgrpfiles[i].game;
|
||||
fg->dependency = internalgrpfiles[i].dependency;
|
||||
|
||||
fg->next = listgrps;
|
||||
listgrps = fg;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef USE_PHYSFS
|
||||
auto const base = PHYSFS_getBaseDir();
|
||||
#else
|
||||
static char const base[] = "/";
|
||||
#endif
|
||||
BUILDVFS_FIND_REC * const srch = klistpath(base, "*.grpinfo", BUILDVFS_FIND_FILE);
|
||||
|
||||
for (BUILDVFS_FIND_REC *sidx = srch; sidx; sidx = sidx->next)
|
||||
LoadList(sidx->name);
|
||||
|
||||
klistfree(srch);
|
||||
}
|
||||
|
||||
static void FreeGameList(void)
|
||||
{
|
||||
while (listgrps)
|
||||
{
|
||||
Xfree(listgrps->name);
|
||||
Xfree(listgrps->defname);
|
||||
|
||||
grpinfo_t * const fg = listgrps->next;
|
||||
Xfree(listgrps);
|
||||
listgrps = fg;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#define GRPCACHEFILE "grpfiles.cache"
|
||||
static struct grpcache
|
||||
{
|
||||
struct grpcache *next;
|
||||
int32_t size;
|
||||
int32_t mtime;
|
||||
int32_t crcval;
|
||||
char name[BMAX_PATH];
|
||||
}
|
||||
*grpcache = NULL, *usedgrpcache = NULL;
|
||||
|
||||
static int32_t LoadGroupsCache(void)
|
||||
{
|
||||
struct grpcache *fg;
|
||||
|
||||
int32_t fsize, fmtime, fcrcval;
|
||||
char *fname;
|
||||
|
||||
scriptfile *script;
|
||||
|
||||
script = scriptfile_fromfile(GRPCACHEFILE);
|
||||
if (!script) return -1;
|
||||
|
||||
while (!scriptfile_eof(script))
|
||||
{
|
||||
if (scriptfile_getstring(script, &fname)) break; // filename
|
||||
if (scriptfile_getnumber(script, &fsize)) break; // filesize
|
||||
if (scriptfile_getnumber(script, &fmtime)) break; // modification time
|
||||
if (scriptfile_getnumber(script, &fcrcval)) break; // crc checksum
|
||||
|
||||
fg = (struct grpcache *)Xcalloc(1, sizeof(struct grpcache));
|
||||
fg->next = grpcache;
|
||||
grpcache = fg;
|
||||
|
||||
Bstrncpy(fg->name, fname, BMAX_PATH);
|
||||
fg->size = fsize;
|
||||
fg->mtime = fmtime;
|
||||
fg->crcval = fcrcval;
|
||||
}
|
||||
|
||||
scriptfile_close(script);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void FreeGroupsCache(void)
|
||||
{
|
||||
while (grpcache)
|
||||
{
|
||||
struct grpcache * const fg = grpcache->next;
|
||||
Xfree(grpcache);
|
||||
grpcache = fg;
|
||||
}
|
||||
}
|
||||
|
||||
static void RemoveGroup(grpfile_t *igrp)
|
||||
{
|
||||
for (grpfile_t *prev = NULL, *grp = foundgrps; grp; grp=grp->next)
|
||||
{
|
||||
if (grp == igrp)
|
||||
{
|
||||
if (grp == foundgrps)
|
||||
foundgrps = grp->next;
|
||||
else
|
||||
prev->next = grp->next;
|
||||
|
||||
Xfree((char *)grp->filename);
|
||||
Xfree(grp);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
prev = grp;
|
||||
}
|
||||
}
|
||||
|
||||
grpfile_t * FindGroup(int32_t crcval)
|
||||
{
|
||||
grpfile_t *grp;
|
||||
|
||||
for (grp = foundgrps; grp; grp=grp->next)
|
||||
{
|
||||
if (grp->type->crcval == crcval)
|
||||
return grp;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#ifndef USE_PHYSFS
|
||||
static grpinfo_t const * FindGrpInfo(int32_t crcval, int32_t size)
|
||||
{
|
||||
grpinfo_t *grpinfo;
|
||||
|
||||
for (grpinfo = listgrps; grpinfo; grpinfo=grpinfo->next)
|
||||
{
|
||||
if (grpinfo->crcval == crcval && grpinfo->size == size)
|
||||
return grpinfo;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void ProcessGroups(BUILDVFS_FIND_REC *srch)
|
||||
{
|
||||
BUILDVFS_FIND_REC *sidx;
|
||||
struct grpcache *fg, *fgg;
|
||||
char *fn;
|
||||
struct Bstat st;
|
||||
|
||||
static constexpr int ReadSize = 65536;
|
||||
|
||||
auto buf = (uint8_t *)Xmalloc(ReadSize);
|
||||
|
||||
for (sidx = srch; sidx; sidx = sidx->next)
|
||||
{
|
||||
for (fg = grpcache; fg; fg = fg->next)
|
||||
{
|
||||
if (!Bstrcmp(fg->name, sidx->name)) break;
|
||||
}
|
||||
|
||||
if (fg)
|
||||
{
|
||||
if (findfrompath(sidx->name, &fn)) continue; // failed to resolve the filename
|
||||
if (Bstat(fn, &st))
|
||||
{
|
||||
Xfree(fn);
|
||||
continue;
|
||||
} // failed to stat the file
|
||||
Xfree(fn);
|
||||
if (fg->size == (int32_t)st.st_size && fg->mtime == (int32_t)st.st_mtime)
|
||||
{
|
||||
grpinfo_t const * const grptype = FindGrpInfo(fg->crcval, fg->size);
|
||||
if (grptype)
|
||||
{
|
||||
grpfile_t * const grp = (grpfile_t *)Xcalloc(1, sizeof(grpfile_t));
|
||||
grp->filename = Xstrdup(sidx->name);
|
||||
grp->type = grptype;
|
||||
grp->next = foundgrps;
|
||||
foundgrps = grp;
|
||||
}
|
||||
|
||||
fgg = (struct grpcache *)Xcalloc(1, sizeof(struct grpcache));
|
||||
strcpy(fgg->name, fg->name);
|
||||
fgg->size = fg->size;
|
||||
fgg->mtime = fg->mtime;
|
||||
fgg->crcval = fg->crcval;
|
||||
fgg->next = usedgrpcache;
|
||||
usedgrpcache = fgg;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
int32_t b, fh;
|
||||
int32_t crcval = 0;
|
||||
|
||||
fh = openfrompath(sidx->name, BO_RDONLY|BO_BINARY, BS_IREAD);
|
||||
if (fh < 0) continue;
|
||||
if (Bfstat(fh, &st)) continue;
|
||||
|
||||
initprintf(" Checksumming %s...", sidx->name);
|
||||
do
|
||||
{
|
||||
b = read(fh, buf, ReadSize);
|
||||
if (b > 0) crcval = Bcrc32((uint8_t *)buf, b, crcval);
|
||||
}
|
||||
while (b == ReadSize);
|
||||
close(fh);
|
||||
initprintf(" Done\n");
|
||||
|
||||
grpinfo_t const * const grptype = FindGrpInfo(crcval, st.st_size);
|
||||
if (grptype)
|
||||
{
|
||||
grpfile_t * const grp = (grpfile_t *)Xcalloc(1, sizeof(grpfile_t));
|
||||
grp->filename = Xstrdup(sidx->name);
|
||||
grp->type = grptype;
|
||||
grp->next = foundgrps;
|
||||
foundgrps = grp;
|
||||
}
|
||||
|
||||
fgg = (struct grpcache *)Xcalloc(1, sizeof(struct grpcache));
|
||||
Bstrncpy(fgg->name, sidx->name, BMAX_PATH);
|
||||
fgg->size = st.st_size;
|
||||
fgg->mtime = st.st_mtime;
|
||||
fgg->crcval = crcval;
|
||||
fgg->next = usedgrpcache;
|
||||
usedgrpcache = fgg;
|
||||
}
|
||||
}
|
||||
|
||||
Xfree(buf);
|
||||
}
|
||||
#endif
|
||||
|
||||
int32_t ScanGroups(void)
|
||||
{
|
||||
#ifndef USE_PHYSFS
|
||||
struct grpcache *fg, *fgg;
|
||||
|
||||
initprintf("Searching for game data...\n");
|
||||
|
||||
LoadGameList();
|
||||
LoadGroupsCache();
|
||||
|
||||
static char const *extensions[] =
|
||||
{
|
||||
"*.grp",
|
||||
"*.ssi",
|
||||
"*.dat",
|
||||
};
|
||||
|
||||
for (char const *extension : extensions)
|
||||
{
|
||||
BUILDVFS_FIND_REC *srch = klistpath("/", extension, BUILDVFS_FIND_FILE);
|
||||
ProcessGroups(srch);
|
||||
klistfree(srch);
|
||||
}
|
||||
|
||||
FreeGroupsCache();
|
||||
|
||||
for (grpfile_t *grp = foundgrps; grp; grp=grp->next)
|
||||
{
|
||||
if (grp->type->dependency)
|
||||
{
|
||||
if (FindGroup(grp->type->dependency) == NULL) // couldn't find dependency
|
||||
{
|
||||
//initprintf("removing %s\n", grp->name);
|
||||
RemoveGroup(grp);
|
||||
grp = foundgrps;
|
||||
// start from the beginning so we can remove anything that depended on this grp
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (usedgrpcache)
|
||||
{
|
||||
int32_t i = 0;
|
||||
buildvfs_FILE fp = buildvfs_fopen_write(GRPCACHEFILE);
|
||||
if (fp)
|
||||
{
|
||||
for (fg = usedgrpcache; fg; fg=fgg)
|
||||
{
|
||||
fgg = fg->next;
|
||||
fprintf(fp, "\"%s\" %d %d %d\n", fg->name, fg->size, fg->mtime, fg->crcval);
|
||||
Xfree(fg);
|
||||
i++;
|
||||
}
|
||||
buildvfs_fclose(fp);
|
||||
}
|
||||
// initprintf("Found %d recognized GRP %s.\n",i,i>1?"files":"file");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
initprintf("Found no recognized game data!\n");
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void FreeGroups(void)
|
||||
{
|
||||
while (foundgrps)
|
||||
{
|
||||
Xfree((char *)foundgrps->filename);
|
||||
grpfile_t * const fg = foundgrps->next;
|
||||
Xfree(foundgrps);
|
||||
foundgrps = fg;
|
||||
}
|
||||
|
||||
FreeGameList();
|
||||
}
|
||||
END_PS_NS
|
|
@ -1,80 +0,0 @@
|
|||
//-------------------------------------------------------------------------
|
||||
/*
|
||||
Copyright (C) 2010 EDuke32 developers and contributors
|
||||
|
||||
This file is part of EDuke32.
|
||||
|
||||
EDuke32 is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License version 2
|
||||
as published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
#ifndef grpscan_h_
|
||||
#define grpscan_h_
|
||||
|
||||
BEGIN_PS_NS
|
||||
|
||||
#define MAXLISTNAMELEN 32
|
||||
|
||||
// List of internally-known GRP files
|
||||
#define POWERSLAVE_CRC (int32_t)0x303CBD89
|
||||
// TODO:
|
||||
#define EXHUMED_CRC (int32_t)0xE3B172F1
|
||||
|
||||
#define GAMEFLAG_POWERSLAVE 0x00000001
|
||||
#define GAMEFLAG_EXHUMED 0x00000002
|
||||
//#define GAMEFLAG_ADDON 0x00000010
|
||||
//#define GAMEFLAG_SHAREWARE 0x00000020
|
||||
#define GAMEFLAGMASK 0x000000FF // flags allowed from grpinfo
|
||||
|
||||
typedef struct internalgrpinfo_t {
|
||||
char const *name;
|
||||
int32_t const crcval;
|
||||
int32_t const size;
|
||||
int32_t const game;
|
||||
int32_t const dependency;
|
||||
// char const *scriptname;
|
||||
// void(*postprocessing)(int32_t);
|
||||
} internalgrpinfo_t;
|
||||
|
||||
typedef struct grpinfo_t {
|
||||
char *name;
|
||||
int32_t crcval;
|
||||
int32_t size;
|
||||
int32_t game;
|
||||
int32_t dependency;
|
||||
// char *scriptname;
|
||||
char *defname;
|
||||
// char *rtsname;
|
||||
// void (*postprocessing)(int32_t);
|
||||
struct grpinfo_t *next;
|
||||
} grpinfo_t;
|
||||
|
||||
typedef struct grpfile_t {
|
||||
char *filename;
|
||||
struct grpinfo_t const *type;
|
||||
struct grpfile_t *next;
|
||||
} grpfile_t;
|
||||
|
||||
extern grpfile_t *foundgrps;
|
||||
extern grpinfo_t *listgrps;
|
||||
|
||||
extern grpfile_t * FindGroup(int32_t crcval);
|
||||
|
||||
int32_t ScanGroups(void);
|
||||
void FreeGroups(void);
|
||||
|
||||
END_PS_NS
|
||||
|
||||
#endif
|
|
@ -32,7 +32,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
#include "grenade.h"
|
||||
#include "lighting.h"
|
||||
#include "light.h"
|
||||
#include "input.h"
|
||||
#include "ps_input.h"
|
||||
#include "util.h"
|
||||
#include "anims.h"
|
||||
#include "runlist.h"
|
||||
|
|
|
@ -40,7 +40,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
#include "menu.h"
|
||||
#include "lighting.h"
|
||||
#include "anims.h"
|
||||
#include "input.h"
|
||||
#include "ps_input.h"
|
||||
#include "util.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
@ -449,7 +449,7 @@ void InstallEngine()
|
|||
{
|
||||
buildvfs_chdir(cwd);
|
||||
if (artLoadFiles("tiles000.art", MAXCACHE1DSIZE) < 0)
|
||||
bail2dos("Failed loading art.");
|
||||
I_Error("Failed loading art.");
|
||||
}
|
||||
buildvfs_chdir(cwd);
|
||||
#ifndef __ANDROID__ //This crashes on *some* Android devices. Small onetime memory leak. TODO fix above function
|
||||
|
@ -457,7 +457,7 @@ void InstallEngine()
|
|||
#endif
|
||||
}
|
||||
else if (artLoadFiles("tiles000.art",MAXCACHE1DSIZE) < 0)
|
||||
bail2dos("Failed loading art.");
|
||||
I_Error("Failed loading art.");
|
||||
|
||||
// TEMP
|
||||
|
||||
|
@ -502,7 +502,7 @@ void InstallEngine()
|
|||
if (++resIdx == validmodecnt)
|
||||
{
|
||||
if (bpp == 8)
|
||||
bail2dos("Fatal error: unable to set any video mode!");
|
||||
I_Error("Fatal error: unable to set any video mode!");
|
||||
|
||||
resIdx = savedIdx;
|
||||
bpp = 8;
|
||||
|
|
|
@ -16,7 +16,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
*/
|
||||
//-------------------------------------------------------------------------
|
||||
#include "ns.h"
|
||||
#include "input.h"
|
||||
#include "ps_input.h"
|
||||
#include "engine.h"
|
||||
#include "exhumed.h"
|
||||
#include "player.h"
|
||||
|
@ -73,7 +73,7 @@ void InitInput()
|
|||
void ClearSpaceBar(short nPlayer)
|
||||
{
|
||||
sPlayerInput[nPlayer].buttons &= 0x0FB;
|
||||
CONTROL_ClearButton(gamefunc_Open);
|
||||
buttonMap.ClearButton(gamefunc_Open);
|
||||
}
|
||||
|
||||
void GetLocalInput()
|
||||
|
@ -81,22 +81,22 @@ void GetLocalInput()
|
|||
int i;
|
||||
for (i = 6; i >= 0; i--)
|
||||
{
|
||||
if (BUTTON(gamefunc_Weapon_1+i))
|
||||
if (buttonMap.ButtonDown(gamefunc_Weapon_1+i))
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
|
||||
if (PlayerList[nLocalPlayer].nHealth)
|
||||
{
|
||||
lLocalButtons = (BUTTON(gamefunc_Crouch) << 4) | (BUTTON(gamefunc_Fire) << 3)
|
||||
| (BUTTON(gamefunc_Jump)<<0) | (i<<13);
|
||||
lLocalButtons = (buttonMap.ButtonDown(gamefunc_Crouch) << 4) | (buttonMap.ButtonDown(gamefunc_Fire) << 3)
|
||||
| (buttonMap.ButtonDown(gamefunc_Jump)<<0) | (i<<13);
|
||||
}
|
||||
else
|
||||
{
|
||||
lLocalButtons = 0;
|
||||
}
|
||||
|
||||
lLocalButtons |= BUTTON(gamefunc_Open) << 2;
|
||||
lLocalButtons |= buttonMap.ButtonDown(gamefunc_Open) << 2;
|
||||
|
||||
// TODO ExecRecord(&sPlayerInput[nLocalPlayer], sizeof(PlayerInput));
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
#include "engine.h"
|
||||
#include "random.h"
|
||||
#include "init.h"
|
||||
#include "input.h"
|
||||
#include "ps_input.h"
|
||||
#include "object.h"
|
||||
|
||||
BEGIN_PS_NS
|
||||
|
|
|
@ -223,7 +223,7 @@ void FuncLava(int a, int nDamage, int nRun)
|
|||
{
|
||||
default:
|
||||
{
|
||||
DebugOut("unknown msg %d for Lava\n", a & 0x7F0000);
|
||||
Printf("unknown msg %d for Lava\n", a & 0x7F0000);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -138,7 +138,7 @@ void FuncLion(int a, int nDamage, int nRun)
|
|||
{
|
||||
default:
|
||||
{
|
||||
DebugOut("unknown msg %d for Lion\n", nMessage);
|
||||
Printf("unknown msg %d for Lion\n", nMessage);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
#include "sound.h"
|
||||
#include "names.h"
|
||||
#include "init.h"
|
||||
#include "input.h"
|
||||
#include "ps_input.h"
|
||||
#include "gun.h"
|
||||
#include "view.h"
|
||||
#include "object.h"
|
||||
|
|
|
@ -58,7 +58,7 @@ palette_t moviepal[256];
|
|||
int ReadFrame(FILE *fp)
|
||||
{
|
||||
static int nFrame = 0;
|
||||
DebugOut("Reading frame %d...\n", nFrame);
|
||||
Printf("Reading frame %d...\n", nFrame);
|
||||
nFrame++;
|
||||
|
||||
uint8_t nType;
|
||||
|
@ -100,14 +100,14 @@ int ReadFrame(FILE *fp)
|
|||
}
|
||||
case kFrameSound:
|
||||
{
|
||||
DebugOut("Reading sound block size %d...\n", nSize);
|
||||
Printf("Reading sound block size %d...\n", nSize);
|
||||
// TODO - just skip for now
|
||||
fseek(fp, nSize, SEEK_CUR);
|
||||
continue;
|
||||
}
|
||||
case kFrameImage:
|
||||
{
|
||||
DebugOut("Reading image block size %d...\n", nSize);
|
||||
Printf("Reading image block size %d...\n", nSize);
|
||||
if (nSize == 0) {
|
||||
continue;
|
||||
}
|
||||
|
@ -173,11 +173,11 @@ void PlayMovie(const char *fileName)
|
|||
FILE *fp = fopen(buffer, "rb");
|
||||
if (fp == NULL)
|
||||
{
|
||||
DebugOut("Can't open movie file '%s' on CD-ROM\n", buffer);
|
||||
Printf("Can't open movie file '%s' on CD-ROM\n", buffer);
|
||||
fp = fopen(fileName, "rb");
|
||||
if (fp == NULL)
|
||||
{
|
||||
DebugOut("Can't open movie file on hard drive\n");
|
||||
Printf("Can't open movie file on hard drive\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -523,7 +523,7 @@ void FuncMummy(int a, int nDamage, int nRun)
|
|||
|
||||
default:
|
||||
{
|
||||
DebugOut("unknown msg %d for Mummy\n", a & 0x7F0000);
|
||||
Printf("unknown msg %d for Mummy\n", a & 0x7F0000);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
#include "typedefs.h"
|
||||
#include "network.h"
|
||||
#include "serial.h"
|
||||
#include "input.h"
|
||||
#include "ps_input.h"
|
||||
|
||||
BEGIN_PS_NS
|
||||
|
||||
|
|
|
@ -797,7 +797,7 @@ void InitWallFace()
|
|||
int BuildWallFace(short nChannel, short nWall, short nCount, ...)
|
||||
{
|
||||
if (WallFaceCount <= 0) {
|
||||
bail2dos("Too many wall faces!\n");
|
||||
I_Error("Too many wall faces!\n");
|
||||
}
|
||||
|
||||
WallFaceCount--;
|
||||
|
@ -898,7 +898,7 @@ int BuildSlide(int nChannel, int edx, int ebx, int ecx, int arg1, int arg2, int
|
|||
int nVal = ecx;
|
||||
|
||||
if (SlideCount <= 0) {
|
||||
bail2dos("Too many slides!\n");
|
||||
I_Error("Too many slides!\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -1162,7 +1162,7 @@ int BuildTrap(int nSprite, int edx, int ebx, int ecx)
|
|||
int var_10 = ecx;
|
||||
|
||||
if (nTraps >= kMaxTraps) {
|
||||
bail2dos("Too many traps!\n");
|
||||
I_Error("Too many traps!\n");
|
||||
}
|
||||
|
||||
short nTrap = nTraps;
|
||||
|
@ -1828,7 +1828,7 @@ void FuncEnergyBlock(int a, int nDamage, int nRun)
|
|||
int BuildObject(short nSprite, int nOjectType, int nHitag)
|
||||
{
|
||||
if (ObjectCount >= kMaxObjects) {
|
||||
bail2dos("Too many objects!\n");
|
||||
I_Error("Too many objects!\n");
|
||||
}
|
||||
|
||||
short nObject = ObjectCount;
|
||||
|
@ -2139,7 +2139,7 @@ FUNCOBJECT_GOTO:
|
|||
void BuildDrip(int nSprite)
|
||||
{
|
||||
if (nDrips >= kMaxDrips) {
|
||||
bail2dos("Too many drips!\n");
|
||||
I_Error("Too many drips!\n");
|
||||
}
|
||||
|
||||
sDrip[nDrips].nSprite = nSprite;
|
||||
|
@ -2239,7 +2239,7 @@ void SnapBobs(short nSectorA, short nSectorB)
|
|||
void AddSectorBob(int nSector, int nHitag, int bx)
|
||||
{
|
||||
if (nBobs >= kMaxBobs) {
|
||||
bail2dos("Too many bobs!\n");
|
||||
I_Error("Too many bobs!\n");
|
||||
}
|
||||
|
||||
sBob[nBobs].field_3 = bx;
|
||||
|
@ -2283,7 +2283,7 @@ int FindTrail(int nVal)
|
|||
void ProcessTrailSprite(int nSprite, int nLotag, int nHitag)
|
||||
{
|
||||
if (nTrailPoints >= 100) {
|
||||
bail2dos("Too many trail point sprites (900-949)... increase MAX_TRAILPOINTS\n");
|
||||
I_Error("Too many trail point sprites (900-949)... increase MAX_TRAILPOINTS\n");
|
||||
}
|
||||
|
||||
short nPoint = nTrailPoints;
|
||||
|
@ -2347,7 +2347,7 @@ void ProcessTrailSprite(int nSprite, int nLotag, int nHitag)
|
|||
void AddMovingSector(int nSector, int edx, int ebx, int ecx)
|
||||
{
|
||||
if (nMoveSects >= kMaxMoveSects) {
|
||||
bail2dos("Too many moving sectors\n");
|
||||
I_Error("Too many moving sectors\n");
|
||||
}
|
||||
|
||||
CreatePushBlock(nSector);
|
||||
|
|
|
@ -48,7 +48,7 @@ int osdcmd_restartvid(osdcmdptr_t UNUSED(parm))
|
|||
UNREFERENCED_CONST_PARAMETER(parm);
|
||||
videoResetMode();
|
||||
if (videoSetGameMode(gSetup.fullscreen,gSetup.xdim,gSetup.ydim,gSetup.bpp,0))
|
||||
bail2dos("restartvid: Reset failed...\n");
|
||||
I_Error("restartvid: Reset failed...\n");
|
||||
onvideomodechange(gSetup.bpp>8);
|
||||
UpdateScreenSize();
|
||||
|
||||
|
@ -92,7 +92,7 @@ static int osdcmd_vidmode(osdcmdptr_t parm)
|
|||
{
|
||||
initprintf("vidmode: Mode change failed!\n");
|
||||
if (videoSetGameMode(gSetup.fullscreen, gSetup.xdim, gSetup.ydim, gSetup.bpp, upscalefactor))
|
||||
bail2dos("vidmode: Reset failed!\n");
|
||||
I_Error("vidmode: Reset failed!\n");
|
||||
}
|
||||
gSetup.bpp = newbpp;
|
||||
gSetup.xdim = newwidth;
|
||||
|
@ -142,31 +142,6 @@ static int osdcmd_button(osdcmdptr_t parm)
|
|||
return OSDCMD_OK;
|
||||
}
|
||||
|
||||
static int osdcmd_unbound(osdcmdptr_t parm)
|
||||
{
|
||||
if (parm->numparms != 1)
|
||||
return OSDCMD_OK;
|
||||
|
||||
int const gameFunc = CONFIG_FunctionNameToNum(parm->parms[0]);
|
||||
|
||||
if (gameFunc != -1)
|
||||
KeyboardKeys[gameFunc][0] = 0;
|
||||
|
||||
return OSDCMD_OK;
|
||||
}
|
||||
|
||||
static int osdcmd_screenshot(osdcmdptr_t parm)
|
||||
{
|
||||
// KB_ClearKeysDown();
|
||||
static const char *fn = "capt0000.png";
|
||||
|
||||
if (parm->numparms == 1 && !Bstrcasecmp(parm->parms[0], "tga"))
|
||||
videoCaptureScreenTGA(fn, 0);
|
||||
else videoCaptureScreen(fn, 0);
|
||||
|
||||
return OSDCMD_OK;
|
||||
}
|
||||
|
||||
static int osdcmd_cvar_set_game(osdcmdptr_t parm)
|
||||
{
|
||||
int const r = osdcmd_cvar_set(parm);
|
||||
|
@ -380,36 +355,13 @@ int32_t registerosdcommands(void)
|
|||
//OSD_RegisterFunction("restartmap", "restartmap: restarts the current map", osdcmd_restartmap);
|
||||
//OSD_RegisterFunction("restartsound","restartsound: reinitializes the sound system",osdcmd_restartsound);
|
||||
OSD_RegisterFunction("restartvid","restartvid: reinitializes the video mode",osdcmd_restartvid);
|
||||
OSD_RegisterFunction("screenshot","screenshot [format]: takes a screenshot.", osdcmd_screenshot);
|
||||
|
||||
//OSD_RegisterFunction("spawn","spawn <picnum> [palnum] [cstat] [ang] [x y z]: spawns a sprite with the given properties",osdcmd_spawn);
|
||||
|
||||
OSD_RegisterFunction("unbound", NULL, osdcmd_unbound);
|
||||
|
||||
OSD_RegisterFunction("vidmode","vidmode <xdim> <ydim> <bpp> <fullscreen>: change the video mode",osdcmd_vidmode);
|
||||
#ifdef USE_OPENGL
|
||||
baselayer_osdcmd_vidmode_func = osdcmd_vidmode;
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void GAME_onshowosd(int shown)
|
||||
{
|
||||
// G_UpdateScreenArea();
|
||||
|
||||
mouseLockToWindow((!shown) + 2);
|
||||
|
||||
//osdshown = shown;
|
||||
|
||||
// XXX: it's weird to fake a keypress like this.
|
||||
// if (numplayers == 1 && ((shown && !ud.pause_on) || (!shown && ud.pause_on)))
|
||||
// KB_KeyDown[sc_Pause] = 1;
|
||||
}
|
||||
|
||||
void GAME_clearbackground(int numcols, int numrows)
|
||||
{
|
||||
COMMON_clearbackground(numcols, numrows);
|
||||
}
|
||||
|
||||
END_PS_NS
|
||||
|
|
|
@ -31,7 +31,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
#include "bubbles.h"
|
||||
#include "random.h"
|
||||
#include "ra.h"
|
||||
#include "input.h"
|
||||
#include "ps_input.h"
|
||||
#include "light.h"
|
||||
#include "status.h"
|
||||
#include "mouse.h"
|
||||
|
@ -194,7 +194,7 @@ void PlayerInterruptKeys()
|
|||
}
|
||||
|
||||
// JBF: Run key behaviour is selectable
|
||||
int const playerRunning = (runkey_mode) ? (BUTTON(gamefunc_Run) | auto_run) : (auto_run ^ BUTTON(gamefunc_Run));
|
||||
int const playerRunning = (runkey_mode) ? (buttonMap.ButtonDown(gamefunc_Run) | auto_run) : (auto_run ^ buttonMap.ButtonDown(gamefunc_Run));
|
||||
int const turnAmount = playerRunning ? 12 : 8;
|
||||
int const keyMove = playerRunning ? 12 : 6;
|
||||
constexpr int const analogTurnAmount = 12;
|
||||
|
@ -202,7 +202,7 @@ void PlayerInterruptKeys()
|
|||
int fvel = 0, svel = 0;
|
||||
fix16_t q16avel = 0, q16horz = 0;
|
||||
|
||||
if (BUTTON(gamefunc_Strafe))
|
||||
if (buttonMap.ButtonDown(gamefunc_Strafe))
|
||||
{
|
||||
static int strafeyaw;
|
||||
|
||||
|
@ -228,12 +228,12 @@ void PlayerInterruptKeys()
|
|||
svel -= info.dx * keyMove / analogExtent;
|
||||
fvel -= info.dz * keyMove / analogExtent;
|
||||
|
||||
if (BUTTON(gamefunc_Strafe))
|
||||
if (buttonMap.ButtonDown(gamefunc_Strafe))
|
||||
{
|
||||
if (BUTTON(gamefunc_Turn_Left))
|
||||
if (buttonMap.ButtonDown(gamefunc_Turn_Left))
|
||||
svel -= -keyMove;
|
||||
|
||||
if (BUTTON(gamefunc_Turn_Right))
|
||||
if (buttonMap.ButtonDown(gamefunc_Turn_Right))
|
||||
svel -= keyMove;
|
||||
}
|
||||
else
|
||||
|
@ -241,14 +241,14 @@ void PlayerInterruptKeys()
|
|||
static int turn = 0;
|
||||
static int counter = 0;
|
||||
// normal, non strafing movement
|
||||
if (BUTTON(gamefunc_Turn_Left))
|
||||
if (buttonMap.ButtonDown(gamefunc_Turn_Left))
|
||||
{
|
||||
turn -= 2;
|
||||
|
||||
if (turn < -turnAmount)
|
||||
turn = -turnAmount;
|
||||
}
|
||||
else if (BUTTON(gamefunc_Turn_Right))
|
||||
else if (buttonMap.ButtonDown(gamefunc_Turn_Right))
|
||||
{
|
||||
turn += 2;
|
||||
|
||||
|
@ -274,16 +274,16 @@ void PlayerInterruptKeys()
|
|||
q16avel += fix16_from_int(turn<<2);
|
||||
}
|
||||
|
||||
if (BUTTON(gamefunc_Strafe_Left))
|
||||
if (buttonMap.ButtonDown(gamefunc_Strafe_Left))
|
||||
svel += keyMove;
|
||||
|
||||
if (BUTTON(gamefunc_Strafe_Right))
|
||||
if (buttonMap.ButtonDown(gamefunc_Strafe_Right))
|
||||
svel += -keyMove;
|
||||
|
||||
if (BUTTON(gamefunc_Move_Forward))
|
||||
if (buttonMap.ButtonDown(gamefunc_Move_Forward))
|
||||
fvel += keyMove;
|
||||
|
||||
if (BUTTON(gamefunc_Move_Backward))
|
||||
if (buttonMap.ButtonDown(gamefunc_Move_Backward))
|
||||
fvel += -keyMove;
|
||||
|
||||
fvel = clamp(fvel, -12, 12);
|
||||
|
@ -312,7 +312,7 @@ void PlayerInterruptKeys()
|
|||
|
||||
inita &= kAngleMask;
|
||||
|
||||
if (BUTTON(gamefunc_Run))
|
||||
if (buttonMap.ButtonDown(gamefunc_Run))
|
||||
{
|
||||
nXVel = Cos(inita) * 12;
|
||||
nYVel = Sin(inita) * 12;
|
||||
|
@ -324,12 +324,12 @@ void PlayerInterruptKeys()
|
|||
}
|
||||
|
||||
// loc_18E60
|
||||
if (BUTTON(gamefunc_Move_Forward))
|
||||
if (buttonMap.ButtonDown(gamefunc_Move_Forward))
|
||||
{
|
||||
lPlayerXVel += nXVel;
|
||||
lPlayerYVel += nYVel;
|
||||
}
|
||||
else if (BUTTON(gamefunc_Move_Backward))
|
||||
else if (buttonMap.ButtonDown(gamefunc_Move_Backward))
|
||||
{
|
||||
lPlayerXVel -= nXVel;
|
||||
lPlayerYVel -= nYVel;
|
||||
|
@ -346,10 +346,10 @@ void PlayerInterruptKeys()
|
|||
}
|
||||
|
||||
if (mouseaiming)
|
||||
aimmode = BUTTON(gamefunc_Mouseview);
|
||||
aimmode = buttonMap.ButtonDown(gamefunc_Mouseview);
|
||||
else
|
||||
{
|
||||
CONTROL_ClearButton(gamefunc_Mouseview);
|
||||
buttonMap.ClearButton(gamefunc_Mouseview);
|
||||
aimmode = !aimmode;
|
||||
}
|
||||
|
||||
|
@ -371,7 +371,7 @@ void PlayerInterruptKeys()
|
|||
}
|
||||
else
|
||||
{
|
||||
if (BUTTON(gamefunc_Run))
|
||||
if (buttonMap.ButtonDown(gamefunc_Run))
|
||||
{
|
||||
lPlayerXVel += Cos(inita) * ((-info.mousey) >> 7);
|
||||
lPlayerYVel += Sin(inita) * ((-info.mousey) >> 7);
|
||||
|
@ -385,33 +385,33 @@ void PlayerInterruptKeys()
|
|||
}
|
||||
|
||||
// loc_18FD4
|
||||
if (BUTTON(gamefunc_Strafe_Left))
|
||||
if (buttonMap.ButtonDown(gamefunc_Strafe_Left))
|
||||
{
|
||||
lPlayerXVel += nYVel / 4;
|
||||
lPlayerYVel -= nXVel / 4;
|
||||
}
|
||||
else if (BUTTON(gamefunc_Strafe_Right))
|
||||
else if (buttonMap.ButtonDown(gamefunc_Strafe_Right))
|
||||
{
|
||||
lPlayerXVel -= nYVel / 4;
|
||||
lPlayerYVel += nXVel / 4;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (BUTTON(gamefunc_Strafe))
|
||||
if (buttonMap.ButtonDown(gamefunc_Strafe))
|
||||
{
|
||||
if (BUTTON(gamefunc_Turn_Left))
|
||||
if (buttonMap.ButtonDown(gamefunc_Turn_Left))
|
||||
{
|
||||
lPlayerXVel += nYVel;
|
||||
lPlayerYVel -= nXVel;
|
||||
}
|
||||
else if (BUTTON(gamefunc_Turn_Right))
|
||||
else if (buttonMap.ButtonDown(gamefunc_Turn_Right))
|
||||
{
|
||||
lPlayerXVel -= nYVel;
|
||||
lPlayerYVel += nXVel;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (BUTTON(gamefunc_Run))
|
||||
if (buttonMap.ButtonDown(gamefunc_Run))
|
||||
{
|
||||
lPlayerXVel -= Sin(inita) * (info.dyaw >> 5);
|
||||
lPlayerYVel += Sin(inita + 512) * (info.dyaw >> 5);
|
||||
|
@ -426,11 +426,11 @@ void PlayerInterruptKeys()
|
|||
else
|
||||
{
|
||||
// normal, non strafing movement
|
||||
if (BUTTON(gamefunc_Turn_Left))
|
||||
if (buttonMap.ButtonDown(gamefunc_Turn_Left))
|
||||
{
|
||||
nPlayerDAng -= 2;
|
||||
|
||||
if (BUTTON(gamefunc_Run))
|
||||
if (buttonMap.ButtonDown(gamefunc_Run))
|
||||
{
|
||||
if (nPlayerDAng < -12)
|
||||
nPlayerDAng = -12;
|
||||
|
@ -440,11 +440,11 @@ void PlayerInterruptKeys()
|
|||
nPlayerDAng = -8;
|
||||
}
|
||||
}
|
||||
else if (BUTTON(gamefunc_Turn_Right))
|
||||
else if (buttonMap.ButtonDown(gamefunc_Turn_Right))
|
||||
{
|
||||
nPlayerDAng += 2;
|
||||
|
||||
if (BUTTON(gamefunc_Run))
|
||||
if (buttonMap.ButtonDown(gamefunc_Run))
|
||||
{
|
||||
if (nPlayerDAng > 12)
|
||||
nPlayerDAng = 12;
|
||||
|
@ -1050,7 +1050,7 @@ void DoKenTest()
|
|||
}
|
||||
|
||||
if (nextspritesect[i] == i) {
|
||||
bail2dos("ERROR in Ken's linked list!\n");
|
||||
I_Error("ERROR in Ken's linked list!\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3084,7 +3084,7 @@ do_default_b:
|
|||
if (nPlayer == nLocalPlayer)
|
||||
{
|
||||
// TODO - tidy / consolidate repeating blocks of code here?
|
||||
if (BUTTON(gamefunc_Look_Up))
|
||||
if (buttonMap.ButtonDown(gamefunc_Look_Up))
|
||||
{
|
||||
bLockPan = kFalse;
|
||||
if (nVertPan[nPlayer] < F16(180)) {
|
||||
|
@ -3094,7 +3094,7 @@ do_default_b:
|
|||
bPlayerPan = kTrue;
|
||||
nDestVertPan[nPlayer] = nVertPan[nPlayer];
|
||||
}
|
||||
else if (BUTTON(gamefunc_Look_Down))
|
||||
else if (buttonMap.ButtonDown(gamefunc_Look_Down))
|
||||
{
|
||||
bLockPan = kFalse;
|
||||
if (nVertPan[nPlayer] > F16(4)) {
|
||||
|
@ -3104,14 +3104,14 @@ do_default_b:
|
|||
bPlayerPan = kTrue;
|
||||
nDestVertPan[nPlayer] = nVertPan[nPlayer];
|
||||
}
|
||||
else if (BUTTON(gamefunc_Look_Straight))
|
||||
else if (buttonMap.ButtonDown(gamefunc_Look_Straight))
|
||||
{
|
||||
bLockPan = kFalse;
|
||||
bPlayerPan = kFalse;
|
||||
nVertPan[nPlayer] = F16(92);
|
||||
nDestVertPan[nPlayer] = F16(92);
|
||||
}
|
||||
else if (BUTTON(gamefunc_Aim_Up))
|
||||
else if (buttonMap.ButtonDown(gamefunc_Aim_Up))
|
||||
{
|
||||
bLockPan = kTrue;
|
||||
if (nVertPan[nPlayer] < F16(180)) {
|
||||
|
@ -3121,7 +3121,7 @@ do_default_b:
|
|||
bPlayerPan = kTrue;
|
||||
nDestVertPan[nPlayer] = nVertPan[nPlayer];
|
||||
}
|
||||
else if (BUTTON(gamefunc_Aim_Down))
|
||||
else if (buttonMap.ButtonDown(gamefunc_Aim_Down))
|
||||
{
|
||||
bLockPan = kTrue;
|
||||
if (nVertPan[nPlayer] > F16(4)) {
|
||||
|
|
|
@ -322,7 +322,7 @@ void BuildTail()
|
|||
tailspr[i] = nTailSprite;
|
||||
|
||||
if (nTailSprite < 0) {
|
||||
bail2dos("Can't create queen's tail!\n");
|
||||
I_Error("Can't create queen's tail!\n");
|
||||
}
|
||||
|
||||
sprite[nTailSprite].lotag = runlist_HeadRun() + 1;
|
||||
|
|
|
@ -23,7 +23,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
#include "player.h"
|
||||
#include "move.h"
|
||||
#include "sequence.h"
|
||||
#include "input.h"
|
||||
#include "ps_input.h"
|
||||
#include "gun.h"
|
||||
#include "bullet.h"
|
||||
#include <string.h>
|
||||
|
@ -162,7 +162,7 @@ void FuncRa(int a, int nDamage, int nRun)
|
|||
{
|
||||
default:
|
||||
{
|
||||
DebugOut("unknown msg %d for Ra\n", a & 0x7F0000);
|
||||
Printf("unknown msg %d for Ra\n", a & 0x7F0000);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -191,7 +191,7 @@ void FuncRat(int a, int nDamage, int nRun)
|
|||
{
|
||||
default:
|
||||
{
|
||||
DebugOut("unknown msg %d for Rathead\n", nMessage);
|
||||
Printf("unknown msg %d for Rathead\n", nMessage);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -145,7 +145,7 @@ void FuncRex(int a, int nDamage, int nRun)
|
|||
{
|
||||
default:
|
||||
{
|
||||
DebugOut("unknown msg %d for Rex\n", a & 0x7F0000);
|
||||
Printf("unknown msg %d for Rex\n", a & 0x7F0000);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -150,7 +150,7 @@ void FuncRoach(int a, int nDamage, int nRun)
|
|||
{
|
||||
default:
|
||||
{
|
||||
DebugOut("unknown msg %d for Roach\n", a & 0x7F0000);
|
||||
Printf("unknown msg %d for Roach\n", a & 0x7F0000);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -347,7 +347,7 @@ void runlist_PushMoveRun(int eax)
|
|||
int runlist_PopMoveRun()
|
||||
{
|
||||
if (nStackCount <= 0) {
|
||||
bail2dos("PopMoveRun() called inappropriately\n");
|
||||
I_Error("PopMoveRun() called inappropriately\n");
|
||||
}
|
||||
|
||||
nStackCount--;
|
||||
|
|
|
@ -142,7 +142,7 @@ void FuncScorp(int a, int nDamage, int nRun)
|
|||
{
|
||||
default:
|
||||
{
|
||||
DebugOut("unknown msg %d for Scorp\n", a & 0x7F0000);
|
||||
Printf("unknown msg %d for Scorp\n", a & 0x7F0000);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -198,7 +198,7 @@ int seq_ReadSequence(const char *seqName)
|
|||
return 0;
|
||||
}
|
||||
else {
|
||||
bail2dos("Not enough sequences available! Increase array!\n");
|
||||
I_Error("Not enough sequences available! Increase array!\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -225,7 +225,7 @@ int seq_ReadSequence(const char *seqName)
|
|||
return 0;
|
||||
}
|
||||
else {
|
||||
bail2dos("Not enough frames available! Increase FRAMEMAX!\n");
|
||||
I_Error("Not enough frames available! Increase FRAMEMAX!\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -251,7 +251,7 @@ int seq_ReadSequence(const char *seqName)
|
|||
return 0;
|
||||
}
|
||||
else {
|
||||
bail2dos("Not enough chunks available! Increase CHUNKMAX!\n");
|
||||
I_Error("Not enough chunks available! Increase CHUNKMAX!\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -219,7 +219,7 @@ void FuncSoul(int pA, int, int nRun)
|
|||
return;
|
||||
|
||||
default:
|
||||
DebugOut("unknown msg %d for Soul\n", nMessage);
|
||||
Printf("unknown msg %d for Soul\n", nMessage);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -239,7 +239,7 @@ void FuncSet(int a, int nDamage, int nRun)
|
|||
{
|
||||
default:
|
||||
{
|
||||
DebugOut("unknown msg %d for Set\n", nMessage);
|
||||
Printf("unknown msg %d for Set\n", nMessage);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
#include "runlist.h"
|
||||
#include "sequence.h"
|
||||
#include "bullet.h"
|
||||
#include "input.h"
|
||||
#include "ps_input.h"
|
||||
#include "anims.h"
|
||||
#include "lighting.h"
|
||||
#include "sound.h"
|
||||
|
@ -419,7 +419,7 @@ SEARCH_ENEMY:
|
|||
|
||||
default:
|
||||
{
|
||||
DebugOut("unknown msg %x for bullet\n", a & 0x7F0000);
|
||||
Printf("unknown msg %x for bullet\n", a & 0x7F0000);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -350,9 +350,9 @@ void InitFX(void)
|
|||
|
||||
if (FX_Init(NumVoices, NumChannels, MixRate, initdata) != FX_Ok)
|
||||
{
|
||||
DebugOut("Error initializing sound card!\n");
|
||||
Printf("Error initializing sound card!\n");
|
||||
initprintf("Error initializing sound card!\n");
|
||||
DebugOut("ERROR: %s\n", FX_ErrorString(FX_Error));
|
||||
Printf("ERROR: %s\n", FX_ErrorString(FX_Error));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -491,7 +491,7 @@ int LoadSound(const char *sound)
|
|||
}
|
||||
|
||||
if (i >= kMaxSounds)
|
||||
bail2dos("Too many sounds being loaded... increase array size\n");
|
||||
I_Error("Too many sounds being loaded... increase array size\n");
|
||||
|
||||
strncpy(szSoundName[i], sound, kMaxSoundNameLen);
|
||||
|
||||
|
@ -515,14 +515,14 @@ int LoadSound(const char *sound)
|
|||
SoundLen[i] = nSize;
|
||||
g_cache.allocateBlock((intptr_t*)&SoundBuf[i], nSize, &SoundLock[i]);
|
||||
if (!SoundBuf[i])
|
||||
bail2dos("Error allocating buf '%s' to %lld (size=%ld)!\n", buffer, (intptr_t)&SoundBuf[i], nSize);
|
||||
I_Error("Error allocating buf '%s' to %lld (size=%ld)!\n", buffer, (intptr_t)&SoundBuf[i], nSize);
|
||||
|
||||
if (kread(hVoc, SoundBuf[i], nSize) != nSize)
|
||||
bail2dos("Error reading '%s'!\n", buffer);
|
||||
I_Error("Error reading '%s'!\n", buffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
bail2dos("Unable to open sound '%s'!\n", buffer);
|
||||
I_Error("Unable to open sound '%s'!\n", buffer);
|
||||
SoundBuf[i] = NULL;
|
||||
SoundLen[i] = 0;
|
||||
//return hVoc;
|
||||
|
@ -552,7 +552,7 @@ void LoadFX(void)
|
|||
{
|
||||
StaticSound[i] = LoadSound(SoundFiles[i]);
|
||||
if (StaticSound[i] < 0)
|
||||
bail2dos("error loading static sound #%d ('%.8s')\n", i, SoundFiles[i]);
|
||||
I_Error("error loading static sound #%d ('%.8s')\n", i, SoundFiles[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -429,7 +429,7 @@ case_3:
|
|||
|
||||
default:
|
||||
{
|
||||
DebugOut("unknown msg %d for Spider\n", a & 0x7F0000);
|
||||
Printf("unknown msg %d for Spider\n", a & 0x7F0000);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -152,7 +152,7 @@ void RefreshStatus()
|
|||
{
|
||||
short nLives = nPlayerLives[nLocalPlayer];
|
||||
if (nLives < 0 || nLives > kMaxPlayerLives) {
|
||||
bail2dos("illegal value for nPlayerLives #%d\n", nLocalPlayer);
|
||||
I_Error("illegal value for nPlayerLives #%d\n", nLocalPlayer);
|
||||
}
|
||||
|
||||
// draws the red dots that indicate the lives amount
|
||||
|
|
|
@ -97,7 +97,7 @@ void InitSwitch()
|
|||
int BuildSwReady(int nChannel, short nLink)
|
||||
{
|
||||
if (SwitchCount <= 0 || nLink < 0) {
|
||||
bail2dos("Too many switch readys!\n");
|
||||
I_Error("Too many switch readys!\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -149,7 +149,7 @@ int BuildSwPause(int nChannel, int nLink, int ebx)
|
|||
}
|
||||
|
||||
if (SwitchCount <= 0 || nLink < 0) {
|
||||
bail2dos("Too many switches!\n");
|
||||
I_Error("Too many switches!\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -240,7 +240,7 @@ void FuncSwPause(int a, int, int nRun)
|
|||
int BuildSwStepOn(int nChannel, int nLink, int nSector)
|
||||
{
|
||||
if (SwitchCount <= 0 || nLink < 0 || nSector < 0)
|
||||
bail2dos("Too many switches!\n");
|
||||
I_Error("Too many switches!\n");
|
||||
|
||||
int nSwitch = --SwitchCount;
|
||||
|
||||
|
@ -309,7 +309,7 @@ void FuncSwStepOn(int a, int, int nRun)
|
|||
int BuildSwNotOnPause(int nChannel, int nLink, int nSector, int ecx)
|
||||
{
|
||||
if (SwitchCount <= 0 || nLink < 0 || nSector < 0)
|
||||
bail2dos("Too many switches!\n");
|
||||
I_Error("Too many switches!\n");
|
||||
|
||||
int nSwitch = --SwitchCount;
|
||||
|
||||
|
@ -399,7 +399,7 @@ void FuncSwNotOnPause(int a, int, int nRun)
|
|||
int BuildSwPressSector(int nChannel, int nLink, int nSector, int ecx)
|
||||
{
|
||||
if (SwitchCount <= 0 || nLink < 0 || nSector < 0)
|
||||
bail2dos("Too many switches!\n");
|
||||
I_Error("Too many switches!\n");
|
||||
|
||||
int nSwitch = --SwitchCount;
|
||||
|
||||
|
@ -471,7 +471,7 @@ void FuncSwPressSector(int a, int, int nRun)
|
|||
int BuildSwPressWall(short nChannel, short nLink, short nWall)
|
||||
{
|
||||
if (SwitchCount <= 0 || nLink < 0 || nWall < 0) {
|
||||
bail2dos("Too many switches!\n");
|
||||
I_Error("Too many switches!\n");
|
||||
}
|
||||
|
||||
SwitchCount--;
|
||||
|
|
|
@ -28,6 +28,9 @@ CRC
|
|||
RR_CRC 0x19D9BC79
|
||||
RRRA_CRC 0x958018C6
|
||||
BLOOD_CRC 0xA8FDDA84
|
||||
POWERSLAVE_CRC 0x303CBD89
|
||||
EXHUMED_CRC 0xE3B172F1
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -372,3 +375,23 @@ grpinfo
|
|||
defname "sw.def"
|
||||
gamefilter "ShadowWarrior.ShadowWarrior"
|
||||
}
|
||||
|
||||
grpinfo
|
||||
{
|
||||
name "Powerslave"
|
||||
flags GAMEFLAG_POWERSLAVE
|
||||
crc POWERSLAVE_CRC
|
||||
size 27020745
|
||||
defname "exhumed.def"
|
||||
gamefilter "Exhumed.Powerslave"
|
||||
}
|
||||
|
||||
grpinfo
|
||||
{
|
||||
name "Exhumed"
|
||||
flags GAMEFLAG_EXHUMED
|
||||
crc EXHUMED_CRC
|
||||
size 27108170
|
||||
defname "exhumed.def"
|
||||
gamefilter "Exhumed.Exhumed"
|
||||
}
|
||||
|
|
66
wadsrc/static/filter/exhumed/demolition/defbinds.txt
Normal file
66
wadsrc/static/filter/exhumed/demolition/defbinds.txt
Normal file
|
@ -0,0 +1,66 @@
|
|||
W "+Move_Forward"
|
||||
KP8 "+Move_Forward"
|
||||
S "+Move_Backward"
|
||||
KP2 "+Move_Backward"
|
||||
leftarrow "+Turn_Left"
|
||||
KP4 "+Turn_Left"
|
||||
rightarrow "+Turn_Right"
|
||||
KP6 "+Turn_Right"
|
||||
LAlt "+Strafe"
|
||||
RAlt "+Strafe"
|
||||
RCtrl "+Fire"
|
||||
E "+Open"
|
||||
LShift "+Run"
|
||||
RShift "+Run"
|
||||
Space "+Jump"
|
||||
/ "+Jump"
|
||||
LCtrl "+Crouch"
|
||||
PgUp "+Look_Up"
|
||||
KP9 "+Look_Up"
|
||||
PgDn "+Look_Down"
|
||||
KP3 "+Look_Down"
|
||||
Ins "+Look_Left"
|
||||
KP0 "+Look_Left"
|
||||
Del "+Look_Right"
|
||||
KP. "+Look_Right"
|
||||
A "+Strafe_Left"
|
||||
D "+Strafe_Right"
|
||||
Home "+Aim_Up"
|
||||
KP7 "+Aim_Up"
|
||||
End "+Aim_Down"
|
||||
KP1 "+Aim_Down"
|
||||
1 "+Weapon_1"
|
||||
2 "+Weapon_2"
|
||||
3 "+Weapon_3"
|
||||
4 "+Weapon_4"
|
||||
5 "+Weapon_5"
|
||||
6 "+Weapon_6"
|
||||
7 "+Weapon_7"
|
||||
Enter "+Inventory"
|
||||
KP-Enter "+Inventory"
|
||||
[ "+Inventory_Left"
|
||||
] "+Inventory_Right"
|
||||
Backspace "+Turn_Around"
|
||||
T "+Send_Message"
|
||||
Tab "+Map"
|
||||
- "+Shrink_Screen"
|
||||
KP- "+Shrink_Screen"
|
||||
= "+Enlarge_Screen"
|
||||
KP+ "+Enlarge_Screen"
|
||||
KP5 "+Center_View"
|
||||
Scroll "+Holster_Weapon"
|
||||
Y "+Show_Opponents_Weapon"
|
||||
F "+Map_Follow_Mode"
|
||||
K "+See_Coop_View"
|
||||
' "+Next_Weapon"
|
||||
; "+Previous_Weapon"
|
||||
` "toggleconsole"
|
||||
Capslock "+AutoRun"
|
||||
X "+Last_Used_Weapon"
|
||||
F6 "+Quick_Save"
|
||||
F9 "+Quick_Load"
|
||||
F7 "+Third_Person_View"
|
||||
C "+Toggle_Crouch"
|
||||
Mouse1 "+Fire"
|
||||
Mouse2 "+Strafe"
|
||||
Mouse3 "+Move_Forward"
|
64
wadsrc/static/filter/exhumed/demolition/leftbinds.txt
Normal file
64
wadsrc/static/filter/exhumed/demolition/leftbinds.txt
Normal file
|
@ -0,0 +1,64 @@
|
|||
uparrow "+Move_Forward"
|
||||
KP8 "+Move_Forward"
|
||||
downarrow "+Move_Backward"
|
||||
KP2 "+Move_Backward"
|
||||
leftarrow "+Turn_Left"
|
||||
KP4 "+Turn_Left"
|
||||
rightarrow "+Turn_Right"
|
||||
KP6 "+Turn_Right"
|
||||
LAlt "+Strafe"
|
||||
RAlt "+Strafe"
|
||||
LCtrl "+Fire"
|
||||
RCtrl "+Fire"
|
||||
Space "+Open"
|
||||
LShift "+Run"
|
||||
RShift "+Run"
|
||||
A "+Jump"
|
||||
KP- "+Jump"
|
||||
Z "+Crouch"
|
||||
PgUp "+Look_Up"
|
||||
PgDn "+Look_Down"
|
||||
Ins "+Look_Left"
|
||||
Del "+Look_Right"
|
||||
, "+Strafe_Left"
|
||||
KP7 "+Strafe_Left"
|
||||
. "+Strafe_Right"
|
||||
KP9 "+Strafe_Right"
|
||||
Home "+Aim_Up"
|
||||
End "+Aim_Down"
|
||||
1 "+Weapon_1"
|
||||
2 "+Weapon_2"
|
||||
3 "+Weapon_3"
|
||||
4 "+Weapon_4"
|
||||
5 "+Weapon_5"
|
||||
6 "+Weapon_6"
|
||||
7 "+Weapon_7"
|
||||
Enter "+Inventory"
|
||||
KP-Enter "+Inventory"
|
||||
[ "+Inventory_Left"
|
||||
] "+Inventory_Right"
|
||||
Backspace "+Turn_Around"
|
||||
T "+Send_Message"
|
||||
Tab "+Map"
|
||||
- "+Shrink_Screen"
|
||||
= "+Enlarge_Screen"
|
||||
//Scroll "+Holster_Weapon"
|
||||
//W "+Show_Opponents_Weapon"
|
||||
F "+Map_Follow_Mode"
|
||||
K "+See_Coop_View"
|
||||
U "+Mouse_Aiming"
|
||||
I "+Toggle_Crosshair"
|
||||
//R "+Steroids"
|
||||
//Q "+Quick_Kick"
|
||||
' "+Next_Weapon"
|
||||
; "+Previous_Weapon"
|
||||
` "toggleconsole"
|
||||
Capslock "+AutoRun"
|
||||
F6 "+Quick_Save"
|
||||
F9 "+Quick_Load"
|
||||
F7 "+Third_Person_View"
|
||||
Mouse1 "+Fire"
|
||||
Mouse2 "+Open"
|
||||
Mouse3 "+Run"
|
||||
MWheelUp "+Previous_Weapon"
|
||||
MWheelDown "+Next_Weapon"
|
69
wadsrc/static/filter/exhumed/demolition/origbinds.txt
Normal file
69
wadsrc/static/filter/exhumed/demolition/origbinds.txt
Normal file
|
@ -0,0 +1,69 @@
|
|||
uparrow "+Move_Forward"
|
||||
KP8 "+Move_Forward"
|
||||
downarrow "+Move_Backward"
|
||||
KP2 "+Move_Backward"
|
||||
leftarrow "+Turn_Left"
|
||||
KP4 "+Turn_Left"
|
||||
rightarrow "+Turn_Right"
|
||||
KP6 "+Turn_Right"
|
||||
LAlt "+Strafe"
|
||||
RAlt "+Strafe"
|
||||
LCtrl "+Fire"
|
||||
RCtrl "+Fire"
|
||||
Space "+Open"
|
||||
LShift "+Run"
|
||||
RShift "+Run"
|
||||
A "+Jump"
|
||||
/ "+Jump"
|
||||
Z "+Crouch"
|
||||
PgUp "+Look_Up"
|
||||
KP9 "+Look_Up"
|
||||
PgDn "+Look_Down"
|
||||
KP3 "+Look_Down"
|
||||
Ins "+Look_Left"
|
||||
KP0 "+Look_Left"
|
||||
Del "+Look_Right"
|
||||
KP. "+Look_Right"
|
||||
, "+Strafe_Left"
|
||||
. "+Strafe_Right"
|
||||
Home "+Aim_Up"
|
||||
KP7 "+Aim_Up"
|
||||
End "+Aim_Down"
|
||||
KP1 "+Aim_Down"
|
||||
1 "+Weapon_1"
|
||||
2 "+Weapon_2"
|
||||
3 "+Weapon_3"
|
||||
4 "+Weapon_4"
|
||||
5 "+Weapon_5"
|
||||
6 "+Weapon_6"
|
||||
7 "+Weapon_7"
|
||||
Enter "+Inventory"
|
||||
KP-Enter "+Inventory"
|
||||
[ "+Inventory_Left"
|
||||
] "+Inventory_Right"
|
||||
Backspace "+Turn_Around"
|
||||
T "+Send_Message"
|
||||
Tab "+Map"
|
||||
- "+Shrink_Screen"
|
||||
KP- "+Shrink_Screen"
|
||||
= "+Enlarge_Screen"
|
||||
KP+ "+Enlarge_Screen"
|
||||
KP5 "+Center_View"
|
||||
//Scroll "+Holster_Weapon"
|
||||
//W "+Show_Opponents_Weapon"
|
||||
F "+Map_Follow_Mode"
|
||||
K "+See_Coop_View"
|
||||
U "+Mouse_Aiming"
|
||||
I "+Toggle_Crosshair"
|
||||
//R "+Steroids"
|
||||
//` "+Quick_Kick"
|
||||
' "+Next_Weapon"
|
||||
; "+Previous_Weapon"
|
||||
` "toggleconsole"
|
||||
Capslock "+AutoRun"
|
||||
F6 "+Quick_Save"
|
||||
F9 "+Quick_Load"
|
||||
F7 "+Third_Person_View"
|
||||
Mouse1 "+Fire"
|
||||
Mouse2 "+Strafe"
|
||||
Mouse3 "+Move_Forward"
|
Loading…
Reference in a new issue