2020-06-20 15:52:10 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
bool System_WantGuiCapture(); // During playing this tells us whether the game must be paused due to active GUI elememts.
|
|
|
|
|
|
|
|
#include <stdint.h>
|
2020-07-04 13:51:02 +00:00
|
|
|
#include "vectors.h"
|
2020-07-18 19:28:57 +00:00
|
|
|
#include "engineerrors.h"
|
2020-08-28 07:07:36 +00:00
|
|
|
#include "stats.h"
|
2020-08-29 19:20:10 +00:00
|
|
|
#include "packet.h"
|
2020-09-06 10:17:54 +00:00
|
|
|
#include "inputstate.h"
|
2020-06-20 15:52:10 +00:00
|
|
|
|
2020-09-02 22:29:17 +00:00
|
|
|
class FSerializer;
|
|
|
|
|
2020-06-20 15:52:10 +00:00
|
|
|
struct GameStats
|
|
|
|
{
|
|
|
|
int kill, tkill;
|
|
|
|
int secret, tsecret;
|
|
|
|
int timesecnd;
|
|
|
|
int frags;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct FNewGameStartup
|
|
|
|
{
|
|
|
|
int Episode;
|
|
|
|
int Level;
|
|
|
|
int Skill;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct FSavegameInfo
|
|
|
|
{
|
|
|
|
const char *savesig;
|
|
|
|
int minsavever;
|
|
|
|
int currentsavever;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct FSaveGameNode
|
|
|
|
{
|
|
|
|
FString SaveTitle;
|
|
|
|
FString Filename;
|
|
|
|
bool bOldVersion = false;
|
|
|
|
bool bMissingWads = false;
|
|
|
|
bool bNoDelete = false;
|
|
|
|
bool bIsExt = false;
|
|
|
|
|
|
|
|
bool isValid() const
|
|
|
|
{
|
|
|
|
return Filename.IsNotEmpty() && !bOldVersion && !bMissingWads;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2020-08-16 00:55:50 +00:00
|
|
|
struct ReservedSpace
|
|
|
|
{
|
|
|
|
int top;
|
|
|
|
int statusbar;
|
|
|
|
};
|
2020-06-20 15:52:10 +00:00
|
|
|
|
|
|
|
enum EMenuSounds : int;
|
2020-09-03 21:10:28 +00:00
|
|
|
struct MapRecord;
|
2020-06-20 15:52:10 +00:00
|
|
|
|
2020-08-30 22:09:56 +00:00
|
|
|
extern cycle_t drawtime, actortime, thinktime, gameupdatetime;
|
2020-08-28 07:07:36 +00:00
|
|
|
|
2020-06-20 15:52:10 +00:00
|
|
|
struct GameInterface
|
|
|
|
{
|
|
|
|
virtual const char* Name() { return "$"; }
|
|
|
|
virtual ~GameInterface() {}
|
|
|
|
virtual bool GenerateSavePic() { return false; }
|
2020-08-23 15:47:05 +00:00
|
|
|
virtual void app_init() = 0;
|
2020-07-17 18:56:10 +00:00
|
|
|
virtual void clearlocalinputstate() {}
|
2020-06-20 15:52:10 +00:00
|
|
|
virtual void UpdateScreenSize() {}
|
2020-09-03 21:10:28 +00:00
|
|
|
virtual void FreeLevelData();
|
2020-06-20 15:52:10 +00:00
|
|
|
virtual void FreeGameData() {}
|
2020-07-15 17:48:04 +00:00
|
|
|
virtual void PlayHudSound() {}
|
2020-06-20 15:52:10 +00:00
|
|
|
virtual GameStats getStats() { return {}; }
|
|
|
|
virtual void DrawNativeMenuText(int fontnum, int state, double xpos, double ypos, float fontscale, const char* text, int flags) {}
|
|
|
|
virtual void MainMenuOpened() {}
|
|
|
|
virtual void MenuOpened() {}
|
|
|
|
virtual void MenuClosed() {}
|
|
|
|
virtual void MenuSound(EMenuSounds snd) {}
|
|
|
|
virtual bool CanSave() { return true; }
|
|
|
|
virtual void CustomMenuSelection(int menu, int item) {}
|
|
|
|
virtual void StartGame(FNewGameStartup& gs) {}
|
|
|
|
virtual FSavegameInfo GetSaveSig() { return { "", 0, 0}; }
|
|
|
|
virtual bool DrawSpecialScreen(const DVector2 &origin, int tilenum) { return false; }
|
2020-07-02 08:59:22 +00:00
|
|
|
virtual void DrawCenteredTextScreen(const DVector2& origin, const char* text, int position, bool withbg = true);
|
|
|
|
virtual double SmallFontScale() { return 1; }
|
2020-06-20 15:52:10 +00:00
|
|
|
virtual void DrawMenuCaption(const DVector2& origin, const char* text) {}
|
2020-07-20 22:07:02 +00:00
|
|
|
virtual bool SaveGame(FSaveGameNode*) { return true; }
|
|
|
|
virtual bool LoadGame(FSaveGameNode*) { return true; }
|
|
|
|
virtual void SerializeGameState(FSerializer& arc) {}
|
2020-06-20 15:52:10 +00:00
|
|
|
virtual void DrawPlayerSprite(const DVector2& origin, bool onteam) {}
|
|
|
|
virtual void QuitToTitle() {}
|
|
|
|
virtual void SetAmbience(bool on) {}
|
|
|
|
virtual FString GetCoordString() { return "'stat coord' not implemented"; }
|
2020-07-18 19:28:57 +00:00
|
|
|
virtual void ExitFromMenu() { throw CExitEvent(0); }
|
2020-08-16 00:55:50 +00:00
|
|
|
virtual ReservedSpace GetReservedScreenSpace(int viewsize) { return { 0, 0 }; }
|
2020-09-06 10:17:54 +00:00
|
|
|
virtual void GetInput(InputPacket* packet, ControlInfo* const hidInput) {}
|
2020-08-29 22:55:49 +00:00
|
|
|
virtual void UpdateSounds() {}
|
|
|
|
virtual void ErrorCleanup() {}
|
2020-08-30 07:32:34 +00:00
|
|
|
virtual void Startup() {}
|
|
|
|
virtual void DrawBackground() {}
|
2020-08-29 22:55:49 +00:00
|
|
|
virtual void Render() {}
|
2020-08-30 06:03:03 +00:00
|
|
|
virtual void Ticker() {}
|
2020-08-30 07:32:34 +00:00
|
|
|
virtual int GetPlayerChecksum(int pnum) { return 0x12345678 + pnum; }
|
2020-09-02 22:29:17 +00:00
|
|
|
virtual const char *CheckCheatMode() { return nullptr; }
|
|
|
|
virtual const char* GenericCheat(int player, int cheat) = 0;
|
2020-09-03 21:10:28 +00:00
|
|
|
virtual void NextLevel(MapRecord* map, int skill) {}
|
|
|
|
virtual void NewGame(MapRecord* map, int skill) {}
|
|
|
|
virtual void LevelCompleted(MapRecord* map, int skill) {}
|
2020-09-06 19:15:59 +00:00
|
|
|
virtual bool DrawAutomapPlayer(int x, int y, int z, int a) { return false; }
|
2020-09-14 23:27:24 +00:00
|
|
|
virtual void SetTileProps(int tile, int surf, int vox, int shade) {}
|
2020-08-24 18:20:15 +00:00
|
|
|
|
2020-08-28 07:07:36 +00:00
|
|
|
virtual FString statFPS()
|
|
|
|
{
|
|
|
|
FString output;
|
|
|
|
|
|
|
|
output.AppendFormat("Actor think time: %.3f ms\n", actortime.TimeMS());
|
|
|
|
output.AppendFormat("Total think time: %.3f ms\n", thinktime.TimeMS());
|
|
|
|
output.AppendFormat("Game Update: %.3f ms\n", gameupdatetime.TimeMS());
|
|
|
|
output.AppendFormat("Draw time: %.3f ms\n", drawtime.TimeMS());
|
|
|
|
|
|
|
|
return output;
|
|
|
|
}
|
2020-08-24 18:20:15 +00:00
|
|
|
|
2020-06-20 15:52:10 +00:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
extern GameInterface* gi;
|
|
|
|
|
|
|
|
|
|
|
|
void ImGui_Begin_Frame();
|
|
|
|
|