2007-01-29 01:18:16 +00:00
|
|
|
// Base services interface declaration
|
|
|
|
// for the Build Engine
|
2012-03-12 04:47:04 +00:00
|
|
|
// by Jonathon Fowler (jf@jonof.id.au)
|
2007-01-29 01:18:16 +00:00
|
|
|
|
2016-03-14 00:07:44 +00:00
|
|
|
#pragma once
|
|
|
|
|
2014-11-22 12:32:56 +00:00
|
|
|
#ifndef baselayer_h_
|
|
|
|
#define baselayer_h_
|
2007-01-29 01:18:16 +00:00
|
|
|
|
2008-02-16 22:27:08 +00:00
|
|
|
#include "compat.h"
|
2008-07-24 11:16:20 +00:00
|
|
|
#include "osd.h"
|
2019-08-13 14:44:16 +00:00
|
|
|
#include "timer.h"
|
2019-10-27 09:53:09 +01:00
|
|
|
#include "c_cvars.h"
|
2019-10-28 01:12:31 +01:00
|
|
|
#include "inputstate.h"
|
2019-11-05 19:57:48 +01:00
|
|
|
#include "printf.h"
|
2019-11-10 11:42:25 +01:00
|
|
|
#include "zstring.h"
|
2019-11-28 19:35:35 +01:00
|
|
|
#include "vectors.h"
|
2008-02-16 22:27:08 +00:00
|
|
|
|
2019-09-21 13:02:17 +02:00
|
|
|
extern int32_t swapcomplete;
|
2019-11-09 19:15:03 +01:00
|
|
|
|
|
|
|
EXTERN_CVAR(Bool, r_usenewaspect)
|
2008-07-22 21:03:09 +00:00
|
|
|
|
2007-01-29 01:18:16 +00:00
|
|
|
// video
|
2019-11-09 19:15:03 +01:00
|
|
|
extern int32_t newaspect_enable;
|
2019-07-06 16:30:18 +00:00
|
|
|
extern int32_t r_fpgrouscan;
|
2012-08-16 21:48:56 +00:00
|
|
|
extern int32_t setaspect_new_use_dimen;
|
2020-03-29 15:22:07 +02:00
|
|
|
extern int32_t xres, yres, bpp, refreshfreq;
|
2007-01-29 01:18:16 +00:00
|
|
|
|
2018-04-12 21:02:51 +00:00
|
|
|
int32_t videoCheckMode(int32_t *x, int32_t *y, int32_t c, int32_t fs, int32_t forced);
|
|
|
|
int32_t videoSetMode(int32_t x, int32_t y, int32_t c, int32_t fs);
|
|
|
|
void videoGetModes(void);
|
|
|
|
void videoShowFrame(int32_t);
|
|
|
|
int32_t videoUpdatePalette(int32_t start, int32_t num);
|
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
extern int32_t qsetmode;
|
2007-01-29 01:18:16 +00:00
|
|
|
|
2013-08-24 22:55:49 +00:00
|
|
|
#define in3dmode() (qsetmode==200)
|
2013-05-30 09:13:32 +00:00
|
|
|
|
2018-04-12 21:02:31 +00:00
|
|
|
extern int32_t g_logFlushWindow;
|
2007-01-29 01:18:16 +00:00
|
|
|
|
2018-04-23 06:35:52 +00:00
|
|
|
void mouseGrabInput(bool grab);
|
2007-01-29 01:18:16 +00:00
|
|
|
|
2019-10-04 21:13:04 +02:00
|
|
|
void getScreen(uint8_t* imgBuf);
|
|
|
|
|
|
|
|
|
2017-06-05 10:05:07 +00:00
|
|
|
#include "print.h"
|
|
|
|
|
2019-11-12 22:00:33 +01:00
|
|
|
struct GameStats
|
|
|
|
{
|
|
|
|
int kill, tkill;
|
|
|
|
int secret, tsecret;
|
|
|
|
int timesecnd;
|
2019-12-09 00:55:30 +01:00
|
|
|
int frags;
|
2019-11-12 22:00:33 +01:00
|
|
|
};
|
|
|
|
|
2019-11-26 23:20:54 +01:00
|
|
|
struct FGameStartup
|
|
|
|
{
|
|
|
|
int Episode;
|
|
|
|
int Level;
|
|
|
|
int Skill;
|
|
|
|
int CustomLevel1;
|
|
|
|
int CustomLevel2;
|
|
|
|
};
|
|
|
|
|
2019-11-27 00:41:26 +01:00
|
|
|
struct FSavegameInfo
|
|
|
|
{
|
|
|
|
const char *savesig;
|
|
|
|
int minsavever;
|
|
|
|
int currentsavever;
|
|
|
|
};
|
|
|
|
|
2019-11-30 19:23:54 +01:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2019-11-29 01:28:13 +01:00
|
|
|
enum EMenuSounds : int;
|
|
|
|
|
2019-09-21 22:53:00 +02:00
|
|
|
struct GameInterface
|
|
|
|
{
|
2020-02-12 20:25:59 +01:00
|
|
|
virtual const char* Name() { return "$"; }
|
2019-11-03 12:32:58 +01:00
|
|
|
virtual ~GameInterface() {}
|
2020-01-12 23:16:21 +01:00
|
|
|
virtual bool GenerateSavePic() { return false; }
|
2019-11-03 12:32:58 +01:00
|
|
|
virtual void faketimerhandler() {} // This is a remnant of older versions, but Blood backend has not updated yet.
|
|
|
|
virtual int app_main() = 0;
|
2020-01-01 09:49:06 +01:00
|
|
|
virtual void UpdateScreenSize() {}
|
2019-12-24 18:53:29 +01:00
|
|
|
virtual void FreeGameData() {}
|
2020-01-22 13:53:26 +01:00
|
|
|
virtual bool validate_hud(int) { return true; }
|
2019-11-03 12:32:58 +01:00
|
|
|
virtual void set_hud_layout(int size) = 0;
|
2020-01-22 13:53:26 +01:00
|
|
|
virtual void set_hud_scale(int size) {}
|
2019-11-10 11:42:25 +01:00
|
|
|
virtual FString statFPS() { return "FPS display not available"; }
|
2019-11-12 22:00:33 +01:00
|
|
|
virtual GameStats getStats() { return {}; }
|
2019-12-01 15:31:08 +01:00
|
|
|
virtual void DrawNativeMenuText(int fontnum, int state, double xpos, double ypos, float fontscale, const char* text, int flags) {}
|
2019-11-23 23:05:24 +01:00
|
|
|
virtual void MainMenuOpened() {}
|
|
|
|
virtual void MenuOpened() {}
|
2019-11-26 23:20:54 +01:00
|
|
|
virtual void MenuClosed() {}
|
|
|
|
virtual void MenuSound(EMenuSounds snd) {}
|
2019-11-23 23:05:24 +01:00
|
|
|
virtual bool CanSave() { return true; }
|
2019-11-26 23:20:54 +01:00
|
|
|
virtual void CustomMenuSelection(int menu, int item) {}
|
|
|
|
virtual void StartGame(FGameStartup& gs) {}
|
2019-11-27 00:41:26 +01:00
|
|
|
virtual FSavegameInfo GetSaveSig() { return { "", 0, 0}; }
|
2019-11-28 01:02:45 +01:00
|
|
|
virtual bool DrawSpecialScreen(const DVector2 &origin, int tilenum) { return false; }
|
2019-12-05 23:17:55 +01:00
|
|
|
virtual void DrawCenteredTextScreen(const DVector2& origin, const char* text, int position, bool withbg = true) {}
|
2019-11-29 00:37:19 +01:00
|
|
|
virtual void DrawMenuCaption(const DVector2& origin, const char* text) {}
|
2019-11-30 19:23:54 +01:00
|
|
|
virtual bool SaveGame(FSaveGameNode*) { return false; }
|
|
|
|
virtual bool LoadGame(FSaveGameNode*) { return false; }
|
2020-01-21 23:36:54 +01:00
|
|
|
virtual bool CleanupForLoad() { return true; }
|
2019-12-13 21:01:14 +01:00
|
|
|
virtual void DoPrintMessage(int prio, const char*) {}
|
2019-12-04 21:35:35 +01:00
|
|
|
void PrintMessage(int prio, const char*fmt, ...)
|
|
|
|
{
|
|
|
|
va_list ap;
|
|
|
|
va_start(ap, fmt);
|
|
|
|
FString f;
|
|
|
|
f.VFormat(fmt, ap);
|
2019-12-04 23:07:02 +01:00
|
|
|
DoPrintMessage(prio, f);
|
2019-12-04 21:35:35 +01:00
|
|
|
}
|
2019-12-05 19:52:46 +01:00
|
|
|
virtual void DrawPlayerSprite(const DVector2& origin, bool onteam) {}
|
2019-12-06 18:36:49 +01:00
|
|
|
virtual void QuitToTitle() {}
|
2019-12-07 20:48:16 +01:00
|
|
|
virtual void SetAmbience(bool on) {}
|
2019-12-23 20:55:12 +01:00
|
|
|
virtual FString GetCoordString() { return "'stat coord' not implemented"; }
|
2020-03-05 00:58:38 +01:00
|
|
|
virtual int GetStringTile(int font, const char* t, int f) { return -1; }
|
2019-12-06 18:36:49 +01:00
|
|
|
|
2019-09-21 22:53:00 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
extern GameInterface* gi;
|
2019-11-10 11:42:25 +01:00
|
|
|
extern double g_beforeSwapTime;
|
|
|
|
|
2019-11-03 12:32:58 +01:00
|
|
|
|
2019-11-07 20:31:16 +01:00
|
|
|
void ImGui_Begin_Frame();
|
|
|
|
|
|
|
|
|
2014-11-22 12:32:56 +00:00
|
|
|
#endif // baselayer_h_
|
2007-01-29 01:18:16 +00:00
|
|
|
|