2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-08 13:44:56 +00:00

Major scoped-enum refactor

This commit is contained in:
Jack Andersen
2015-11-20 15:16:07 -10:00
parent 4c09ded013
commit e423db32ee
83 changed files with 958 additions and 904 deletions

View File

@@ -12,7 +12,7 @@ public:
CAudioStateWin() : CIOWin("CAudioStateWin") {}
CIOWin::EMessageReturn OnMessage(const CArchitectureMessage& msg, CArchitectureQueue& queue)
{
return MsgRetNormal;
return EMessageReturn::Normal;
}
};

View File

@@ -12,11 +12,11 @@ namespace Retro
class CSfxManager
{
enum ESfxChannels
enum class ESfxChannels
{
};
enum ESfxAudibility
enum class ESfxAudibility
{
Aud0,
Aud1,

View File

@@ -7,12 +7,12 @@
namespace Retro
{
enum ECollisionResponseType
enum class ECollisionResponseType
{
CR_Unknown12 = 0xC,
Unknown12 = 0xC,
};
enum EMaterialTypes
enum class EMaterialTypes
{
};
@@ -24,7 +24,7 @@ class CWeaponMode;
class CActor : public CEntity
{
protected:
enum Flags
enum class Flags
{
Unknown5 = (1 << 5),
Unknown6 = (1 << 6),
@@ -55,7 +55,7 @@ public:
virtual Zeus::CVector3f GetOrbitPosition()
{ return Zeus::CVector3f(x40_unknown, x50_unknown, x60_unknown); }
virtual ECollisionResponseType GetCollisionResponseType(const Zeus::CVector3f&, const Zeus::CVector3f&, CWeaponMode&, int) { return CR_Unknown12; }
virtual ECollisionResponseType GetCollisionResponseType(const Zeus::CVector3f&, const Zeus::CVector3f&, CWeaponMode&, int) { return ECollisionResponseType::Unknown12; }
void RemoveMaterial(EMaterialTypes, EMaterialTypes, EMaterialTypes, EMaterialTypes, CStateManager&){}
void RemoveMaterial(EMaterialTypes, EMaterialTypes, EMaterialTypes, CStateManager&){ }
void RemoveMaterial(EMaterialTypes, EMaterialTypes, CStateManager&){ }

View File

@@ -13,11 +13,11 @@ namespace Retro
{
/* TODO: Figure out what all this is for and move it somewhere appropriate */
enum EStateMsg
enum class EStateMsg
{
};
enum EListenNoiseType
enum class EListenNoiseType
{
};

View File

@@ -9,25 +9,25 @@ namespace Retro
{
class CIOWin;
enum EArchMsgTarget
enum class EArchMsgTarget
{
TargetIOWinManager = 0,
TargetGame = 1
IOWinManager = 0,
Game = 1
};
enum EArchMsgType
enum class EArchMsgType
{
MsgRemoveIOWin = 0,
MsgCreateIOWin = 1,
MsgChangeIOWinPriority = 2,
MsgRemoveAllIOWins = 3,
MsgTimerTick = 4,
MsgUserInput = 5,
MsgSetGameState = 6,
MsgControllerStatus = 7,
MsgQuitGameplay = 8,
MsgUpdateBegin = 10,
MsgFrameBegin = 11,
RemoveIOWin = 0,
CreateIOWin = 1,
ChangeIOWinPriority = 2,
RemoveAllIOWins = 3,
TimerTick = 4,
UserInput = 5,
SetGameState = 6,
ControllerStatus = 7,
QuitGameplay = 8,
UpdateBegin = 10,
FrameBegin = 11,
};
struct IArchMsgParm
@@ -101,11 +101,11 @@ class MakeMsg
public:
static CArchitectureMessage CreateQuitGameplay(EArchMsgTarget target)
{
return CArchitectureMessage(target, MsgQuitGameplay, new CArchMsgParmNull());
return CArchitectureMessage(target, EArchMsgType::QuitGameplay, new CArchMsgParmNull());
}
static CArchitectureMessage CreateControllerStatus(EArchMsgTarget target, u16 a, bool b)
{
return CArchitectureMessage(target, MsgControllerStatus, new CArchMsgParmControllerStatus(a, b));
return CArchitectureMessage(target, EArchMsgType::ControllerStatus, new CArchMsgParmControllerStatus(a, b));
}
static const CArchMsgParmInt32& GetParmNewGameflowState(const CArchitectureMessage& msg)
{
@@ -117,7 +117,7 @@ public:
}
static CArchitectureMessage CreateUserInput(EArchMsgTarget target, const CFinalInput& input)
{
return CArchitectureMessage(target, MsgUserInput, new CArchMsgParmUserInput(input));
return CArchitectureMessage(target, EArchMsgType::UserInput, new CArchMsgParmUserInput(input));
}
static const CArchMsgParmReal32& GetParmTimerTick(const CArchitectureMessage& msg)
{
@@ -125,7 +125,7 @@ public:
}
static CArchitectureMessage CreateTimerTick(EArchMsgTarget target, float val)
{
return CArchitectureMessage(target, MsgTimerTick, new CArchMsgParmReal32(val));
return CArchitectureMessage(target, EArchMsgType::TimerTick, new CArchMsgParmReal32(val));
}
static const CArchMsgParmInt32Int32VoidPtr& GetParmChangeIOWinPriority(const CArchitectureMessage& msg)
{
@@ -137,7 +137,7 @@ public:
}
static CArchitectureMessage CreateCreateIOWin(EArchMsgTarget target, int pmin, int pmax, CIOWin* iowin)
{
return CArchitectureMessage(target, MsgCreateIOWin, new CArchMsgParmInt32Int32VoidPtr(pmin, pmax, iowin));
return CArchitectureMessage(target, EArchMsgType::CreateIOWin, new CArchMsgParmInt32Int32VoidPtr(pmin, pmax, iowin));
}
static const CArchMsgParmVoidPtr& GetParmDeleteIOWin(const CArchitectureMessage& msg)
{

View File

@@ -8,11 +8,11 @@ namespace Retro
const char* DecodeARAMFile(const char* name);
enum ESeekOrigin
enum class ESeekOrigin
{
OriginBegin = 0,
OriginCur = 1,
OriginEnd = 2
Begin = 0,
Cur = 1,
End = 2
};
struct DVDFileInfo;

View File

@@ -11,11 +11,11 @@ public:
virtual bool IsComplete()=0;
virtual void PostCancelRequest()=0;
enum EMediaType
enum class EMediaType
{
MediaARAM = 0,
MediaReal = 1,
MediaNOD = 2
ARAM = 0,
Real = 1,
NOD = 2
};
virtual EMediaType GetMediaType() const=0;
};
@@ -26,7 +26,7 @@ public:
void WaitUntilComplete();
bool IsComplete();
void PostCancelRequest();
EMediaType GetMediaType() const {return MediaNOD;}
EMediaType GetMediaType() const {return EMediaType::NOD;}
};
class CDvdRequest : public IDvdRequest
@@ -34,7 +34,7 @@ class CDvdRequest : public IDvdRequest
void WaitUntilComplete();
bool IsComplete();
void PostCancelRequest();
EMediaType GetMediaType() const { return MediaReal; }
EMediaType GetMediaType() const { return EMediaType::Real; }
};
}

View File

@@ -11,30 +11,30 @@ void CEntity::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId objId, CStateM
{
switch (msg)
{
case MsgActivate:
case EScriptObjectMessage::Activate:
if (!GetActive())
{
SetActive(true);
SendScriptMsgs(StActive, stateMgr, MsgNone);
SendScriptMsgs(EScriptObjectState::Active, stateMgr, EScriptObjectMessage::None);
}
break;
case MsgDeactivate:
case EScriptObjectMessage::Deactivate:
if (GetActive())
{
SetActive(false);
SendScriptMsgs(StInactive, stateMgr, MsgNone);
SendScriptMsgs(EScriptObjectState::Inactive, stateMgr, EScriptObjectMessage::None);
}
break;
case MsgToggleActive:
case EScriptObjectMessage::ToggleActive:
if (GetActive())
{
SetActive(false);
SendScriptMsgs(StInactive, stateMgr, MsgNone);
SendScriptMsgs(EScriptObjectState::Inactive, stateMgr, EScriptObjectMessage::None);
}
else
{
SetActive(true);
SendScriptMsgs(StActive, stateMgr, MsgNone);
SendScriptMsgs(EScriptObjectState::Active, stateMgr, EScriptObjectMessage::None);
}
break;
default: break;

View File

@@ -9,15 +9,15 @@ class CFinalInput;
const char* StringForControlOption(int);
enum EDebugMenu
enum class EDebugMenu
{
};
enum EDebugOptions
enum class EDebugOptions
{
};
enum EDebugMainMenu
enum class EDebugMainMenu
{
};
@@ -31,7 +31,7 @@ public:
class CGameDebug
{
public:
enum EReturnValue
enum class EReturnValue
{
};

View File

@@ -14,12 +14,12 @@ class CIOWin
std::string m_name;
size_t m_nameHash;
public:
enum EMessageReturn
enum class EMessageReturn
{
MsgRetNormal = 0,
MsgRetExit = 1,
MsgRetRemoveIOWinAndExit = 2,
MsgRetRemoveIOWin = 3
Normal = 0,
Exit = 1,
RemoveIOWinAndExit = 2,
RemoveIOWin = 3
};
virtual ~CIOWin() {}
CIOWin(const char* name) : m_name(name) {m_nameHash = std::hash<std::string>()(m_name);}

View File

@@ -9,7 +9,7 @@ bool CIOWinManager::OnIOWinMessage(const CArchitectureMessage& msg)
{
switch (msg.GetType())
{
case MsgRemoveIOWin:
case EArchMsgType::RemoveIOWin:
{
const CArchMsgParmVoidPtr& parm = MakeMsg::GetParmDeleteIOWin(msg);
CIOWin* iow = FindIOWin(*static_cast<const std::string*>(parm.x4_parm1));
@@ -17,14 +17,14 @@ bool CIOWinManager::OnIOWinMessage(const CArchitectureMessage& msg)
RemoveIOWin(iow);
return false;
}
case MsgCreateIOWin:
case EArchMsgType::CreateIOWin:
{
const CArchMsgParmInt32Int32VoidPtr& parm = MakeMsg::GetParmCreateIOWin(msg);
rstl::rc_ptr<CIOWin> iow(static_cast<CIOWin*>(parm.xc_parm3));
AddIOWin(iow, parm.x4_parm1, parm.x8_parm2);
return false;
}
case MsgChangeIOWinPriority:
case EArchMsgType::ChangeIOWinPriority:
{
const CArchMsgParmInt32Int32VoidPtr& parm = MakeMsg::GetParmChangeIOWinPriority(msg);
CIOWin* iow = FindIOWin(*static_cast<const std::string*>(parm.xc_parm3));
@@ -32,7 +32,7 @@ bool CIOWinManager::OnIOWinMessage(const CArchitectureMessage& msg)
ChangeIOWinPriority(iow, parm.x4_parm1, parm.x8_parm2);
return false;
}
case MsgRemoveAllIOWins:
case EArchMsgType::RemoveAllIOWins:
{
RemoveAllIOWins();
return true;
@@ -76,7 +76,7 @@ bool CIOWinManager::DistributeOneMessage(const CArchitectureMessage& msg,
while (x8_localGatherQueue)
{
CArchitectureMessage msg = x8_localGatherQueue.Pop();
if (msg.GetTarget() == TargetIOWinManager)
if (msg.GetTarget() == EArchMsgTarget::IOWinManager)
{
if (OnIOWinMessage(msg))
{
@@ -91,16 +91,16 @@ bool CIOWinManager::DistributeOneMessage(const CArchitectureMessage& msg,
switch (mret)
{
case CIOWin::MsgRetRemoveIOWinAndExit:
case CIOWin::MsgRetRemoveIOWin:
case CIOWin::EMessageReturn::RemoveIOWinAndExit:
case CIOWin::EMessageReturn::RemoveIOWin:
RemoveIOWin(iow);
default: break;
}
switch (mret)
{
case CIOWin::MsgRetExit:
case CIOWin::MsgRetRemoveIOWinAndExit:
case CIOWin::EMessageReturn::Exit:
case CIOWin::EMessageReturn::RemoveIOWinAndExit:
return false;
default: break;
}

View File

@@ -8,19 +8,19 @@ CIOWin::EMessageReturn CMainFlowBase::OnMessage(const CArchitectureMessage& msg,
{
switch (msg.GetType())
{
case MsgTimerTick:
case EArchMsgType::TimerTick:
AdvanceGameState(queue);
break;
case MsgSetGameState:
case EArchMsgType::SetGameState:
{
const CArchMsgParmInt32& state = MakeMsg::GetParmNewGameflowState(msg);
x14_gameState = EClientFlowStates(state.x4_parm);
SetGameState(x14_gameState, queue);
return MsgRetExit;
return EMessageReturn::Exit;
}
default: break;
}
return MsgRetNormal;
return EMessageReturn::Normal;
}
}

View File

@@ -6,12 +6,12 @@
namespace Retro
{
enum EClientFlowStates
enum class EClientFlowStates
{
ClientFlowUnspecified = -1,
ClientFlowFrontEnd = 7,
ClientFlowGameLoad = 13,
ClientFlowMoviePlay = 14
Unspecified = -1,
FrontEnd = 7,
GameLoad = 13,
MoviePlay = 14
};
class CMainFlowBase : public CIOWin

View File

@@ -75,9 +75,9 @@ void* operator new(std::size_t sz)
{
Retro::CCallStack cs("?\?(?\?)", "UnknownType");
return Retro::CMemory::Alloc(sz,
Retro::IAllocator::HintNone,
Retro::IAllocator::ScopeDefault,
Retro::IAllocator::TypePrimitive,
Retro::IAllocator::EHint::None,
Retro::IAllocator::EScope::Default,
Retro::IAllocator::EType::Primitive,
cs);
}
@@ -86,9 +86,9 @@ void* operator new(std::size_t sz,
{
Retro::CCallStack cs(funcName, typeName);
return Retro::CMemory::Alloc(sz,
Retro::IAllocator::HintNone,
Retro::IAllocator::ScopeDefault,
Retro::IAllocator::TypePrimitive,
Retro::IAllocator::EHint::None,
Retro::IAllocator::EScope::Default,
Retro::IAllocator::EType::Primitive,
cs);
}
@@ -101,9 +101,9 @@ void* operator new[](std::size_t sz)
{
Retro::CCallStack cs("?\?(?\?)", "UnknownType");
return Retro::CMemory::Alloc(sz,
Retro::IAllocator::HintNone,
Retro::IAllocator::ScopeDefault,
Retro::IAllocator::TypeArray,
Retro::IAllocator::EHint::None,
Retro::IAllocator::EScope::Default,
Retro::IAllocator::EType::Array,
cs);
}
@@ -112,9 +112,9 @@ void* operator new[](std::size_t sz,
{
Retro::CCallStack cs(funcName, typeName);
return Retro::CMemory::Alloc(sz,
Retro::IAllocator::HintNone,
Retro::IAllocator::ScopeDefault,
Retro::IAllocator::TypeArray,
Retro::IAllocator::EHint::None,
Retro::IAllocator::EScope::Default,
Retro::IAllocator::EType::Array,
cs);
}

View File

@@ -11,7 +11,7 @@ class CVector3f;
class CMoviePlayer : public CDvdFile
{
public:
enum EPlayMode
enum class EPlayMode
{
};

View File

@@ -7,16 +7,16 @@
namespace Retro
{
enum EGameObjectList
enum class EGameObjectList
{
ListAll,
ListActor,
ListPhysicsActor,
ListGameCamera,
ListGameLight,
ListListeningAi,
ListAiWaypoint,
ListPlatformAndDoor,
All,
Actor,
PhysicsActor,
GameCamera,
GameLight,
ListeningAi,
AiWaypoint,
PlatformAndDoor,
};
class CObjectList

View File

@@ -23,12 +23,12 @@ public:
};
private:
bool x28_b24_ctFlag;
enum EAsyncPhase
enum class EAsyncPhase
{
PakAsyncWarmup = 0,
PakAsyncInitialHeader = 1,
PakAsyncDataLoad = 2,
PakAsyncLoaded = 3
Warmup = 0,
InitialHeader = 1,
DataLoad = 2,
Loaded = 3
} x2c_asyncLoadPhase;
IDvdRequest* x34_dvdReq;
std::vector<std::pair<std::string, SObjectTag>> x4c_nameList;
@@ -52,19 +52,19 @@ public:
void Warmup() {}
void AsyncIdle()
{
if (x2c_asyncLoadPhase == PakAsyncLoaded)
if (x2c_asyncLoadPhase == EAsyncPhase::Loaded)
return;
if (x34_dvdReq && x34_dvdReq->IsComplete())
return;
switch (x2c_asyncLoadPhase)
{
case PakAsyncWarmup:
case EAsyncPhase::Warmup:
Warmup();
break;
case PakAsyncInitialHeader:
case EAsyncPhase::InitialHeader:
InitialHeaderLoad();
break;
case PakAsyncDataLoad:
case EAsyncPhase::DataLoad:
DataLoad();
break;
default: break;

View File

@@ -13,7 +13,7 @@ class CPlayMovieBase : public CIOWin
public:
CPlayMovieBase(const char* iowName, const char* path)
: CIOWin(iowName), x18_moviePlayer(path, 0.0, false) {}
EMessageReturn OnMessage(const CArchitectureMessage&, CArchitectureQueue&) {return MsgRetNormal;}
EMessageReturn OnMessage(const CArchitectureMessage&, CArchitectureQueue&) {return EMessageReturn::Normal;}
void Draw() const {}
};

View File

@@ -40,12 +40,12 @@ CInputStream* CResLoader::LoadNewResourcePartSync(const SObjectTag& tag, int off
{
CCallStack cs(AT_PRETTY_FUNCTION, "UnknownType");
buf = CMemory::Alloc(length,
IAllocator::HintLarge,
IAllocator::ScopeDefault,
IAllocator::TypePrimitive,
IAllocator::EHint::Large,
IAllocator::EScope::Default,
IAllocator::EType::Primitive,
cs);
}
file->SyncSeekRead(buf, length, OriginBegin, x50_cachedResInfo->x4_offset + offset);
file->SyncSeekRead(buf, length, ESeekOrigin::Begin, x50_cachedResInfo->x4_offset + offset);
return new CMemoryInStream((atUint8*)buf, length, !extBuf);
}
@@ -54,11 +54,11 @@ void CResLoader::LoadMemResourceSync(const SObjectTag& tag, void** bufOut, int*
CPakFile* file = FindResourceForLoad(tag);
CCallStack cs(AT_PRETTY_FUNCTION, "UnknownType");
void* buf = CMemory::Alloc(x50_cachedResInfo->x8_size,
IAllocator::HintLarge,
IAllocator::ScopeDefault,
IAllocator::TypePrimitive,
IAllocator::EHint::Large,
IAllocator::EScope::Default,
IAllocator::EType::Primitive,
cs);
file->SyncSeekRead(buf, x50_cachedResInfo->x8_size, OriginBegin,
file->SyncSeekRead(buf, x50_cachedResInfo->x8_size, ESeekOrigin::Begin,
x50_cachedResInfo->x4_offset);
*bufOut = buf;
*sizeOut = x50_cachedResInfo->x8_size;
@@ -85,12 +85,12 @@ CInputStream* CResLoader::LoadNewResourceSync(const SObjectTag& tag, void* extBu
{
CCallStack cs(AT_PRETTY_FUNCTION, "UnknownType");
buf = CMemory::Alloc(resSz,
IAllocator::HintLarge,
IAllocator::ScopeDefault,
IAllocator::TypePrimitive,
IAllocator::EHint::Large,
IAllocator::EScope::Default,
IAllocator::EType::Primitive,
cs);
}
file->SyncSeekRead(buf, resSz, OriginBegin, x50_cachedResInfo->x4_offset);
file->SyncSeekRead(buf, resSz, ESeekOrigin::Begin, x50_cachedResInfo->x4_offset);
CInputStream* newStrm = new CMemoryInStream((atUint8*)buf, resSz, !extBuf);
if (x50_cachedResInfo->xb_compressed)
{
@@ -103,13 +103,13 @@ CInputStream* CResLoader::LoadNewResourceSync(const SObjectTag& tag, void* extBu
IDvdRequest* CResLoader::LoadResourcePartAsync(const SObjectTag& tag, int offset, int length, void* buf)
{
return FindResourceForLoad(tag.id)->AsyncSeekRead(buf, length,
OriginBegin, x50_cachedResInfo->x4_offset + offset);
ESeekOrigin::Begin, x50_cachedResInfo->x4_offset + offset);
}
IDvdRequest* CResLoader::LoadResourceAsync(const SObjectTag& tag, void* buf)
{
return FindResourceForLoad(tag.id)->AsyncSeekRead(buf, ROUND_UP_32(x50_cachedResInfo->x8_size),
OriginBegin, x50_cachedResInfo->x4_offset);
ESeekOrigin::Begin, x50_cachedResInfo->x4_offset);
}
bool CResLoader::GetResourceCompression(const SObjectTag& tag)
@@ -161,7 +161,7 @@ void CResLoader::AsyncIdlePakLoading()
++it)
{
(*it)->AsyncIdle();
if ((*it)->x2c_asyncLoadPhase == CPakFile::PakAsyncLoaded)
if ((*it)->x2c_asyncLoadPhase == CPakFile::EAsyncPhase::Loaded)
{
MoveToCorrectLoadedList(std::move(*it));
it = x34_pakLoadingList.erase(it);

View File

@@ -23,16 +23,16 @@ class IRenderer
public:
typedef void(*TDrawableCallback)(const void*, const void*, int);
typedef void(*TReflectionCallback)(void*, const CVector3f&);
enum EDrawableSorting
enum class EDrawableSorting
{
};
enum EDebugOption
enum class EDebugOption
{
};
enum EPrimitiveType
enum class EPrimitiveType
{
};
enum ERglFogMode
enum class ERglFogMode
{
};

View File

@@ -12,21 +12,21 @@ class IAllocator
{
public:
virtual ~IAllocator() {}
enum EHint
enum class EHint
{
HintNone = 0x0,
HintTopOfHeap = 0x1,
HintLarge = 0x2
None = 0x0,
TopOfHeap = 0x1,
Large = 0x2
};
enum EScope
enum class EScope
{
ScopeNone = 0,
ScopeDefault = 1
None = 0,
Default = 1
};
enum EType
enum class EType
{
TypePrimitive = 0,
TypeArray = 1
Primitive = 0,
Array = 1
};
struct SAllocInfo
{

View File

@@ -71,18 +71,18 @@ CFinalInput::CFinalInput(int cIdx, float dt,
x23_enableAnaRightNegYP(DRADown() && !prevInput.DRADown()),
x24_anaLeftTriggerP(DLTrigger() && !prevInput.DLTrigger()),
x28_anaRightTriggerP(DRTrigger() && !prevInput.DRTrigger()),
x2c_b24_A(data.m_btns & boo::DOL_A),
x2c_b25_B(data.m_btns & boo::DOL_B),
x2c_b26_X(data.m_btns & boo::DOL_X),
x2c_b27_Y(data.m_btns & boo::DOL_Y),
x2c_b28_Z(data.m_btns & boo::DOL_Z),
x2c_b29_L(data.m_btns & boo::DOL_L),
x2c_b30_R(data.m_btns & boo::DOL_R),
x2c_b31_DPUp(data.m_btns & boo::DOL_UP),
x2d_b24_DPRight(data.m_btns & boo::DOL_RIGHT),
x2d_b25_DPDown(data.m_btns & boo::DOL_DOWN),
x2d_b26_DPLeft(data.m_btns & boo::DOL_LEFT),
x2d_b27_Start(data.m_btns & boo::DOL_START),
x2c_b24_A(data.m_btns & uint16_t(boo::EDolphinControllerButtons::A)),
x2c_b25_B(data.m_btns & uint16_t(boo::EDolphinControllerButtons::B)),
x2c_b26_X(data.m_btns & uint16_t(boo::EDolphinControllerButtons::X)),
x2c_b27_Y(data.m_btns & uint16_t(boo::EDolphinControllerButtons::Y)),
x2c_b28_Z(data.m_btns & uint16_t(boo::EDolphinControllerButtons::Z)),
x2c_b29_L(data.m_btns & uint16_t(boo::EDolphinControllerButtons::L)),
x2c_b30_R(data.m_btns & uint16_t(boo::EDolphinControllerButtons::R)),
x2c_b31_DPUp(data.m_btns & uint16_t(boo::EDolphinControllerButtons::Up)),
x2d_b24_DPRight(data.m_btns & uint16_t(boo::EDolphinControllerButtons::Right)),
x2d_b25_DPDown(data.m_btns & uint16_t(boo::EDolphinControllerButtons::Down)),
x2d_b26_DPLeft(data.m_btns & uint16_t(boo::EDolphinControllerButtons::Left)),
x2d_b27_Start(data.m_btns & uint16_t(boo::EDolphinControllerButtons::Start)),
x2d_b28_PA(DA() && !prevInput.DA()),
x2d_b29_PB(DB() && !prevInput.DB()),
x2d_b30_PX(DX() && !prevInput.DX()),
@@ -157,18 +157,18 @@ CFinalInput::CFinalInput(int cIdx, float dt,
x23_enableAnaRightNegYP(DRADown() && !prevInput.DRADown()),
x24_anaLeftTriggerP(DLTrigger() && !prevInput.DLTrigger()),
x28_anaRightTriggerP(DRTrigger() && !prevInput.DRTrigger()),
x2c_b24_A(data.m_mouseButtons[boo::BUTTON_PRIMARY]),
x2c_b24_A(data.m_mouseButtons[int(boo::EMouseButton::Primary)]),
x2c_b25_B(data.m_charKeys[' ']),
x2c_b26_X(data.m_charKeys['c']),
x2c_b27_Y(data.m_mouseButtons[boo::BUTTON_SECONDARY]),
x2c_b27_Y(data.m_mouseButtons[int(boo::EMouseButton::Secondary)]),
x2c_b28_Z(data.m_charKeys['\t']),
x2c_b29_L(data.m_charKeys['q']),
x2c_b30_R(data.m_charKeys['e']),
x2c_b31_DPUp(data.m_specialKeys[boo::KEY_UP]),
x2d_b24_DPRight(data.m_specialKeys[boo::KEY_RIGHT]),
x2d_b25_DPDown(data.m_specialKeys[boo::KEY_DOWN]),
x2d_b26_DPLeft(data.m_specialKeys[boo::KEY_LEFT]),
x2d_b27_Start(data.m_specialKeys[boo::KEY_ESC]),
x2c_b31_DPUp(data.m_specialKeys[int(boo::ESpecialKey::Up)]),
x2d_b24_DPRight(data.m_specialKeys[int(boo::ESpecialKey::Right)]),
x2d_b25_DPDown(data.m_specialKeys[int(boo::ESpecialKey::Down)]),
x2d_b26_DPLeft(data.m_specialKeys[int(boo::ESpecialKey::Left)]),
x2d_b27_Start(data.m_specialKeys[int(boo::ESpecialKey::Esc)]),
x2d_b28_PA(DA() && !prevInput.DA()),
x2d_b29_PB(DB() && !prevInput.DB()),
x2d_b30_PX(DX() && !prevInput.DX()),

View File

@@ -16,8 +16,8 @@ void CInputGenerator::Update(float dt, CArchitectureQueue& queue)
{
bool connected;
EStatusChange change = m_dolphinCb.getStatusChange(i, connected);
if (change)
queue.Push(std::move(MakeMsg::CreateControllerStatus(TargetGame, i, connected)));
if (change != EStatusChange::NoChange)
queue.Push(std::move(MakeMsg::CreateControllerStatus(EArchMsgTarget::Game, i, connected)));
if (connected)
{
CFinalInput input = m_dolphinCb.getFinalInput(i, dt, m_leftDiv, m_rightDiv);
@@ -26,13 +26,13 @@ void CInputGenerator::Update(float dt, CArchitectureQueue& queue)
input |= kbInput;
kbUsed = true;
}
queue.Push(std::move(MakeMsg::CreateUserInput(TargetGame, input)));
queue.Push(std::move(MakeMsg::CreateUserInput(EArchMsgTarget::Game, input)));
}
}
/* Send straight keyboard input if no first controller present */
if (!kbUsed)
queue.Push(std::move(MakeMsg::CreateUserInput(TargetGame, kbInput)));
queue.Push(std::move(MakeMsg::CreateUserInput(EArchMsgTarget::Game, kbInput)));
}
}

View File

@@ -12,11 +12,11 @@ class CArchitectureQueue;
class CInputGenerator : public boo::DeviceFinder
{
enum EStatusChange
enum class EStatusChange
{
StatusNoChange = 0,
StatusConnected = 1,
StatusDisconnected = 2
NoChange = 0,
Connected = 1,
Disconnected = 2
};
/* When the sticks are used as logical (digital) input,
@@ -41,11 +41,11 @@ public:
void mouseDown(const boo::SWindowCoord&, boo::EMouseButton button, boo::EModifierKey)
{
m_data.m_mouseButtons[button] = true;
m_data.m_mouseButtons[int(button)] = true;
}
void mouseUp(const boo::SWindowCoord&, boo::EMouseButton button, boo::EModifierKey)
{
m_data.m_mouseButtons[button] = false;
m_data.m_mouseButtons[int(button)] = false;
}
void mouseMove(const boo::SWindowCoord& coord)
{
@@ -72,19 +72,19 @@ public:
}
void specialKeyDown(boo::ESpecialKey key, boo::EModifierKey, bool)
{
m_data.m_specialKeys[key] = true;
m_data.m_specialKeys[int(key)] = true;
}
void specialKeyUp(boo::ESpecialKey key, boo::EModifierKey)
{
m_data.m_specialKeys[key] = false;
m_data.m_specialKeys[int(key)] = false;
}
void modKeyDown(boo::EModifierKey mod, bool)
{
m_data.m_modMask = boo::EModifierKey(m_data.m_modMask | mod);
m_data.m_modMask = m_data.m_modMask | mod;
}
void modKeyUp(boo::EModifierKey mod)
{
m_data.m_modMask = boo::EModifierKey(m_data.m_modMask & ~mod);
m_data.m_modMask = m_data.m_modMask & ~mod;
}
void reset()
@@ -112,13 +112,13 @@ public:
void controllerConnected(unsigned idx, boo::EDolphinControllerType)
{
/* Controller thread */
m_statusChanges[idx].store(StatusConnected);
m_statusChanges[idx].store(EStatusChange::Connected);
}
void controllerDisconnected(unsigned idx, boo::EDolphinControllerType)
{
/* Controller thread */
std::unique_lock<std::mutex> lk(m_stateLock);
m_statusChanges[idx].store(StatusDisconnected);
m_statusChanges[idx].store(EStatusChange::Disconnected);
m_states[idx].reset();
}
void controllerUpdate(unsigned idx, boo::EDolphinControllerType,
@@ -144,10 +144,10 @@ public:
EStatusChange getStatusChange(unsigned idx, bool& connected)
{
/* Game thread */
EStatusChange ch = m_statusChanges[idx].exchange(StatusNoChange);
if (ch == StatusConnected)
EStatusChange ch = m_statusChanges[idx].exchange(EStatusChange::NoChange);
if (ch == EStatusChange::Connected)
m_connected[idx] = true;
else if (ch == StatusDisconnected)
else if (ch == EStatusChange::Disconnected)
m_connected[idx] = false;
connected = m_connected[idx];
return ch;

View File

@@ -11,7 +11,7 @@ struct CKeyboardMouseControllerData
bool m_charKeys[256] = {};
bool m_specialKeys[26] = {};
bool m_mouseButtons[6] = {};
boo::EModifierKey m_modMask = boo::MKEY_NONE;
boo::EModifierKey m_modMask = boo::EModifierKey::None;
boo::SWindowCoord m_mouseCoord;
boo::SScrollDelta m_accumScroll;
};

View File

@@ -193,7 +193,7 @@ static bool skCommandFilterFlag[kCommandFilterCount];
void ControlMapper::SetCommandFiltered(ECommands cmd, bool filtered)
{
skCommandFilterFlag[cmd] = filtered;
skCommandFilterFlag[int(cmd)] = filtered;
}
void ControlMapper::ResetCommandFilters()
@@ -204,12 +204,12 @@ void ControlMapper::ResetCommandFilters()
bool ControlMapper::GetPressInput(ECommands cmd, const CFinalInput& input)
{
if (!skCommandFilterFlag[cmd])
if (!skCommandFilterFlag[int(cmd)])
return false;
EFunctionList func = EFunctionList(g_tweakPlayerControl->GetMapping(cmd));
if (func > FuncMAX)
EFunctionList func = EFunctionList(g_tweakPlayerControl->GetMapping(atUint32(cmd)));
if (func > EFunctionList::MAX)
return false;
BoolReturnFn fn = skPressFuncs[func];
BoolReturnFn fn = skPressFuncs[int(func)];
if (!fn)
return false;
return (input.*fn)();
@@ -217,12 +217,12 @@ bool ControlMapper::GetPressInput(ECommands cmd, const CFinalInput& input)
bool ControlMapper::GetDigitalInput(ECommands cmd, const CFinalInput& input)
{
if (!skCommandFilterFlag[cmd])
if (!skCommandFilterFlag[int(cmd)])
return false;
EFunctionList func = EFunctionList(g_tweakPlayerControl->GetMapping(cmd));
if (func > FuncMAX)
EFunctionList func = EFunctionList(g_tweakPlayerControl->GetMapping(atUint32(cmd)));
if (func > EFunctionList::MAX)
return false;
BoolReturnFn fn = skDigitalFuncs[func];
BoolReturnFn fn = skDigitalFuncs[int(func)];
if (!fn)
return false;
return (input.*fn)();
@@ -230,12 +230,12 @@ bool ControlMapper::GetDigitalInput(ECommands cmd, const CFinalInput& input)
float ControlMapper::GetAnalogInput(ECommands cmd, const CFinalInput& input)
{
if (!skCommandFilterFlag[cmd])
if (!skCommandFilterFlag[int(cmd)])
return 0.0;
EFunctionList func = EFunctionList(g_tweakPlayerControl->GetMapping(cmd));
if (func > FuncMAX)
EFunctionList func = EFunctionList(g_tweakPlayerControl->GetMapping(atUint32(cmd)));
if (func > EFunctionList::MAX)
return 0.0;
FloatReturnFn fn = skAnalogFuncs[func];
FloatReturnFn fn = skAnalogFuncs[int(func)];
if (!fn)
return 0.0;
return (input.*fn)();
@@ -243,16 +243,16 @@ float ControlMapper::GetAnalogInput(ECommands cmd, const CFinalInput& input)
const char* ControlMapper::GetDescriptionForCommand(ECommands cmd)
{
if (cmd > CmdMAX)
if (cmd > ECommands::MAX)
return nullptr;
return skCommandDescs[cmd];
return skCommandDescs[int(cmd)];
}
const char* ControlMapper::GetDescriptionForFunction(EFunctionList func)
{
if (func > FuncMAX)
if (func > EFunctionList::MAX)
return nullptr;
return skFunctionDescs[func];
return skFunctionDescs[int(func)];
}
}

View File

@@ -8,97 +8,97 @@ class CFinalInput;
class ControlMapper
{
public:
enum ECommands
enum class ECommands
{
CmdForward,
CmdBackward,
CmdTurnLeft,
CmdTurnRight,
CmdStrafeLeft,
CmdStrafeRight,
CmdLookLeft,
CmdLookRight,
CmdLookUp,
CmdLookDown,
CmdJumpOrBoost,
CmdFireOrBomb,
CmdMissileOrPowerBomb,
CmdMorph,
CmdAimUp,
CmdAimDown,
CmdCycleBeamUp,
CmdCycleBeamDown,
CmdCycleItem,
CmdPowerBeam,
CmdIceBeam,
CmdWaveBeam,
CmdPlasmaBeam,
CmdToggleHolster,
CmdOrbitClose,
CmdOrbitFar,
CmdOrbitObject,
CmdOrbitSelect,
CmdOrbitConfirm,
CmdOrbitLeft,
CmdOrbitRight,
CmdOrbitUp,
CmdOrbitDown,
CmdLookHold1,
CmdLookHold2,
CmdLookZoomIn,
CmdLookZoomOut,
CmdAimHold,
CmdMapCircleUp,
CmdMapCircleDown,
CmdMapCircleLeft,
CmdMapCircleRight,
CmdMapMoveForward,
CmdMapMoveBack,
CmdMapMoveLeft,
CmdMapMoveRight,
CmdMapZoomIn,
CmdMapZoomOut,
CmdChaseCamera,
CmdXrayVisor,
CmdThermoVisor,
CmdInviroVisor,
CmdNoVisor,
CmdVisorMenu,
CmdVisorUp,
CmdVisorDown,
CmdUseSheild=0x3B,
CmdScanItem=0x3C,
CmdUNKNOWN,
CmdNone,
CmdMAX
Forward,
Backward,
TurnLeft,
TurnRight,
StrafeLeft,
StrafeRight,
LookLeft,
LookRight,
LookUp,
LookDown,
JumpOrBoost,
FireOrBomb,
MissileOrPowerBomb,
Morph,
AimUp,
AimDown,
CycleBeamUp,
CycleBeamDown,
CycleItem,
PowerBeam,
IceBeam,
WaveBeam,
PlasmaBeam,
ToggleHolster,
OrbitClose,
OrbitFar,
OrbitObject,
OrbitSelect,
OrbitConfirm,
OrbitLeft,
OrbitRight,
OrbitUp,
OrbitDown,
LookHold1,
LookHold2,
LookZoomIn,
LookZoomOut,
AimHold,
MapCircleUp,
MapCircleDown,
MapCircleLeft,
MapCircleRight,
MapMoveForward,
MapMoveBack,
MapMoveLeft,
MapMoveRight,
MapZoomIn,
MapZoomOut,
ChaseCamera,
XrayVisor,
ThermoVisor,
InviroVisor,
NoVisor,
VisorMenu,
VisorUp,
VisorDown,
UseSheild=0x3B,
ScanItem=0x3C,
UNKNOWN,
None,
MAX
};
enum EFunctionList
enum class EFunctionList
{
FuncNone,
FuncLeftStickUp,
FuncLeftStickDown,
FuncLeftStickLeft,
FuncLeftStickRight,
FuncRightStickUp,
FuncRightStickDown,
FuncRightStickLeft,
FuncRightStickRight,
FuncLeftTrigger,
FuncRightTrigger,
FuncDPadUp,
FuncDPadDown,
FuncDPadLeft,
FuncDPadRight,
FuncAButton,
FuncBButton,
FuncXButton,
FuncYButton,
FuncZButton,
FuncLeftTriggerPress,
FuncRightTriggerPress,
FuncStart,
FuncMAX // default case
None,
LeftStickUp,
LeftStickDown,
LeftStickLeft,
LeftStickRight,
RightStickUp,
RightStickDown,
RightStickLeft,
RightStickRight,
LeftTrigger,
RightTrigger,
DPadUp,
DPadDown,
DPadLeft,
DPadRight,
AButton,
BButton,
XButton,
YButton,
ZButton,
LeftTriggerPress,
RightTriggerPress,
Start,
MAX // default case
};
static void SetCommandFiltered(ECommands cmd, bool filtered);

View File

@@ -9,11 +9,11 @@ namespace Retro
class IController
{
public:
enum EMotorState
enum class EMotorState
{
MotorStop = 0,
MotorRumble = 1,
MotorStopHard = 2
Stop = 0,
Rumble = 1,
StopHard = 2
};
virtual void Poll()=0;
virtual void SetMotorState(EMotorState state)=0;

View File

@@ -57,7 +57,7 @@ void CFrontEndUI::UpdateMovies(float dt)
void CFrontEndUI::Update(float dt, CArchitectureQueue& queue)
{}
CIOWin::EMessageReturn CFrontEndUI::OnMessage(const CArchitectureMessage& msg, CArchitectureQueue& queue)
{return MsgRetNormal;}
{return EMessageReturn::Normal;}
void CFrontEndUI::StartGame()
{}
void CFrontEndUI::InitializeFrame()

View File

@@ -16,10 +16,10 @@ namespace MP1
class CFrontEndUI : public CIOWin
{
public:
enum EMenuMovie
enum class EMenuMovie
{
};
enum EScreen
enum class EScreen
{
};

View File

@@ -12,14 +12,14 @@ CIOWin::EMessageReturn CMFGameLoader::OnMessage(const CArchitectureMessage& msg,
{
switch (msg.GetType())
{
case MsgTimerTick:
case EArchMsgType::TimerTick:
{
const CArchMsgParmReal32& tick = MakeMsg::GetParmTimerTick(msg);
g_GameState->WorldTransitionManager();
}
default: break;
}
return MsgRetExit;
return EMessageReturn::Exit;
}
void CMFGameLoader::Draw() const

View File

@@ -14,12 +14,12 @@ class CStopwatch;
namespace MP1
{
enum EGameplayResult
enum class EGameplayResult
{
GameplayResultNone,
GameplayResultWin,
GameplayResultLose,
GameplayResultPlaying
None,
Win,
Lose,
Playing
};
class WindowCallback : public boo::IWindowCallback

View File

@@ -16,15 +16,15 @@ void CMainFlow::AdvanceGameState(CArchitectureQueue& queue)
{
switch (x14_gameState)
{
case ClientFlowFrontEnd:
CMainFlow::SetGameState(ClientFlowGameLoad, queue);
case EClientFlowStates::FrontEnd:
CMainFlow::SetGameState(EClientFlowStates::GameLoad, queue);
break;
case ClientFlowUnspecified:
case ClientFlowGameLoad:
CMainFlow::SetGameState(ClientFlowMoviePlay, queue);
case EClientFlowStates::Unspecified:
case EClientFlowStates::GameLoad:
CMainFlow::SetGameState(EClientFlowStates::MoviePlay, queue);
break;
case ClientFlowMoviePlay:
CMainFlow::SetGameState(ClientFlowFrontEnd, queue);
case EClientFlowStates::MoviePlay:
CMainFlow::SetGameState(EClientFlowStates::FrontEnd, queue);
break;
}
}
@@ -33,11 +33,11 @@ void CMainFlow::SetGameState(EClientFlowStates state, CArchitectureQueue& queue)
{
switch (state)
{
case ClientFlowFrontEnd:
case EClientFlowStates::FrontEnd:
{
if (g_main->GetGameplayResult() == GameplayResultNone)
if (g_main->GetGameplayResult() == EGameplayResult::None)
{
g_main->SetGameplayResult(GameplayResultPlaying);
g_main->SetGameplayResult(EGameplayResult::Playing);
break;
}
CResLoader& loader = g_ResFactory->GetLoader();
@@ -45,23 +45,23 @@ void CMainFlow::SetGameState(EClientFlowStates state, CArchitectureQueue& queue)
loader.AsyncIdlePakLoading();
g_main->LoadAudio();
g_main->RegisterResourceTweaks();
queue.Push(std::move(MakeMsg::CreateCreateIOWin(TargetIOWinManager, 12, 11, new CFrontEndUI(queue))));
queue.Push(std::move(MakeMsg::CreateCreateIOWin(EArchMsgTarget::IOWinManager, 12, 11, new CFrontEndUI(queue))));
break;
}
case ClientFlowGameLoad:
case EClientFlowStates::GameLoad:
{
queue.Push(std::move(MakeMsg::CreateCreateIOWin(TargetIOWinManager, 10, 1000, new CMFGameLoader())));
queue.Push(std::move(MakeMsg::CreateCreateIOWin(EArchMsgTarget::IOWinManager, 10, 1000, new CMFGameLoader())));
break;
}
case ClientFlowMoviePlay:
case EClientFlowStates::MoviePlay:
{
switch (g_main->GetGameplayResult())
{
case GameplayResultWin:
queue.Push(std::move(MakeMsg::CreateCreateIOWin(TargetIOWinManager, 12, 11, new CPlayMovie(CPlayMovie::MovieWinGame))));
case EGameplayResult::Win:
queue.Push(std::move(MakeMsg::CreateCreateIOWin(EArchMsgTarget::IOWinManager, 12, 11, new CPlayMovie(CPlayMovie::EWhichMovie::WinGame))));
break;
case GameplayResultLose:
queue.Push(std::move(MakeMsg::CreateCreateIOWin(TargetIOWinManager, 12, 11, new CPlayMovie(CPlayMovie::MovieLoseGame))));
case EGameplayResult::Lose:
queue.Push(std::move(MakeMsg::CreateCreateIOWin(EArchMsgTarget::IOWinManager, 12, 11, new CPlayMovie(CPlayMovie::EWhichMovie::LoseGame))));
break;
default: break;
}

View File

@@ -13,15 +13,15 @@ extern const char* kMovies[];
class CPlayMovie : public CPlayMovieBase
{
public:
enum EWhichMovie
enum class EWhichMovie
{
MovieWinGame,
MovieLoseGame
WinGame,
LoseGame
};
private:
EWhichMovie x14_which;
public:
CPlayMovie(EWhichMovie which) : CPlayMovieBase("CPlayMovie", kMovies[which]), x14_which(which) {}
CPlayMovie(EWhichMovie which) : CPlayMovieBase("CPlayMovie", kMovies[int(which)]), x14_which(which) {}
};
}

View File

@@ -128,7 +128,7 @@ CMain::CMain()
: x6c_memSys(CMemorySys::GetGameAllocator())
{
g_main = this;
xe4_gameplayResult = GameplayResultPlaying;
xe4_gameplayResult = EGameplayResult::Playing;
}
void CMain::RegisterResourceTweaks()
{
@@ -217,7 +217,7 @@ int main(int argc, const char* argv[])
LogVisor::RegisterConsoleLogger();
Retro::TOneStatic<Retro::MP1::CMain> main;
int ret = boo::ApplicationRun(boo::IApplication::PLAT_AUTO, *main,
int ret = boo::ApplicationRun(boo::IApplication::EPlatformType::Auto, *main,
_S("mp1"), _S("MP1"), argc, argv);
return ret;
}

View File

@@ -4,68 +4,68 @@
namespace Retro
{
enum EScriptObjectState
enum class EScriptObjectState
{
StActive,
StArrived,
StClosed,
StEntered,
StExited,
StInactive,
StInside,
StMaxReached,
StOpen,
StZero,
StAttack,
StUNKS1,
StRetreat,
StPatrol,
StDead,
StCameraPath,
StCameraTarget,
StUNKS2,
StPlay,
StUNKS3,
StDeathRattle,
StUNKS4,
StDamage,
StUNKS6,
StUNKS5,
StModify,
StUNKS7,
StUNKS8,
StScanDone,
StUNKS9,
StDFST,
StReflectedDamage,
StInheritBounds
Active,
Arrived,
Closed,
Entered,
Exited,
Inactive,
Inside,
MaxReached,
Open,
Zero,
Attack,
UNKS1,
Retreat,
Patrol,
Dead,
CameraPath,
CameraTarget,
UNKS2,
Play,
UNKS3,
DeathRattle,
UNKS4,
Damage,
UNKS6,
UNKS5,
Modify,
UNKS7,
UNKS8,
ScanDone,
UNKS9,
DFST,
ReflectedDamage,
InheritBounds
};
enum EScriptObjectMessage
enum class EScriptObjectMessage
{
MsgNone = -1,
MsgUNKM1 = 0,
MsgActivate,
MsgUNKM2,
MsgClose,
MsgDeactivate,
MsgDecrement,
MsgFollow,
MsgIncrement,
MsgNext,
MsgOpen,
MsgReset,
MsgResetAndStart,
MsgSetToMax,
MsgSetToZero,
MsgStart,
MsgStop,
MsgStopAndReset,
MsgToggleActive,
MsgUNKM3,
MsgAction,
MsgPlay,
MsgAlert
None = -1,
UNKM1 = 0,
Activate,
UNKM2,
Close,
Deactivate,
Decrement,
Follow,
Increment,
Next,
Open,
Reset,
ResetAndStart,
SetToMax,
SetToZero,
Start,
Stop,
StopAndReset,
ToggleActive,
UNKM3,
Action,
Play,
Alert
};
}