Fixed code pause editor bug (#527)

master
krzys-h 2015-07-22 18:01:24 +02:00
parent 53a4176d29
commit 59d5545eca
5 changed files with 32 additions and 23 deletions

View File

@ -95,6 +95,7 @@ std::string CPauseManager::GetPauseName(PauseType pause)
case PAUSE_VISIT: return "Visit";
case PAUSE_CHEAT: return "Cheat console";
case PAUSE_PHOTO: return "Photo mode";
case PAUSE_CODE_BATTLE_LOCK: return "Code battle lock";
default: assert(false); // Should never happen
}
return "?";

View File

@ -38,7 +38,8 @@ enum PauseType {
PAUSE_EDITOR,
PAUSE_VISIT,
PAUSE_CHEAT,
PAUSE_PHOTO
PAUSE_PHOTO,
PAUSE_CODE_BATTLE_LOCK
};
class CPauseManager : public CSingleton<CPauseManager>
@ -46,19 +47,18 @@ class CPauseManager : public CSingleton<CPauseManager>
public:
CPauseManager();
~CPauseManager();
void SetPause(PauseType pause);
void ClearPause();
bool GetPause();
bool GetPause(PauseType pause);
PauseType GetPauseType();
private:
std::string GetPauseName(PauseType pause);
private:
CSoundInterface* m_sound;
PauseType m_pause;
};

View File

@ -831,7 +831,7 @@ bool CRobotMain::ProcessEvent(Event &event)
m_camera->GetType() != Gfx::CAM_TYPE_VISIT &&
!m_movie->IsExist())
{
ChangePause(m_pause->GetPause(PAUSE_USER) ? PAUSE_NONE : PAUSE_USER);
ChangePause(m_pause->GetPause(PAUSE_USER) || m_pause->GetPause(PAUSE_CODE_BATTLE_LOCK) ? PAUSE_NONE : PAUSE_USER);
}
}
if (event.key.slot == INPUT_SLOT_CAMERA)
@ -2764,7 +2764,8 @@ bool CRobotMain::EventFrame(const Event &event)
{
// NOTE: It's important to do this AFTER the first update event finished processing
// because otherwise all robot parts are misplaced
ChangePause(PAUSE_USER);
ChangePause(PAUSE_CODE_BATTLE_LOCK);
m_sound->MuteAll(false); // Allow sound
m_codeBattleInit = true; // Will start on resume
}
@ -6086,7 +6087,8 @@ void CRobotMain::SetExitAfterMission(bool exit)
bool CRobotMain::CanPlayerInteract()
{
if(GetMissionType() == MISSION_CODE_BATTLE) {
if(GetMissionType() == MISSION_CODE_BATTLE)
{
return !m_codeBattleStarted;
}
return true;

View File

@ -480,7 +480,10 @@ bool CScript::Step(const Event &event)
if ( m_bContinue ) // instuction "move", "goto", etc. ?
{
m_pause->ClearPause(); // removes the pause
if (m_pause->GetPauseType() == PAUSE_EDITOR)
{
m_pause->ClearPause(); // removes the pause
}
}
return false;
}
@ -1098,4 +1101,3 @@ char* CScript::GetFilename()
{
return m_filename;
}

View File

@ -957,26 +957,30 @@ void CStudio::UpdateFlux()
{
if ( m_bRunning )
{
#if 1
if ( m_bRealTime ) // run?
{
m_pause->ClearPause();
m_sound->MuteAll(false);
if(m_pause->GetPauseType() == PAUSE_EDITOR)
{
m_pause->ClearPause();
m_sound->MuteAll(false);
}
}
else // step by step?
{
if(!m_pause->GetPause())
{
m_pause->SetPause(PAUSE_EDITOR);
m_sound->MuteAll(true);
}
}
}
else // stop?
{
if(!m_pause->GetPause())
{
m_pause->SetPause(PAUSE_EDITOR);
m_sound->MuteAll(true);
}
#else
m_pause->ClearPause();
m_sound->MuteAll(false);
#endif
}
else // stop?
{
m_pause->SetPause(PAUSE_EDITOR);
m_sound->MuteAll(true);
}
}