Use existing ScriptObject{State,Message}ToStr

This commit is contained in:
Luke Street 2021-05-26 12:34:45 -04:00
parent ee205f53c8
commit 75c9980239
2 changed files with 12 additions and 186 deletions

View File

@ -176,184 +176,6 @@
}
namespace metaforce {
static std::string_view FromScriptObjectState(EScriptObjectState state) {
switch (state) {
case EScriptObjectState::Any:
return "Any"sv;
case EScriptObjectState::Active:
return "Active"sv;
case EScriptObjectState::Arrived:
return "Arrived"sv;
case EScriptObjectState::Closed:
return "Closed"sv;
case EScriptObjectState::Entered:
return "Entered"sv;
case EScriptObjectState::Exited:
return "Exited"sv;
case EScriptObjectState::Inactive:
return "Inactive"sv;
case EScriptObjectState::Inside:
return "Inside"sv;
case EScriptObjectState::MaxReached:
return "MaxReached"sv;
case EScriptObjectState::Open:
return "Open"sv;
case EScriptObjectState::Zero:
return "Zero"sv;
case EScriptObjectState::Attack:
return "Attack"sv;
case EScriptObjectState::CloseIn:
return "CloseIn"sv;
case EScriptObjectState::Retreat:
return "Retreat"sv;
case EScriptObjectState::Patrol:
return "Patrol"sv;
case EScriptObjectState::Dead:
return "Dead"sv;
case EScriptObjectState::CameraPath:
return "CameraPath"sv;
case EScriptObjectState::CameraTarget:
return "CameraTarget"sv;
case EScriptObjectState::DeactivateState:
return "DeactivateState"sv;
case EScriptObjectState::Play:
return "Play"sv;
case EScriptObjectState::MassiveDeath:
return "MassiveDeath"sv;
case EScriptObjectState::DeathRattle:
return "DeathRattle"sv;
case EScriptObjectState::AboutToMassivelyDie:
return "AboutToMassivelyDie"sv;
case EScriptObjectState::Damage:
return "Damage"sv;
case EScriptObjectState::InvulnDamage:
return "InvulnDamage"sv;
case EScriptObjectState::MassiveFrozenDeath:
return "MassiveFrozenDeath"sv;
case EScriptObjectState::Modify:
return "Modify"sv;
case EScriptObjectState::ScanStart:
return "ScanStart"sv;
case EScriptObjectState::ScanProcessing:
return "ScanProcessing"sv;
case EScriptObjectState::ScanDone:
return "ScanDone"sv;
case EScriptObjectState::UnFrozen:
return "Unfrozen"sv;
case EScriptObjectState::Default:
return "Default"sv;
case EScriptObjectState::ReflectedDamage:
return "ReflectedDamage"sv;
case EScriptObjectState::InheritBounds:
return "InheritBounds"sv;
}
}
static std::string_view FromScriptObjectMessage(EScriptObjectMessage msg) {
switch (msg) {
case EScriptObjectMessage::None:
return "None"sv;
case EScriptObjectMessage::UNKM0:
return "UNKM0"sv;
case EScriptObjectMessage::Activate:
return "Activate"sv;
case EScriptObjectMessage::Arrived:
return "Arrived"sv;
case EScriptObjectMessage::Close:
return "Close"sv;
case EScriptObjectMessage::Deactivate:
return "Deactivate"sv;
case EScriptObjectMessage::Decrement:
return "Decrement"sv;
case EScriptObjectMessage::Follow:
return "Follow"sv;
case EScriptObjectMessage::Increment:
return "Increment"sv;
case EScriptObjectMessage::Next:
return "Next"sv;
case EScriptObjectMessage::Open:
return "Open"sv;
case EScriptObjectMessage::Reset:
return "Reset"sv;
case EScriptObjectMessage::ResetAndStart:
return "ResetAndStart"sv;
case EScriptObjectMessage::SetToMax:
return "SetToMax"sv;
case EScriptObjectMessage::SetToZero:
return "SetToZero"sv;
case EScriptObjectMessage::Start:
return "Start"sv;
case EScriptObjectMessage::Stop:
return "Stop"sv;
case EScriptObjectMessage::StopAndReset:
return "StopAndReset"sv;
case EScriptObjectMessage::ToggleActive:
return "ToggleActive"sv;
case EScriptObjectMessage::UNKM18:
return "UNKM18"sv;
case EScriptObjectMessage::Action:
return "Action"sv;
case EScriptObjectMessage::Play:
return "Play"sv;
case EScriptObjectMessage::Alert:
return "Alert"sv;
case EScriptObjectMessage::InternalMessage00:
return "InernalMessage00"sv;
case EScriptObjectMessage::OnFloor:
return "OnFloor"sv;
case EScriptObjectMessage::InternalMessage02:
return "InternalMessage02"sv;
case EScriptObjectMessage::InternalMessage03:
return "InternalMessage03"sv;
case EScriptObjectMessage::Falling:
return "Falling"sv;
case EScriptObjectMessage::OnIceSurface:
return "OnIceSurface"sv;
case EScriptObjectMessage::OnMudSlowSurface:
return "OnMudSlowSurface"sv;
case EScriptObjectMessage::OnNormalSurface:
return "OnNormalSurface"sv;
case EScriptObjectMessage::Touched:
return "Touched"sv;
case EScriptObjectMessage::AddPlatformRider:
return "AddPlatformRider"sv;
case EScriptObjectMessage::LandOnNotFloor:
return "LandOnNotFloor"sv;
case EScriptObjectMessage::Registered:
return "Registered"sv;
case EScriptObjectMessage::Deleted:
return "Deleted"sv;
case EScriptObjectMessage::InitializedInArea:
return "InitializedInArea"sv;
case EScriptObjectMessage::WorldInitialized:
return "WorldInitialized"sv;
case EScriptObjectMessage::AddSplashInhabitant:
return "AddSplashInhabitant"sv;
case EScriptObjectMessage::UpdateSplashInhabitant:
return "UpdateSplashInhabitant"sv;
case EScriptObjectMessage::RemoveSplashInhabitant:
return "RemoveSplashInhabitant"sv;
case EScriptObjectMessage::Jumped:
return "Jumped"sv;
case EScriptObjectMessage::Damage:
return "Damage"sv;
case EScriptObjectMessage::InvulnDamage:
return "InvulnDamage"sv;
case EScriptObjectMessage::ProjectileCollide:
return "ProjectileCollide"sv;
case EScriptObjectMessage::InSnakeWeed:
return "InSnakeWeed"sv;
case EScriptObjectMessage::AddPhazonPoolInhabitant:
return "AddPhazonPoolInhabitant"sv;
case EScriptObjectMessage::UpdatePhazonPoolInhabitant:
return "UpdatePhazonPoolInhabitant"sv;
case EScriptObjectMessage::RemovePhazonPoolInhabitant:
return "RemovePhazonPoolInhabitant"sv;
case EScriptObjectMessage::SuspendedMove:
return "SuspendedMove"sv;
}
}
std::string_view CEntity::ImGuiType() { return "Entity"; }
void CEntity::ImGuiInspect() {
@ -392,10 +214,10 @@ void CEntity::ImGuiInspect() {
ImGuiStringViewText(ent->GetName());
}
if (ImGui::TableNextColumn()) {
ImGuiStringViewText(FromScriptObjectState(item.x0_state));
ImGuiStringViewText(ScriptObjectStateToStr(item.x0_state));
}
if (ImGui::TableNextColumn()) {
ImGuiStringViewText(FromScriptObjectMessage(item.x4_msg));
ImGuiStringViewText(ScriptObjectMessageToStr(item.x4_msg));
}
if (ImGui::TableNextColumn()) {
if (ImGui::SmallButton("View")) {

View File

@ -261,12 +261,14 @@ std::string_view ScriptObjectTypeToStr(EScriptObjectType type) {
case EScriptObjectType::EnergyBall:
return "EnergyBall"sv;
default:
return "..."sv;
return "[unknown]"sv;
}
}
std::string_view ScriptObjectStateToStr(EScriptObjectState state) {
switch (state) {
case EScriptObjectState::Any:
return "Any"sv;
case EScriptObjectState::Active:
return "Active"sv;
case EScriptObjectState::Arrived:
@ -306,17 +308,17 @@ std::string_view ScriptObjectStateToStr(EScriptObjectState state) {
case EScriptObjectState::Play:
return "Play"sv;
case EScriptObjectState::MassiveDeath:
return "DeathExplosion"sv;
return "MassiveDeath"sv;
case EScriptObjectState::DeathRattle:
return "DeathRattle"sv;
case EScriptObjectState::AboutToMassivelyDie:
return "AboutToDie"sv;
return "AboutToMassivelyDie"sv;
case EScriptObjectState::Damage:
return "Damage"sv;
case EScriptObjectState::InvulnDamage:
return "InvulnDamage"sv;
case EScriptObjectState::MassiveFrozenDeath:
return "IceDeathExplosion"sv;
return "MassiveFrozenDeath"sv;
case EScriptObjectState::Modify:
return "Modify"sv;
case EScriptObjectState::ScanStart:
@ -334,12 +336,14 @@ std::string_view ScriptObjectStateToStr(EScriptObjectState state) {
case EScriptObjectState::InheritBounds:
return "InheritBounds"sv;
default:
return "..."sv;
return "[unknown]"sv;
}
}
std::string_view ScriptObjectMessageToStr(EScriptObjectMessage message) {
switch (message) {
case EScriptObjectMessage::None:
return "None"sv;
case EScriptObjectMessage::UNKM0:
return "UNKM0"sv;
case EScriptObjectMessage::Activate:
@ -439,7 +443,7 @@ std::string_view ScriptObjectMessageToStr(EScriptObjectMessage message) {
case EScriptObjectMessage::SuspendedMove:
return "SuspendedMove"sv;
default:
return "..."sv;
return "[unknown]"sv;
}
}