Minor fixes to CFrontEndUI, add elapsed seconds to save selection

This commit is contained in:
Phillip Stephens 2019-02-03 13:20:05 -08:00
parent 0bb51f067c
commit 157946810a
3 changed files with 57 additions and 10 deletions

View File

@ -417,12 +417,12 @@ void CStateManager::SetupParticleHook(const CActor& actor) const {
void CStateManager::MurderScriptInstanceNames() { xb40_uniqueInstanceNames.clear(); }
std::string CStateManager::HashInstanceName(CInputStream& in) {
#ifdef NDEBUG
while (in.readByte() != 0) {};
return "";
#else
return in.readString();
#endif
if (hecl::com_developer && hecl::com_developer->toBoolean()) {
return in.readString();
} else {
while (in.readByte() != 0) {};
return "";
}
}
void CStateManager::SetActorAreaId(CActor& actor, TAreaId aid) {

View File

@ -26,6 +26,8 @@
namespace urde::MP1 {
#define FE_USE_SECONDS_IN_ELAPSED 1
/* Music volume constants */
static const float FE1_VOL = 0.7421875f;
static const float FE2_VOL = 0.7421875f;
@ -455,7 +457,7 @@ void CFrontEndUI::SNewFileSelectFrame::SetupFrameContents() {
case 0:
// Completion percent
if (data) {
std::u16string fileStr = g_MainStringTable->GetString(data->x20_hardMode ? 106 : 39);
std::u16string fileStr = g_MainStringTable->GetString((data->x20_hardMode ? 106 : 39) + i);
str = fileStr + hecl::Char16Format(L" %02d%%", data->x18_itemPercent);
break;
}
@ -473,7 +475,21 @@ void CFrontEndUI::SNewFileSelectFrame::SetupFrameContents() {
}
str = g_MainStringTable->GetString(51);
break;
#if FE_USE_SECONDS_IN_ELAPSED
case 2:
// Formatted time
if (data) {
auto pt = std::div(data->x0_playTime, 3600);
str = hecl::Char16Format(L"%02d:%02d:%02d", pt.quot, pt.rem / 60, pt.rem % 60);
break;
}
str = g_MainStringTable->GetString(52);
break;
case 3:
// "Elapsed"
str = std::u16string(u" ") + std::u16string(g_MainStringTable->GetString(data ? 54 : 53));
break;
#else
case 2:
// Formatted time
if (data) {
@ -488,6 +504,7 @@ void CFrontEndUI::SNewFileSelectFrame::SetupFrameContents() {
// "Elapsed"
str = g_MainStringTable->GetString(data ? 54 : 53);
break;
#endif
default:
break;

View File

@ -464,7 +464,33 @@ void CScriptSpecialFunction::ThinkPlayerFollowLocator(float, CStateManager&) {}
void CScriptSpecialFunction::ThinkSpinnerController(float, CStateManager&,
CScriptSpecialFunction::ESpinnerControllerMode) {}
void CScriptSpecialFunction::ThinkObjectFollowLocator(float, CStateManager&) {}
void CScriptSpecialFunction::ThinkObjectFollowLocator(float, CStateManager& mgr) {
TUniqueId followerAct = kInvalidUniqueId;
TUniqueId followedAct = kInvalidUniqueId;
for (const SConnection& conn : x20_conns) {
if (conn.x0_state != EScriptObjectState::Play)
continue;
auto search = mgr.GetIdListForScript(conn.x8_objId);
for (auto it = search.first; it != search.second; ++it) {
if (TCastToConstPtr<CActor> act = mgr.GetObjectById(it->second)) {
if (conn.x4_msg == EScriptObjectMessage::Activate &&
(act->HasModelData() && act->GetModelData()->HasAnimData()) && act->GetActive()) {
followedAct = it->second;
} else if (conn.x4_msg == EScriptObjectMessage::Deactivate) {
followerAct = it->second;
}
}
}
}
if (followerAct == kInvalidUniqueId || followedAct == kInvalidUniqueId)
return;
TCastToConstPtr<CActor> fromAct = mgr.GetObjectById(followedAct);
TCastToPtr<CActor> toAct = mgr.ObjectById(followerAct);
toAct->SetTransform(fromAct->GetTransform() * fromAct->GetScaledLocatorTransform(xec_locatorName));
}
void CScriptSpecialFunction::ThinkObjectFollowObject(float, CStateManager&) {}
@ -509,7 +535,11 @@ void CScriptSpecialFunction::ThinkRainSimulator(float, CStateManager& mgr) {
SendScriptMsgs(EScriptObjectState::Zero, mgr, EScriptObjectMessage::None);
}
void CScriptSpecialFunction::ThinkAreaDamage(float, CStateManager&) {}
void CScriptSpecialFunction::ThinkAreaDamage(float, CStateManager& mgr) {
const auto& playerState = mgr.GetPlayerState();
const CPlayer& player = mgr.GetPlayer();
}
void CScriptSpecialFunction::ThinkPlayerInArea(float dt, CStateManager& mgr) {
if (mgr.GetPlayer().GetAreaIdAlways() == GetAreaIdAlways()) {