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.
|
|
|
|
*/
|
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
|
2020-10-11 10:41:38 +00:00
|
|
|
#pragma once
|
2019-08-26 03:59:14 +00:00
|
|
|
|
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"
|
2020-10-11 11:21:54 +00:00
|
|
|
#include "names.h"
|
2021-09-06 21:50:06 +00:00
|
|
|
#include "exhumedactor.h"
|
2021-12-07 17:53:02 +00:00
|
|
|
#include "serialize_obj.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
|
|
|
|
2020-10-11 11:14:32 +00:00
|
|
|
enum { kTimerTicks = 120 };
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2021-11-08 00:13:54 +00:00
|
|
|
const int ITEM_MAGIC = 0x4711;
|
|
|
|
|
2019-10-12 21:09:55 +00:00
|
|
|
enum basepal_t {
|
|
|
|
BASEPAL = 0,
|
|
|
|
ANIMPAL,
|
|
|
|
BASEPALCOUNT
|
|
|
|
};
|
|
|
|
|
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);
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2022-08-04 17:13:55 +00:00
|
|
|
extern uint8_t curpal[];
|
2019-08-26 03:59:14 +00:00
|
|
|
|
|
|
|
void TintPalette(int a, int b, int c);
|
|
|
|
|
|
|
|
void EraseScreen(int eax);
|
|
|
|
|
2021-10-21 19:20:54 +00:00
|
|
|
void DeleteActor(DExhumedActor* actor);
|
2019-08-26 03:59:14 +00:00
|
|
|
|
|
|
|
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
|
|
|
|
2021-04-30 14:21:37 +00:00
|
|
|
void InitLevel(MapRecord*);
|
2020-08-23 06:22:59 +00:00
|
|
|
void InitNewGame();
|
2019-08-31 15:04:06 +00:00
|
|
|
|
2020-08-23 14:30:20 +00:00
|
|
|
void menu_DoPlasma();
|
|
|
|
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;
|
|
|
|
|
2021-11-21 19:13:19 +00:00
|
|
|
extern int nTotalPlayers;
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2021-11-21 18:24:46 +00:00
|
|
|
extern int nFontFirstChar;
|
|
|
|
extern int nBackgroundPic;
|
|
|
|
extern int nShadowPic;
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2021-11-21 19:13:19 +00:00
|
|
|
extern int nCreaturesTotal, nCreaturesKilled;
|
2019-08-26 03:59:14 +00:00
|
|
|
|
|
|
|
extern int lLocalButtons;
|
|
|
|
|
2021-11-21 19:13:19 +00:00
|
|
|
extern int nEnergyTowers;
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2021-11-21 19:13:19 +00:00
|
|
|
extern int nEnergyChan;
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2021-12-07 17:53:02 +00:00
|
|
|
extern TObjPtr<DExhumedActor*> pSpiritSprite;
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2021-11-21 19:13:19 +00:00
|
|
|
extern bool bInDemo;
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2021-11-21 19:13:19 +00:00
|
|
|
extern int nFreeze;
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2021-11-21 19:13:19 +00:00
|
|
|
extern int nCurBodyNum;
|
|
|
|
extern int nBodyTotal;
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2021-11-21 19:13:19 +00:00
|
|
|
extern bool bSnakeCam;
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2021-11-21 19:13:19 +00:00
|
|
|
extern int nButtonColor;
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2021-11-21 18:24:46 +00:00
|
|
|
extern int nHeadStage;
|
2019-08-26 03:59:14 +00:00
|
|
|
|
|
|
|
extern int flash;
|
|
|
|
|
2021-11-21 19:13:19 +00:00
|
|
|
extern int nSnakeCam;
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2021-11-21 19:13:19 +00:00
|
|
|
extern bool bCoordinates;
|
2019-08-26 03:59:14 +00:00
|
|
|
|
|
|
|
extern int totalmoves;
|
|
|
|
|
|
|
|
extern int lCountDown;
|
2021-11-21 19:13:19 +00:00
|
|
|
extern int nAlarmTicks;
|
|
|
|
extern int nRedTicks;
|
|
|
|
extern int nClockVal;
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2021-11-21 19:13:19 +00:00
|
|
|
extern bool bSlipMode;
|
|
|
|
extern bool bDoFlashes;
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2019-10-27 16:36:25 +00:00
|
|
|
extern int bVanilla;
|
|
|
|
|
2020-10-11 11:21:54 +00:00
|
|
|
inline int GameLogo()
|
|
|
|
{
|
|
|
|
return (g_gameType & GAMEFLAG_EXHUMED) ? kExhumedLogo : kPowerslaveLogo;
|
|
|
|
}
|
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
|
|
|
|
{
|
2021-05-31 09:51:02 +00:00
|
|
|
FFont* font;
|
2020-08-22 09:56:54 +00:00
|
|
|
double nCrawlY;
|
2021-11-21 19:34:15 +00:00
|
|
|
int16_t nLeft[50];
|
2020-08-22 09:56:54 +00:00
|
|
|
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();
|
2021-05-02 13:54:19 +00:00
|
|
|
void ReadyCinemaText(const char* nVal);
|
2020-08-22 09:56:54 +00:00
|
|
|
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; }
|
2021-04-30 14:21:37 +00:00
|
|
|
void Create(const FString& text, int 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
|
|
|
|
|
|
|
|
2021-05-31 21:16:52 +00:00
|
|
|
struct GameInterface : public ::GameInterface
|
2019-12-12 23:19:34 +00:00
|
|
|
{
|
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;
|
2021-06-01 09:05:26 +00:00
|
|
|
void loadPalette() override;
|
2020-08-23 15:47:05 +00:00
|
|
|
bool GenerateSavePic() override;
|
2019-12-14 11:39:18 +00:00
|
|
|
void MenuOpened() override;
|
|
|
|
void MenuSound(EMenuSounds snd) override;
|
|
|
|
FSavegameInfo GetSaveSig() override;
|
2020-11-29 18:15:59 +00:00
|
|
|
void SerializeGameState(FSerializer& arc);
|
2019-12-27 09:52:40 +00:00
|
|
|
bool CanSave() override;
|
2020-08-19 22:55:31 +00:00
|
|
|
ReservedSpace GetReservedScreenSpace(int viewsize) override { return { 0, 24 }; }
|
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;
|
2022-01-08 11:09:04 +00:00
|
|
|
//void DrawWeapons() override;
|
2021-11-12 07:59:52 +00:00
|
|
|
void GetInput(ControlInfo* const hidInput, double const scaleAdjust, InputPacket* packet = nullptr) 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;
|
2021-04-15 16:50:48 +00:00
|
|
|
void NewGame(MapRecord *map, int skill, bool) override;
|
2020-09-04 19:59:38 +00:00
|
|
|
void LevelCompleted(MapRecord *map, int skill) override;
|
|
|
|
void NextLevel(MapRecord *map, int skill) override;
|
2021-11-26 22:11:59 +00:00
|
|
|
bool DrawAutomapPlayer(int mx, int my, int x, int y, int z, int a, double const smoothratio) override;
|
2020-10-07 02:28:38 +00:00
|
|
|
fixed_t playerHorizMin() override { return IntToFixed(-150); }
|
|
|
|
fixed_t playerHorizMax() override { return IntToFixed(150); }
|
2020-09-24 12:32:37 +00:00
|
|
|
int playerKeyMove() override { return 6; }
|
2020-11-29 11:23:31 +00:00
|
|
|
void WarpToCoords(int x, int y, int z, int a, int h) override;
|
|
|
|
void ToggleThirdPerson() override;
|
2021-10-30 03:51:54 +00:00
|
|
|
int chaseCamX(binangle ang) { return -(ang.bcos() * 3) >> 5; }
|
|
|
|
int chaseCamY(binangle ang) { return -(ang.bsin() * 3) >> 5; }
|
|
|
|
int chaseCamZ(fixedhoriz horiz) { return (horiz.asq16() * 3) >> 10; }
|
2021-12-04 18:08:50 +00:00
|
|
|
void processSprites(tspritetype* tsprite, int& spritesortcnt, int viewx, int viewy, int viewz, binangle viewang, double smoothRatio) override;
|
2021-07-20 08:50:46 +00:00
|
|
|
int GetCurrentSkill() override;
|
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
|
|
|
|
|