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-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"
|
2020-08-23 10:26:52 +00:00
|
|
|
#include "screenjob.h"
|
2020-08-23 12:39:14 +00:00
|
|
|
#include "gamestruct.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
|
|
|
|
2019-08-26 03:59:14 +00:00
|
|
|
#define kTimerTicks 120
|
|
|
|
|
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[]);
|
|
|
|
|
2020-08-23 06:22:59 +00:00
|
|
|
void ResetEngine();
|
2019-08-26 03:59:14 +00:00
|
|
|
|
|
|
|
void SetHiRes();
|
|
|
|
|
|
|
|
void BlackOut();
|
|
|
|
|
2020-08-23 10:26:52 +00:00
|
|
|
void DoGameOverScene(bool finallevel);
|
|
|
|
void DoAfterCinemaScene(int nLevel, TArray<JobDesc> &jobs);
|
|
|
|
void DoBeforeCinemaScene(int nLevel, TArray<JobDesc>& jobs);
|
2019-08-26 03:59:14 +00:00
|
|
|
|
|
|
|
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 mychangespritesect(int nSprite, int nSector);
|
|
|
|
void mydeletesprite(int nSprite);
|
|
|
|
|
|
|
|
void GrabPalette();
|
|
|
|
|
|
|
|
void StartFadeIn();
|
|
|
|
|
|
|
|
void InitSpiritHead();
|
|
|
|
|
|
|
|
// TODO - relocate
|
|
|
|
void StatusMessage(int messageTime, const char *fmt, ...);
|
|
|
|
|
2020-09-06 07:48:26 +00:00
|
|
|
void DoSpiritHead();
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2020-08-23 06:22:59 +00:00
|
|
|
void CheckKeys2();
|
|
|
|
void GameTicker();
|
|
|
|
void InitLevel(int);
|
|
|
|
void InitNewGame();
|
2019-08-31 15:04:06 +00:00
|
|
|
|
2020-08-23 14:30:20 +00:00
|
|
|
int showmap(short nLevel, short nLevelNew, short nLevelBest);
|
|
|
|
void menu_DoPlasma();
|
|
|
|
void menu_DrawTheMap(int nLevel, int nLevelNew, int nLevelBest, TArray<JobDesc>& jobs);
|
|
|
|
void DoEnergyTile();
|
|
|
|
void InitEnergyTile();
|
|
|
|
|
2020-08-23 10:26:52 +00:00
|
|
|
extern int 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[];
|
2020-08-23 10:26:52 +00:00
|
|
|
extern int selectedlevelnew;
|
2019-08-26 03:59:14 +00:00
|
|
|
|
|
|
|
extern int nNetPlayerCount;
|
|
|
|
|
|
|
|
extern int nNetTime;
|
|
|
|
|
|
|
|
extern short nTotalPlayers;
|
|
|
|
|
|
|
|
extern short nFontFirstChar;
|
|
|
|
extern short nBackgroundPic;
|
|
|
|
extern short nShadowPic;
|
|
|
|
|
2020-08-23 12:39:14 +00:00
|
|
|
extern short nCreaturesTotal, nCreaturesKilled;
|
|
|
|
extern int leveltime;
|
2019-08-26 03:59:14 +00:00
|
|
|
|
|
|
|
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;
|
2020-08-23 10:26:52 +00:00
|
|
|
extern uint8_t nCinemaSeen;
|
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 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;
|
2020-09-02 22:41:32 +00:00
|
|
|
extern short bDoFlashes;
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2019-10-27 16:36:25 +00:00
|
|
|
extern int bVanilla;
|
|
|
|
|
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;
|
2020-09-05 18:31:45 +00:00
|
|
|
double lastclock;
|
2020-08-22 16:30:48 +00:00
|
|
|
TArray<FString> screentext;
|
2020-09-04 21:16:21 +00:00
|
|
|
int currentCinemaPalette = 0;
|
2020-08-22 16:30:48 +00:00
|
|
|
|
2020-08-22 09:56:54 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
|
2020-09-05 18:31:45 +00:00
|
|
|
void Start(double 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();
|
2020-09-05 18:31:45 +00:00
|
|
|
bool AdvanceCinemaText(double clock);
|
2020-09-04 21:16:21 +00:00
|
|
|
void SetPalette(int pal) { currentCinemaPalette = pal; }
|
2020-08-22 09:56:54 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
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);
|
2020-09-11 18:56:46 +00:00
|
|
|
void LevelFinished();
|
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"; }
|
2020-08-23 15:47:05 +00:00
|
|
|
void app_init() override;
|
2020-09-23 14:15:51 +00:00
|
|
|
void clearlocalinputstate() override;
|
2020-08-23 15:47:05 +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 }; }
|
2020-08-28 07:06:49 +00:00
|
|
|
void QuitToTitle() override;
|
2020-08-29 22:55:49 +00:00
|
|
|
void UpdateSounds() override;
|
|
|
|
void ErrorCleanup() override;
|
2020-09-02 20:55:57 +00:00
|
|
|
void Ticker() override;
|
|
|
|
void DrawBackground() override;
|
|
|
|
void Render() override;
|
2020-09-06 10:17:54 +00:00
|
|
|
void GetInput(InputPacket* packet, ControlInfo* const hidInput) override;
|
2020-09-02 20:55:57 +00:00
|
|
|
void Startup() override;
|
2020-09-02 22:29:17 +00:00
|
|
|
const char* GenericCheat(int player, int cheat) override;
|
2020-09-04 19:59:38 +00:00
|
|
|
void NewGame(MapRecord *map, int skill) override;
|
|
|
|
void LevelCompleted(MapRecord *map, int skill) override;
|
|
|
|
void NextLevel(MapRecord *map, int skill) override;
|
2020-09-08 19:41:02 +00:00
|
|
|
bool DrawAutomapPlayer(int x, int y, int z, int a) override;
|
2020-09-21 08:48:38 +00:00
|
|
|
fixed_t playerHorizMin() override { return IntToFixed(-50); }
|
|
|
|
fixed_t playerHorizMax() override { return IntToFixed(250); }
|
2020-09-24 12:32:37 +00:00
|
|
|
int playerKeyMove() override { return 6; }
|
2020-08-25 19:34:12 +00:00
|
|
|
|
2020-08-23 12:39:14 +00:00
|
|
|
::GameStats getStats() override;
|
2019-12-12 23:19:34 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2019-11-22 23:11:37 +00:00
|
|
|
END_PS_NS
|
|
|
|
|
2019-08-26 03:59:14 +00:00
|
|
|
#endif
|