2019-11-20 16:21:32 +00:00
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
/*
|
|
|
|
Copyright (C) 2010-2019 EDuke32 developers and contributors
|
|
|
|
Copyright (C) 2019 sirlemonhead, Nuke.YKT
|
|
|
|
This file is part of PCExhumed.
|
|
|
|
PCExhumed 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.
|
|
|
|
*/
|
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
|
2019-08-26 03:59:14 +00:00
|
|
|
#ifndef __exhumed_h__
|
|
|
|
#define __exhumed_h__
|
|
|
|
|
2019-08-31 07:47:15 +00:00
|
|
|
#include "compat.h"
|
2019-12-25 22:37:16 +00:00
|
|
|
#include "baselayer.h"
|
2019-11-24 09:03:19 +00:00
|
|
|
#include "v_text.h"
|
|
|
|
#include "printf.h"
|
|
|
|
#include "gamecvars.h"
|
|
|
|
#include "m_argv.h"
|
|
|
|
#include "gamecontrol.h"
|
|
|
|
#include "c_buttons.h"
|
2019-12-26 21:00:04 +00:00
|
|
|
#include <algorithm>
|
|
|
|
#include "tarray.h"
|
|
|
|
#include "zstring.h"
|
2020-04-11 21:54:33 +00:00
|
|
|
#include "filesystem.h"
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2019-11-22 23:11:37 +00:00
|
|
|
BEGIN_PS_NS
|
|
|
|
|
2020-04-11 22:10:39 +00:00
|
|
|
// Order is that of EDuke32 by necessity because it exposes the key binds to scripting by index instead of by name.
|
|
|
|
enum GameFunction_t
|
|
|
|
{
|
|
|
|
gamefunc_Move_Forward,
|
|
|
|
gamefunc_Move_Backward,
|
|
|
|
gamefunc_Turn_Left,
|
|
|
|
gamefunc_Turn_Right,
|
|
|
|
gamefunc_Strafe,
|
|
|
|
gamefunc_Fire,
|
|
|
|
gamefunc_Open,
|
|
|
|
gamefunc_Run,
|
|
|
|
gamefunc_Alt_Fire, // Duke3D, Blood
|
|
|
|
gamefunc_Jump,
|
|
|
|
gamefunc_Crouch,
|
|
|
|
gamefunc_Look_Up,
|
|
|
|
gamefunc_Look_Down,
|
|
|
|
gamefunc_Look_Left,
|
|
|
|
gamefunc_Look_Right,
|
|
|
|
gamefunc_Strafe_Left,
|
|
|
|
gamefunc_Strafe_Right,
|
|
|
|
gamefunc_Aim_Up,
|
|
|
|
gamefunc_Aim_Down,
|
|
|
|
gamefunc_Weapon_1,
|
|
|
|
gamefunc_Weapon_2,
|
|
|
|
gamefunc_Weapon_3,
|
|
|
|
gamefunc_Weapon_4,
|
|
|
|
gamefunc_Weapon_5,
|
|
|
|
gamefunc_Weapon_6,
|
|
|
|
gamefunc_Weapon_7,
|
|
|
|
gamefunc_Weapon_8,
|
|
|
|
gamefunc_Weapon_9,
|
|
|
|
gamefunc_Weapon_10,
|
|
|
|
gamefunc_Inventory,
|
|
|
|
gamefunc_Inventory_Left,
|
|
|
|
gamefunc_Inventory_Right,
|
|
|
|
gamefunc_TurnAround,
|
|
|
|
gamefunc_SendMessage,
|
|
|
|
gamefunc_Map,
|
|
|
|
gamefunc_Shrink_Screen,
|
|
|
|
gamefunc_Enlarge_Screen,
|
|
|
|
gamefunc_Center_View,
|
|
|
|
gamefunc_Holster_Weapon,
|
|
|
|
gamefunc_Show_Opponents_Weapon,
|
|
|
|
gamefunc_Map_Follow_Mode,
|
|
|
|
gamefunc_See_Coop_View,
|
|
|
|
gamefunc_Mouse_Aiming,
|
|
|
|
gamefunc_Toggle_Crosshair,
|
|
|
|
gamefunc_Next_Weapon,
|
|
|
|
gamefunc_Previous_Weapon,
|
|
|
|
gamefunc_Dpad_Select,
|
|
|
|
gamefunc_Dpad_Aiming,
|
|
|
|
gamefunc_Last_Weapon,
|
|
|
|
gamefunc_Alt_Weapon,
|
|
|
|
gamefunc_Third_Person_View,
|
|
|
|
gamefunc_Toggle_Crouch, // This is the last one used by EDuke32.
|
|
|
|
NUM_ACTIONS,
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2019-08-26 03:59:14 +00:00
|
|
|
#define kTimerTicks 120
|
|
|
|
|
|
|
|
#ifdef __WATCOMC__
|
|
|
|
void handleevents();
|
|
|
|
#endif
|
|
|
|
|
2019-10-12 21:09:55 +00:00
|
|
|
enum basepal_t {
|
|
|
|
BASEPAL = 0,
|
|
|
|
ANIMPAL,
|
|
|
|
BASEPALCOUNT
|
|
|
|
};
|
|
|
|
|
2019-12-14 00:33:26 +00:00
|
|
|
void ExitGame();
|
2019-08-27 06:08:18 +00:00
|
|
|
void ShutDown(void);
|
2019-08-26 03:59:14 +00:00
|
|
|
void DebugOut(const char *fmt, ...);
|
|
|
|
int ExhumedMain(int argc, char *argv[]);
|
|
|
|
|
|
|
|
void FinishLevel();
|
2020-08-23 06:22:59 +00:00
|
|
|
void ResetEngine();
|
2019-08-26 03:59:14 +00:00
|
|
|
|
|
|
|
void SetHiRes();
|
|
|
|
|
|
|
|
void BlackOut();
|
|
|
|
|
|
|
|
void DoGameOverScene();
|
|
|
|
|
|
|
|
int Query(short n, short l, ...);
|
|
|
|
|
|
|
|
extern unsigned char curpal[];
|
|
|
|
|
|
|
|
void TintPalette(int a, int b, int c);
|
2019-10-12 21:09:55 +00:00
|
|
|
//void MySetPalette(unsigned char *palette);
|
|
|
|
//void GetCurPal(unsigned char *palette);
|
2019-08-26 03:59:14 +00:00
|
|
|
|
|
|
|
void EraseScreen(int eax);
|
|
|
|
|
|
|
|
void RestorePalette();
|
|
|
|
|
|
|
|
void FadeIn();
|
|
|
|
void FadeOut(int bFadeMusic);
|
|
|
|
|
|
|
|
void mychangespritesect(int nSprite, int nSector);
|
|
|
|
void mydeletesprite(int nSprite);
|
|
|
|
|
|
|
|
void GrabPalette();
|
|
|
|
|
|
|
|
void mysetbrightness(char nBrightness);
|
|
|
|
|
|
|
|
void StartFadeIn();
|
|
|
|
int DoFadeIn();
|
|
|
|
|
|
|
|
void InitSpiritHead();
|
|
|
|
|
|
|
|
// TODO - relocate
|
|
|
|
void StatusMessage(int messageTime, const char *fmt, ...);
|
|
|
|
|
|
|
|
int DoSpiritHead();
|
|
|
|
|
2019-08-31 15:04:06 +00:00
|
|
|
void HandleAsync();
|
2020-08-23 06:22:59 +00:00
|
|
|
void CheckKeys();
|
|
|
|
void CheckKeys2();
|
|
|
|
void GameTicker();
|
|
|
|
void InitLevel(int);
|
|
|
|
void InitGame();
|
|
|
|
void InitNewGame();
|
2020-08-23 07:11:32 +00:00
|
|
|
void startmainmenu();
|
2019-08-31 15:04:06 +00:00
|
|
|
|
2020-08-22 08:03:21 +00:00
|
|
|
extern bool EndLevel;
|
2019-08-31 09:08:38 +00:00
|
|
|
extern int32_t g_commandSetup;
|
|
|
|
extern int32_t g_noSetup;
|
2019-08-26 03:59:14 +00:00
|
|
|
|
|
|
|
extern char sHollyStr[];
|
|
|
|
|
|
|
|
extern int localclock;
|
|
|
|
|
|
|
|
extern int moveframes;
|
|
|
|
|
|
|
|
extern int nNetPlayerCount;
|
|
|
|
|
|
|
|
extern int htimer;
|
|
|
|
|
|
|
|
extern int nNetTime;
|
|
|
|
|
|
|
|
extern short nTotalPlayers;
|
|
|
|
|
|
|
|
extern short nFontFirstChar;
|
|
|
|
extern short nBackgroundPic;
|
|
|
|
extern short nShadowPic;
|
|
|
|
|
|
|
|
extern short nCreaturesLeft;
|
|
|
|
|
|
|
|
extern int lLocalButtons;
|
|
|
|
|
|
|
|
extern short nEnergyTowers;
|
|
|
|
|
|
|
|
extern short nEnergyChan;
|
|
|
|
|
|
|
|
extern short nSpiritSprite;
|
|
|
|
|
|
|
|
extern short bInDemo;
|
|
|
|
|
|
|
|
extern short nFreeze;
|
|
|
|
|
|
|
|
extern short nCurBodyNum;
|
|
|
|
extern short nBodyTotal;
|
|
|
|
|
|
|
|
extern short bSnakeCam;
|
|
|
|
|
|
|
|
extern short levelnum;
|
2019-08-27 06:08:18 +00:00
|
|
|
//extern short nScreenWidth;
|
|
|
|
//extern short nScreenHeight;
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2019-11-18 20:31:08 +00:00
|
|
|
extern short nMapMode;
|
2019-08-26 03:59:14 +00:00
|
|
|
|
|
|
|
extern short nButtonColor;
|
|
|
|
|
|
|
|
extern short nHeadStage;
|
|
|
|
|
|
|
|
extern short lastfps;
|
|
|
|
|
|
|
|
extern int flash;
|
|
|
|
|
|
|
|
extern short nLocalSpr;
|
|
|
|
extern short levelnew;
|
|
|
|
|
|
|
|
extern short nSnakeCam;
|
|
|
|
|
|
|
|
extern short bCoordinates;
|
|
|
|
|
|
|
|
extern int totalmoves;
|
|
|
|
|
|
|
|
extern int lCountDown;
|
2020-08-23 06:22:59 +00:00
|
|
|
extern short nAlarmTicks;
|
|
|
|
extern short nRedTicks;
|
|
|
|
extern short nClockVal;
|
2019-08-26 03:59:14 +00:00
|
|
|
|
|
|
|
extern short bSlipMode;
|
|
|
|
|
2019-10-27 16:36:25 +00:00
|
|
|
extern int bVanilla;
|
2020-08-23 06:22:59 +00:00
|
|
|
extern short fps;
|
|
|
|
extern short bInMove;
|
2019-10-27 16:36:25 +00:00
|
|
|
|
2019-11-20 18:46:57 +00:00
|
|
|
#define POWERSLAVE (g_gameType & GAMEFLAG_POWERSLAVE)
|
|
|
|
#define EXHUMED (g_gameType & GAMEFLAG_EXHUMED)
|
2019-12-14 08:48:04 +00:00
|
|
|
#define ISDEMOVER (g_gameType & GAMEFLAG_SHAREWARE)
|
2019-11-20 18:46:57 +00:00
|
|
|
|
2019-11-03 17:20:05 +00:00
|
|
|
extern double g_frameDelay;
|
|
|
|
|
2019-08-26 03:59:14 +00:00
|
|
|
enum {
|
2019-08-27 06:08:18 +00:00
|
|
|
kPalNormal = 0,
|
|
|
|
kPalNoDim,
|
|
|
|
kPalTorch,
|
|
|
|
kPalNoTorch,
|
|
|
|
kPalBrite,
|
|
|
|
kPalRedBrite,
|
|
|
|
kPalGreenBrite,
|
|
|
|
kPalNormal2,
|
|
|
|
kPalNoDim2,
|
|
|
|
kPalTorch2,
|
|
|
|
kPalNoTorch2,
|
|
|
|
kPalBrite2
|
2019-08-26 03:59:14 +00:00
|
|
|
};
|
|
|
|
|
2020-08-22 09:56:54 +00:00
|
|
|
|
|
|
|
class TextOverlay
|
|
|
|
{
|
|
|
|
double nCrawlY;
|
|
|
|
short nLeft[50];
|
|
|
|
int nHeight;
|
|
|
|
int lastclock;
|
2020-08-22 16:30:48 +00:00
|
|
|
TArray<FString> screentext;
|
|
|
|
|
2020-08-22 09:56:54 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
void Start(int starttime);
|
2020-08-22 16:30:48 +00:00
|
|
|
void ComputeCinemaText();
|
2020-08-22 09:56:54 +00:00
|
|
|
void ReadyCinemaText(uint16_t nVal);
|
|
|
|
void DisplayText();
|
|
|
|
bool AdvanceCinemaText(int totalclock);
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2019-10-31 17:22:12 +00:00
|
|
|
extern char g_modDir[BMAX_PATH];
|
|
|
|
|
|
|
|
void G_LoadGroupsInDir(const char* dirname);
|
|
|
|
void G_DoAutoload(const char* dirname);
|
2020-08-23 05:41:29 +00:00
|
|
|
void DrawRel(int tile, double x, double y, int shade = 0);
|
2019-10-31 17:22:12 +00:00
|
|
|
|
2020-08-18 08:28:19 +00:00
|
|
|
// savegame.
|
|
|
|
|
|
|
|
int savegame(int nSlot);
|
|
|
|
int loadgame(int nSlot);
|
|
|
|
|
2020-08-22 19:39:14 +00:00
|
|
|
const uint32_t kSpiritX = 106;
|
|
|
|
const uint32_t kSpiritY = 97;
|
|
|
|
const uint32_t WorktileSize = kSpiritX * 2 * kSpiritY * 2;
|
2020-08-18 08:28:19 +00:00
|
|
|
|
|
|
|
struct SavegameHelper
|
|
|
|
{
|
|
|
|
FString Name;
|
|
|
|
TArray<std::pair<void*, size_t>> Elements;
|
|
|
|
SavegameHelper(const char* name, ...);
|
|
|
|
void Load();
|
|
|
|
void Save();
|
|
|
|
};
|
|
|
|
|
|
|
|
#define SV(v) &v, sizeof(v)
|
|
|
|
#define SA(a) &a, sizeof(a)
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-12-12 23:19:34 +00:00
|
|
|
struct GameInterface : ::GameInterface
|
|
|
|
{
|
2020-02-12 19:25:59 +00:00
|
|
|
const char* Name() override { return "Exhumed"; }
|
2019-12-12 23:19:34 +00:00
|
|
|
int app_main() override;
|
2020-01-14 20:48:01 +00:00
|
|
|
bool GenerateSavePic() override;
|
2019-12-14 11:39:18 +00:00
|
|
|
void DrawNativeMenuText(int fontnum, int state, double xpos, double ypos, float fontscale, const char* text, int flags) override;
|
|
|
|
void MenuOpened() override;
|
|
|
|
void MenuSound(EMenuSounds snd) override;
|
|
|
|
void MenuClosed() override;
|
2020-04-23 19:18:40 +00:00
|
|
|
void StartGame(FNewGameStartup& gs) override;
|
2019-12-14 11:39:18 +00:00
|
|
|
FSavegameInfo GetSaveSig() override;
|
2019-12-26 16:42:45 +00:00
|
|
|
void DrawMenuCaption(const DVector2& origin, const char* text) override;
|
2019-12-27 09:52:40 +00:00
|
|
|
bool LoadGame(FSaveGameNode* sv) override;
|
|
|
|
bool SaveGame(FSaveGameNode* sv) override;
|
|
|
|
bool CanSave() override;
|
2020-08-19 22:55:31 +00:00
|
|
|
ReservedSpace GetReservedScreenSpace(int viewsize) override { return { 0, 24 }; }
|
2019-12-14 11:39:18 +00:00
|
|
|
|
2019-12-25 23:21:04 +00:00
|
|
|
FString statFPS() override;
|
2019-12-12 23:19:34 +00:00
|
|
|
//GameStats getStats() override;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2019-11-22 23:11:37 +00:00
|
|
|
END_PS_NS
|
|
|
|
|
2019-08-26 03:59:14 +00:00
|
|
|
#endif
|