Game compiles now

# Conflicts:
#	platform/Windows/exhumed.vcxproj
#	platform/Windows/exhumed.vcxproj.filters
This commit is contained in:
nukeykt 2019-08-31 18:08:38 +09:00 committed by Christoph Oelckers
parent 50349a6b3d
commit e0858d501c
34 changed files with 655 additions and 129 deletions

View file

@ -2,6 +2,7 @@
#ifndef __aistuff_h__
#define __aistuff_h__
#include "compat.h"
#include "anubis.h"
#include "bubbles.h"
#include "mummy.h"

View file

@ -2,7 +2,7 @@
#ifndef __anims_h__
#define __anims_h__
#include "typedefs.h"
#include "compat.h"
struct Anim
{

View file

@ -2,7 +2,7 @@
#ifndef __anubis_h__
#define __anubis_h__
#include "typedefs.h"
#include "compat.h"
void InitAnubis();
int BuildAnubis(int nSprite, int x, int y, int z, int nSector, int nAngle, uint8_t bIsDrummer);

View file

@ -1,5 +1,6 @@
#include "compat.h"
#include "renderlayer.h"
#include "_control.h"
#include "build.h"
#include "cache1d.h"
#include "keyboard.h"
@ -130,10 +131,7 @@ static const char* mousedigitaldefaults[MAXMOUSEDIGITAL] =
ud_setup_t gSetup;
#define kMaxSetupFiles 20
#define kSetupFilename "SETUP.CFG"
static char setupfilename[128] = {kSetupFilename};
char setupfilename[128] = {kSetupFilename};
int lMouseSens = 32;
unsigned int dword_1B82E0 = 0;
@ -305,7 +303,7 @@ static void CONFIG_SetJoystickAnalogAxisFunction(int i, int function)
}
void CONFIG_SetDefaultKeys(const char (*keyptr)[kMaxGameFunctions], bool lazy/*=false*/)
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;
@ -356,11 +354,84 @@ void CONFIG_SetDefaultKeys(const char (*keyptr)[kMaxGameFunctions], bool lazy/*=
void CONFIG_SetDefaults()
{
scripthandle = -1;
# if defined RENDERTYPESDL && SDL_MAJOR_VERSION > 1
uint32_t inited = SDL_WasInit(SDL_INIT_VIDEO);
if (inited == 0)
SDL_Init(SDL_INIT_VIDEO);
else if (!(inited & SDL_INIT_VIDEO))
SDL_InitSubSystem(SDL_INIT_VIDEO);
SDL_DisplayMode dm;
if (SDL_GetDesktopDisplayMode(0, &dm) == 0)
{
gSetup.xdim = dm.w;
gSetup.ydim = dm.h;
}
else
# endif
{
gSetup.xdim = 1024;
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;
gSetup.forcesetup = 1;
gSetup.noautoload = 1;
gSetup.fullscreen = 1;
gSetup.usemouse = 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()
@ -403,8 +474,7 @@ int CONFIG_ReadSetup()
MAXCACHE1DSIZE = cachesize;
// TODO:
if (/*g_noSetup == 0 && */g_modDir[0] == '/')
if (g_noSetup == 0 && g_modDir[0] == '/')
{
SCRIPT_GetString(scripthandle, "Setup","ModDir",&g_modDir[0]);
@ -432,6 +502,54 @@ int CONFIG_ReadSetup()
setupread = 1;
}
// 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)
{
@ -589,15 +707,236 @@ void SetupInput()
joySetDeadZone(i,JoystickAnalogueDead[i],JoystickAnalogueSaturate[i]);
}
void LoadConfig()
void CONFIG_WriteSettings(void) // save binds and aliases to <cfgname>_settings.cfg
{
CONFIG_ReadSetup();
/*
Joy_x = 0;
Joy_y = 0;
Joy_xs = 1;
Joy_ys = 1;
Joy_xb = 2;
Joy_yb = 2;
*/
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);
}

View file

@ -2,6 +2,8 @@
#ifndef __config_h__
#define __config_h__
#include "compat.h"
#define kMaxGameFunctions 40
#define kMaxGameFuncLen 64
@ -83,10 +85,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;
@ -114,6 +122,7 @@ 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);

View file

@ -23,7 +23,7 @@ enum
#define kMaxPalookups 256
#define kMaxStatus 1024
#define MAXPSKYTILES 256
//#define MAXPSKYTILES 256
inline int Sin(int angle)
{

View file

@ -38,7 +38,7 @@ void kensetpalette(unsigned char *vgapal)
//setbrightness(0, (char*)vgapal, 4 | 2);
// TODO
Bmemcpy(palette, vgapal, 768);
videoSetPalette(0, 0, 4 | 2);
videoSetPalette(0, 0, /*4 | */2);
#if 0
char vesapal[1024];

View file

@ -1,11 +1,14 @@
#include "compat.h"
#include "baselayer.h"
#include "renderlayer.h"
#include "typedefs.h"
#include "common.h"
#include "keyboard.h"
#include "control.h"
#include "typedefs.h"
#include "engine.h"
#include "exhumed.h"
#include "osdcmds.h"
#include "map.h"
#include "sequence.h"
#include "movie.h"
@ -56,6 +59,10 @@
#include <time.h>
#include <assert.h>
#ifdef _WIN32
# include "winbits.h"
#endif /* _WIN32 */
#ifdef __cplusplus
extern "C" {
#endif
@ -65,6 +72,9 @@ extern "C" {
}
#endif
const char* AppProperName = APPNAME;
const char* AppTechnicalName = APPBASENAME;
void FinishLevel();
int htimer = 0;
@ -436,8 +446,24 @@ buildvfs_kfd kopen4loadfrommod(const char *fileName, char searchfirst)
return (kFile == buildvfs_kfd_invalid) ? kopen4load(fileName, searchfirst) : kFile;
}
int32_t g_commandSetup = 0;
int32_t g_noSetup = 0;
int g_useCwd;
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
}
#define kSpiritX = 106;
#define kSpiritY = 97;
@ -1438,10 +1464,62 @@ void DrawClock()
DoEnergyTile();
}
int ExhumedMain(int argc, char *argv[])
void M32RunScript(const char* s) { UNREFERENCED_PARAMETER(s); }
void app_crashhandler(void)
{
ShutDown();
}
void G_Polymer_UnInit(void) { }
int app_main(int argc, char const* const* argv)
{
char tempbuf[256];
#ifdef _WIN32
#ifndef DEBUGGINGAIDS
if (!G_CheckCmdSwitch(argc, argv, "-noinstancechecking") && win_checkinstance())
{
#ifdef EDUKE32_STANDALONE
if (!wm_ynbox(APPNAME, "It looks like " APPNAME " is already running.\n\n"
#else
if (!wm_ynbox(APPNAME, "It looks like the game is already running.\n\n"
#endif
"Are you sure you want to start another copy?"))
return 3;
}
#endif
backgroundidle = 0;
#ifndef USE_PHYSFS
#ifdef DEBUGGINGAIDS
extern int32_t (*check_filename_casing_fn)(void);
check_filename_casing_fn = check_filename_casing;
#endif
#endif
#endif
G_ExtPreInit(argc, argv);
OSD_SetLogFile(APPBASENAME ".log");
OSD_SetFunctions(NULL,
NULL,
NULL,
NULL,
NULL,
GAME_clearbackground,
BGetTime,
GAME_onshowosd);
wm_setapptitle(APPNAME);
initprintf("Exhumed %s\n", s_buildRev);
PrintBuildInfo();
int i;
int esi = 1;
int edi = esi;
@ -1456,20 +1534,20 @@ int ExhumedMain(int argc, char *argv[])
// Check for any command line arguments
for (i = 1; i < argc; i++)
{
char *pChar = argv[i];
const char *pChar = argv[i];
if (*pChar == '/')
{
pChar++;
strlwr(pChar);
//strlwr(pChar);
if (strcmp(pChar, "nocreatures") == 0) {
if (Bstrcasecmp(pChar, "nocreatures") == 0) {
bNoCreatures = kTrue;
}
else if (strcmp(pChar, "nosound") == 0) {
else if (Bstrcasecmp(pChar, "nosound") == 0) {
bNoSound = kTrue;
}
else if (strcmp(pChar, "record") == 0)
else if (Bstrcasecmp(pChar, "record") == 0)
{
if (!bPlayback)
{
@ -1482,7 +1560,7 @@ int ExhumedMain(int argc, char *argv[])
}
}
}
else if (strcmp(pChar, "playback") == 0)
else if (Bstrcasecmp(pChar, "playback") == 0)
{
if (!bRecord)
{
@ -1496,7 +1574,7 @@ int ExhumedMain(int argc, char *argv[])
}
}
}
else if (strncmp(pChar, "null", 4) == 0)
else if (Bstrncasecmp(pChar, "null", 4) == 0)
{
pChar += 4;
@ -1526,7 +1604,7 @@ int ExhumedMain(int argc, char *argv[])
forcelevel = levelnew;
}
}
else if (strcmp(pChar, "modem") == 0)
else if (Bstrcasecmp(pChar, "modem") == 0)
{
bModemPlay = kTrue;
bSerialPlay = kTrue;
@ -1539,7 +1617,7 @@ int ExhumedMain(int argc, char *argv[])
forcelevel = levelnew;
}
}
else if (strcmp(pChar, "network") == 0)
else if (Bstrcasecmp(pChar, "network") == 0)
{
nNetPlayerCount = -1;
forcelevel = levelnew;
@ -1548,6 +1626,13 @@ int ExhumedMain(int argc, char *argv[])
esi = 0;
}
else if (Bstrcasecmp(pChar, "setup") == 0) {
g_commandSetup = 1;
}
else if (Bstrcasecmp(pChar, "nosetup") == 0) {
g_noSetup = 1;
g_commandSetup = 0;
}
else
{
char c = tolower(*pChar);
@ -1598,6 +1683,54 @@ int ExhumedMain(int argc, char *argv[])
forcelevel = 1;
}
// This needs to happen afterwards, as G_CheckCommandLine() is where we set
// up the command-line-provided search paths (duh).
// TODO:
//G_ExtInit();
#if defined(RENDERTYPEWIN) && defined(USE_OPENGL)
if (forcegl) initprintf("GL driver blacklist disabled.\n");
#endif
// used with binds for fast function lookup
hash_init(&h_gamefuncs);
for (bssize_t i=kMaxGameFunctions-1; i>=0; i--)
{
if (gamefunctions[i][0] == '\0')
continue;
hash_add(&h_gamefuncs,gamefunctions[i],i,0);
}
#ifdef STARTUP_SETUP_WINDOW
int const readSetup =
#endif
CONFIG_ReadSetup();
if (enginePreInit())
{
wm_msgbox("Build Engine Initialization Error",
"There was a problem initializing the Build engine: %s", engineerrstr);
ERRprintf("app_main: There was a problem initializing the Build engine: %s\n", engineerrstr);
Bexit(2);
}
if (Bstrcmp(setupfilename, kSetupFilename))
initprintf("Using config file \"%s\".\n",setupfilename);
//G_ScanGroups();
#ifdef STARTUP_SETUP_WINDOW
if (readSetup < 0 || (!g_noSetup && gSetup.forcesetup) || g_commandSetup)
{
if (quitevent || !startwin_run())
{
engineUnInit();
Bexit(0);
}
}
#endif
// Decrypt strings code would normally be here
#if 0
@ -1675,7 +1808,15 @@ int ExhumedMain(int argc, char *argv[])
GetCurPal(NULL);
LoadConfig();
CONFIG_WriteSetup(1);
CONFIG_ReadSetup();
initprintf("Initializing OSD...\n");
Bsprintf(tempbuf, "Exhumed %s", s_buildRev);
OSD_SetVersion(tempbuf, 10,0);
OSD_SetParameters(0, 0, 0, 12, 2, 12, OSD_ERROR, OSDTEXT_RED, gamefunctions[gamefunc_Show_Console][0] == '\0' ? OSD_PROTECTED : 0);
registerosdcommands();
if (nNetPlayerCount == -1)
{

View file

@ -18,6 +18,17 @@ void handleevents();
#define APPBASENAME "exhumed"
#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
void ShutDown(void);
void DebugOut(const char *fmt, ...);
void bail2dos(const char *fmt, ...);
@ -75,6 +86,8 @@ int DoSpiritHead();
void UpdateScreenSize();
extern buildvfs_kfd kopen4loadfrommod(const char* filename, char searchfirst);
extern int32_t g_commandSetup;
extern int32_t g_noSetup;
extern short nCDTrackLength;

View file

@ -193,9 +193,9 @@ void SetNewWeaponIfBetter(short nPlayer, short nWeapon)
void SelectNewWeapon(short nPlayer)
{
int nWeapon = 6;
ushort di = nPlayerWeapons[nPlayer];
uint16_t di = nPlayerWeapons[nPlayer];
ushort dx = 0x40; // bit 7 turned on
uint16_t dx = 0x40; // bit 7 turned on
while (dx)
{

View file

@ -2,6 +2,7 @@
#ifndef __gun_h__
#define __gun_h__
#include "compat.h"
#include "sequence.h"
#define kMaxWeapons 7

View file

@ -1,4 +1,6 @@
#include "compat.h"
#include "keyboard.h"
#include "control.h"
#include "init.h"
#include "runlist.h"
#include "switch.h"
@ -61,7 +63,7 @@ uint8_t bIsVersion6 = kTrue;
// 37 bytes
struct Sector_6
{
ushort wallptr, wallnum;
uint16_t wallptr, wallnum;
short ceilingpicnum, floorpicnum;
short ceilingheinum, floorheinum;
int ceilingz, floorz;
@ -423,6 +425,25 @@ void InstallEngine()
{
initgroupfile("stuff.dat");
char *cwd;
if (g_modDir[0] != '/' && (cwd = buildvfs_getcwd(NULL, 0)))
{
buildvfs_chdir(g_modDir);
if (artLoadFiles("tiles000.art", MAXCACHE1DSIZE) < 0)
{
buildvfs_chdir(cwd);
if (artLoadFiles("tiles000.art", MAXCACHE1DSIZE) < 0)
bail2dos("Failed loading art.");
}
buildvfs_chdir(cwd);
#ifndef __ANDROID__ //This crashes on *some* Android devices. Small onetime memory leak. TODO fix above function
Xfree(cwd);
#endif
}
else if (artLoadFiles("tiles000.art",MAXCACHE1DSIZE) < 0)
bail2dos("Failed loading art.");
// TEMP
//nScreenWidth *= 2;
@ -478,25 +499,6 @@ void InstallEngine()
gSetup.bpp = bpp;
}
char *cwd;
if (g_modDir[0] != '/' && (cwd = buildvfs_getcwd(NULL, 0)))
{
buildvfs_chdir(g_modDir);
if (artLoadFiles("tiles000.art", MAXCACHE1DSIZE) < 0)
{
buildvfs_chdir(cwd);
if (artLoadFiles("tiles000.art", MAXCACHE1DSIZE) < 0)
bail2dos("Failed loading art.");
}
buildvfs_chdir(cwd);
#ifndef __ANDROID__ //This crashes on *some* Android devices. Small onetime memory leak. TODO fix above function
Xfree(cwd);
#endif
}
else if (artLoadFiles("tiles000.art",MAXCACHE1DSIZE) < 0)
bail2dos("Failed loading art.");
LoadPaletteLookups();
MyLoadPalette();
}

View file

@ -2,7 +2,7 @@
#ifndef __init_h__
#define __init_h__
#include "typedefs.h"
#include "compat.h"
#define kMap20 20

View file

@ -2,7 +2,7 @@
#ifndef __input_h__
#define __input_h__
#include "typedefs.h"
#include "compat.h"
enum {
kButtonJump = 0x1,
@ -21,7 +21,7 @@ struct PlayerInput
int xVel;
int yVel;
short nAngle;
ushort buttons;
uint16_t buttons;
short nTarget;
int8_t horizon;
int8_t nItem;

View file

@ -57,9 +57,9 @@ void drawoverheadmap(int cposx, int cposy, int czoom, short cang)
int yvect2 = mulscale(yvect, yxaspect, 16);
// draw player position arrow
drawline256(xdim << 11, (ydim << 11) - 20480, xdim << 11, (ydim << 11) + 20480, 24);
drawline256((xdim << 11) - 20480, ydim << 11, xdim << 11, (ydim << 11) - 20480, 24);
drawline256((xdim << 11) + 20480, ydim << 11, xdim << 11, (ydim << 11) - 20480, 24);
renderDrawLine(xdim << 11, (ydim << 11) - 20480, xdim << 11, (ydim << 11) + 20480, 24);
renderDrawLine((xdim << 11) - 20480, ydim << 11, xdim << 11, (ydim << 11) - 20480, 24);
renderDrawLine((xdim << 11) + 20480, ydim << 11, xdim << 11, (ydim << 11) - 20480, 24);
short nPlayerSprite = PlayerList[nLocalPlayer].nSprite;
@ -114,7 +114,7 @@ void drawoverheadmap(int cposx, int cposy, int czoom, short cang)
int x2 = mulscale(ox, xvect, 16) - mulscale(oy, yvect, 16);
int y2 = mulscale(oy, xvect2, 16) + mulscale(ox, yvect2, 16);
drawline256(x1 + (xdim << 11), y1 + (ydim << 11), x2 + (xdim << 11), y2 + (ydim << 11), var_10);
renderDrawLine(x1 + (xdim << 11), y1 + (ydim << 11), x2 + (xdim << 11), y2 + (ydim << 11), var_10);
/*
drawline256(
@ -167,7 +167,7 @@ void drawoverheadmap(int cposx, int cposy, int czoom, short cang)
{
if (show2dwall[nWall >> 3] & (1 << (nWall & 7)))
{
if (tilesizx[wall[nWall].picnum] && tilesizy[wall[nWall].picnum])
if (tilesiz[wall[nWall].picnum].x && tilesiz[wall[nWall].picnum].y)
{
int ox = wall[nWall].x - cposx;
int oy = wall[nWall].y - cposy;
@ -180,7 +180,7 @@ void drawoverheadmap(int cposx, int cposy, int czoom, short cang)
int x2 = mulscale(ox, xvect, 16) - mulscale(oy, yvect, 16);
int y2 = mulscale(oy, xvect2, 16) + mulscale(ox, yvect2, 16);
drawline256(x1 + (xdim << 11), y1 + (ydim << 11), x2 + (xdim << 11), y2 + (ydim << 11), 24);
renderDrawLine(x1 + (xdim << 11), y1 + (ydim << 11), x2 + (xdim << 11), y2 + (ydim << 11), 24);
/*
@ -237,21 +237,21 @@ void drawoverheadmap(int cposx, int cposy, int czoom, short cang)
// v27 is y1 + 2048
// v28 is y1 + 2048 + (ydim << 1);
drawline256(
renderDrawLine(
x1 - 2048 + (xdim << 11),
y1 - 2048 + (ydim << 11),
x1 - 2048 + (xdim << 11),
y1 + 2048 + (ydim << 1),
170);
drawline256(
renderDrawLine(
x1 + (xdim << 11),
y1 + (ydim << 11),
x1 + (xdim << 11),
y1 + 2048 + (ydim << 11),
170);
drawline256(
renderDrawLine(
x1 + 2048 + (xdim << 11),
y1 + (ydim << 11),
x1 + 2048 + (xdim << 11),

View file

@ -2,7 +2,7 @@
#ifndef __map_h__
#define __map_h__
#include "typedefs.h"
#include "compat.h"
extern short bShowTowers;
extern int ldMapZoom;

View file

@ -1,6 +1,3 @@
#define _USE_32BIT_TIME_T 1
#include "compat.h"
#include "build.h"
#include "exhumed.h"
@ -24,7 +21,6 @@
#include "cd.h"
#include "cdaudio.h"
#include <string>
#include <time.h>
#include <assert.h>
@ -306,11 +302,9 @@ void menu_DoPlasma()
nSmokeTop = 40 - tilesiz[kExhumedLogo].y / 2;
nSmokeBottom = 40 - tilesiz[kExhumedLogo].y / 2 + tilesiz[kExhumedLogo].y - 1;
ulong t = time(0) << 16;
ulong t2 = time(0) | t;
// t2 is 64bits on visual studio, but would have been 32bit on WATCOM... just going to cast here
nRandom = t2;
//uint32_t t = time(0) << 16;
//uint32_t t2 = time(0) | t;
nRandom = totalclock;
for (int i = 0; i < 5; i++)
{
@ -626,7 +620,7 @@ int menu_DrawTheMap(int nLevel, int nLevelNew, int nLevelBest)
int var_38 = 0;
int bFadeDone = kFalse;
slong startTime = totalclock;
int startTime = totalclock;
ClearAllKeys();
UnMaskStatus();
@ -1843,7 +1837,7 @@ void ComputeCinemaText(int nLine)
ClearAllKeys();
}
void ReadyCinemaText(ushort nVal)
void ReadyCinemaText(uint16_t nVal)
{
line = FindGString("CINEMAS");
if (line < 0) {

View file

@ -47,7 +47,7 @@ int LoadCinemaPalette(int nPal);
void CinemaFadeIn();
void ReadyCinemaText(ushort nVal);
void ReadyCinemaText(uint16_t nVal);
uint8_t AdvanceCinemaText();
void DoFailedFinalScene();

View file

@ -303,7 +303,7 @@ int movespritez(short nSprite, int z, int height, int flordist, int clipdist)
int edi = nSector;
// backup cstat
ushort cstat = sprite[nSprite].cstat;
uint16_t cstat = sprite[nSprite].cstat;
sprite[nSprite].cstat &= 0xFFFE;
@ -395,7 +395,7 @@ int movespritez(short nSprite, int z, int height, int flordist, int clipdist)
IgniteSprite(nSprite);
sprite[nSprite].hitag = 20;
}
#if 1
#if 0
short dx = nSectDamage;
dx >>= 2;
int eax = dx;
@ -418,10 +418,10 @@ int movespritez(short nSprite, int z, int height, int flordist, int clipdist)
mov outval, edx
}
#endif
short nDamageVal = (nSectDamage / 4) - (nSectDamage / 8);
if (nDamageVal) {
runlist_DamageEnemy(nSprite, -1, nDamageVal);
nSectDamage >>= 2;
nSectDamage = nSectDamage - (nSectDamage>>2);
if (nSectDamage) {
runlist_DamageEnemy(nSprite, -1, nSectDamage);
}
}

View file

@ -43,7 +43,7 @@ int ReadFrame(FILE *fp)
uint8_t nType;
uint8_t var_1C;
int nSize;
ushort yOffset;
uint16_t yOffset;
uint8_t xOffset;
uint8_t nPixels;
uint8_t palette[768];

View file

@ -22,8 +22,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "compat.h"
#include "build.h"
#include "control.h"
#include "common.h"
#include "keyboard.h"
#include "control.h"
#include "exhumed.h"
#include "config.h"
#include "osdcmds.h"
@ -656,7 +657,7 @@ int32_t registerosdcommands(void)
//{ "wchoice","sets weapon autoselection order", (void *)ud.wchoice, CVAR_STRING|CVAR_FUNCPTR, 0, MAX_WEAPONS },
};
osdcmd_cheatsinfo_stat.cheatnum = -1;
//osdcmd_cheatsinfo_stat.cheatnum = -1;
for (auto & cv : cvars_game)
{
@ -743,3 +744,21 @@ int32_t registerosdcommands(void)
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);
}

View file

@ -29,6 +29,8 @@ extern "C" {
int32_t registerosdcommands(void);
void onvideomodechange(int32_t newmode);
void GAME_onshowosd(int shown);
void GAME_clearbackground(int numcols, int numrows);
//extern float r_ambientlight,r_ambientlightrecip;

View file

@ -67,10 +67,10 @@ short nActionEyeLevel[] = {
-14080, -14080, -14080, -14080, -14080, -14080, -14080
};
ushort nGunLotag[] = { 52, 53, 54, 55, 56, 57 };
ushort nGunPicnum[] = { 57, 488, 490, 491, 878, 899, 3455 };
uint16_t nGunLotag[] = { 52, 53, 54, 55, 56, 57 };
uint16_t nGunPicnum[] = { 57, 488, 490, 491, 878, 899, 3455 };
sshort nItemText[] = {
int16_t nItemText[] = {
-1, -1, -1, -1, -1, -1, 18, 20, 19, 13, -1, 10, 1, 0, 2, -1, 3,
-1, 4, 5, 9, 6, 7, 8, -1, 11, -1, 13, 12, 14, 15, -1, 16, 17,
-1, -1, -1, 21, 22, -1, -1, -1, -1, -1, -1, 23, 24, 25, 26, 27,
@ -99,7 +99,7 @@ short nPlayerClip[kMaxPlayers];
short nPlayerPushSound[kMaxPlayers];
short nTauntTimer[kMaxPlayers];
short nPlayerTorch[kMaxPlayers];
ushort nPlayerWeapons[kMaxPlayers]; // each set bit represents a weapon the player has
uint16_t nPlayerWeapons[kMaxPlayers]; // each set bit represents a weapon the player has
short nPlayerLives[kMaxPlayers];
short nPlayerItem[kMaxPlayers];
Player PlayerList[kMaxPlayers];
@ -109,7 +109,7 @@ short nPlayerViewSect[kMaxPlayers];
short nPlayerFloorSprite[kMaxPlayers];
PlayerSave sPlayerSave[kMaxPlayers];
int totalvel[kMaxPlayers] = { 0 };
sshort eyelevel[kMaxPlayers];
int16_t eyelevel[kMaxPlayers];
short nNetStartSprite[kMaxPlayers] = { 0 };
short nStandHeight;
@ -1439,7 +1439,7 @@ loc_1AB8E:
int var_5C = SectFlag[nViewSect] & kSectUnderwater;
ushort buttons = sPlayerInput[nPlayer].buttons;
uint16_t buttons = sPlayerInput[nPlayer].buttons;
if (buttons & 0x40)
{

View file

@ -2,7 +2,7 @@
#ifndef __player_h__
#define __player_h__
#include "typedefs.h"
#include "compat.h"
void PlayerInterruptKeys();
void RestoreSavePoint(int nPlayer, int *x, int *y, int *z, short *nSector, short *nAngle);
@ -39,7 +39,7 @@ struct Player
short nAir;
short nSeq;
short nMaskAmount;
ushort keys;
uint16_t keys;
short nMagic;
char items[8];
short nAmmo[7]; // TODO - kMaxWeapons?
@ -70,7 +70,7 @@ extern short nTauntTimer[];
extern short nDoppleSprite[];
extern ushort nPlayerWeapons[];
extern uint16_t nPlayerWeapons[];
extern short nPlayerOldWeapon[];
extern short nPlayerGrenade[kMaxPlayers];

View file

@ -1,4 +1,5 @@
#include "compat.h"
#include "record.h"
#include "typedefs.h"
#include "save.h"

View file

@ -14,8 +14,8 @@
#define kMaxRoach 100
sshort RoachSprite = -1;
sshort RoachCount = -1;
int16_t RoachSprite = -1;
int16_t RoachCount = -1;
static actionSeq ActionSeq[] = {{ 24, 0 }, { 0, 0 }, { 0, 0 }, { 16, 0 }, { 8, 0 }, { 32, 1 }, { 42, 1 }};

View file

@ -1646,7 +1646,7 @@ int runlist_CheckRadialDamage(short nSprite)
if (nDist < nDamageRadius)
{
ushort nCStat = sprite[nSprite].cstat;
uint16_t nCStat = sprite[nSprite].cstat;
sprite[nSprite].cstat = 0x101;
if (((kStatExplodeTarget - sprite[nSprite].statnum) <= 1) ||

View file

@ -2,7 +2,7 @@
#ifndef __runlist_h__
#define __runlist_h__
#include "typedefs.h"
#include "compat.h"
#define kMaxRuns 25600
#define kMaxChannels 4096

View file

@ -2,6 +2,8 @@
#ifndef __scorp_h__
#define __scorp_h__
#include "compat.h"
/*
Selkis Boss AI code
*/

View file

@ -191,7 +191,7 @@ int seq_ReadSequence(const char *seqName)
SeqBase[sequences + i] += frames;
}
sshort nFrames;
int16_t nFrames;
kread(hFile, &nFrames, sizeof(nFrames));
if (nFrames <= 0 || frames + nFrames >= kMaxSEQFrames)
@ -217,7 +217,7 @@ int seq_ReadSequence(const char *seqName)
FrameBase[frames + i] += chunks;
}
sshort nChunks;
int16_t nChunks;
kread(hFile, &nChunks, sizeof(nChunks));
if (nChunks < 0 || chunks + nChunks >= kMaxSEQChunks)
@ -325,12 +325,12 @@ void seq_LoadSequences()
}
}
void seq_DrawStatusSequence(short nSequence, ushort edx, short ebx)
void seq_DrawStatusSequence(short nSequence, uint16_t edx, short ebx)
{
edx += SeqBase[nSequence];
short nFrameBase = FrameBase[edx];
sshort nFrameSize = FrameSize[edx];
int16_t nFrameSize = FrameSize[edx];
while (1)
{

View file

@ -2,7 +2,7 @@
#ifndef __sequence_h__
#define __sequence_h__
#include "typedefs.h"
#include "compat.h"
enum {
kSeqRothands = 0,
@ -114,7 +114,7 @@ void seq_LoadSequences();
void seq_MoveSequence(short nSprite, short nSeq, short bx);
int seq_GetSeqPicnum2(short nSeq, short nFrame);
int seq_GetSeqPicnum(short nSeq, short edx, short ebx);
void seq_DrawStatusSequence(short nSequence, ushort edx, short ebx);
void seq_DrawStatusSequence(short nSequence, uint16_t edx, short ebx);
int seq_DrawGunSequence(int nSeqOffset, short dx, int xOffs, int yOffs, int nShade, int nPal);
short seq_GetFrameFlag(short val, short nFrame);

View file

@ -116,21 +116,21 @@ short StaticSound[kMaxSoundFiles];
//
// Sound variables
//
int FXDevice;
int MusicDevice;
int FXVolume;
int MusicVolume;
int SoundToggle;
int MusicToggle;
int VoiceToggle;
int AmbienceToggle;
//int FXDevice;
//int MusicDevice;
//int FXVolume;
//int MusicVolume;
//int SoundToggle;
//int MusicToggle;
//int VoiceToggle;
//int AmbienceToggle;
//fx_blaster_config BlasterConfig;
int NumVoices;
int NumChannels;
int NumBits;
int MixRate;
//int NumVoices;
//int NumChannels;
//int NumBits;
//int MixRate;
//int32 MidiPort;
int ReverseStereo;
//int ReverseStereo;
int nNextFreq;
int nTotalSoundBytes;

View file

@ -36,7 +36,7 @@ short nItemFrames;
int laststatusx;
int laststatusy;
sshort nItemSeq;
int16_t nItemSeq;
short nDigit[3];
short nMagicFrames;
@ -53,8 +53,8 @@ short nHealthFrames;
short airframe;
sshort nFirstAnim;
sshort nLastAnim;
int16_t nFirstAnim;
int16_t nLastAnim;
short nItemAltSeq;
short airpages = 0;
@ -70,7 +70,7 @@ struct statusAnim
{
short s1;
short s2;
sshort nPage;
int16_t nPage;
int8_t c1;
int8_t c2;
};
@ -130,7 +130,7 @@ void RefreshStatus()
// draws the red dots that indicate the lives amount
BuildStatusAnim(2 * nLives + 145, 0);
ushort nKeys = PlayerList[nLocalPlayer].keys;
uint16_t nKeys = PlayerList[nLocalPlayer].keys;
int val = 37;
@ -192,7 +192,7 @@ void InitStatus()
void MoveStatusAnims()
{
// sshort nAnim = nFirstAnim;
// int16_t nAnim = nFirstAnim;
for (int i = nFirstAnim; i >= 0; i = StatusAnim[i].c1)
{
@ -262,7 +262,7 @@ void DestroyStatusAnim(short nAnim)
void DrawStatusAnims()
{
sshort nAnim = nFirstAnim;
int16_t nAnim = nFirstAnim;
while (nAnim != -1)
{

View file

@ -1,4 +1,6 @@
#include "compat.h"
#include "keyboard.h"
#include "control.h"
#include "engine.h"
#include "config.h"
#include "names.h"