Use t6-gsc-utils as a base.

This commit is contained in:
JezuzLizard
2023-03-23 19:58:53 -07:00
parent e5b1504c1c
commit 011bb0c554
40 changed files with 2556 additions and 0 deletions

66
src/game/game.hpp Normal file
View File

@ -0,0 +1,66 @@
#pragma once
#include "structs.hpp"
#define SELECT(mp, sp) (game::environment::t4mp() ? mp : sp)
namespace game
{
enum gamemode
{
multiplayer,
singleplayer,
none
};
extern gamemode current;
namespace environment
{
bool t4mp();
bool t4sp();
}
template <typename T>
class symbol
{
public:
symbol(const size_t t4mp, const size_t t4sp)
: t4mp_(reinterpret_cast<T*>(t4mp))
, t4sp_(reinterpret_cast<T*>(t4sp))
{
}
T* get() const
{
if (environment::t4mp())
{
return t4mp_;
}
return t4sp_;
}
void set(const size_t ptr)
{
this->t4mp_ = reinterpret_cast<T*>(ptr);
this->t4sp_ = reinterpret_cast<T*>(ptr);
}
operator T* () const
{
return this->get();
}
T* operator->() const
{
return this->get();
}
private:
T* t4mp_;
T* t4sp_;
};
}
#include "symbols.hpp"