Added "saving in progress" indicator
parent
8d34286b1d
commit
69e6ae2c5e
|
@ -472,6 +472,7 @@ void InitializeEventTypeTexts()
|
|||
EVENT_TYPE_TEXT[EVENT_OBJECT_SHORTCUT_MODE] = "EVENT_OBJECT_SHORTCUT_MODE";
|
||||
EVENT_TYPE_TEXT[EVENT_OBJECT_MOVIELOCK] = "EVENT_OBJECT_MOVIELOCK";
|
||||
EVENT_TYPE_TEXT[EVENT_OBJECT_EDITLOCK] = "EVENT_OBJECT_EDITLOCK";
|
||||
EVENT_TYPE_TEXT[EVENT_OBJECT_SAVING] = "EVENT_OBJECT_SAVING";
|
||||
EVENT_TYPE_TEXT[EVENT_OBJECT_LIMIT] = "EVENT_OBJECT_LIMIT";
|
||||
|
||||
EVENT_TYPE_TEXT[EVENT_OBJECT_PEN0] = "EVENT_OBJECT_PEN0";
|
||||
|
|
|
@ -502,6 +502,7 @@ enum EventType
|
|||
EVENT_OBJECT_SHORTCUT_MAX = 1549,
|
||||
EVENT_OBJECT_MOVIELOCK = 1550,
|
||||
EVENT_OBJECT_EDITLOCK = 1551,
|
||||
EVENT_OBJECT_SAVING = 1552,
|
||||
EVENT_OBJECT_LIMIT = 1560,
|
||||
|
||||
EVENT_OBJECT_PEN0 = 1570,
|
||||
|
|
|
@ -469,8 +469,7 @@ void CPlayerProfile::SaveScene(std::string dir, std::string info)
|
|||
CResourceManager::CreateDirectory(dir);
|
||||
}
|
||||
|
||||
CRobotMain::GetInstancePointer()->IOWriteScene(dir + "/data.sav", dir + "/cbot.run", const_cast<char*>(info.c_str()));
|
||||
CRobotMain::GetInstancePointer()->MakeSaveScreenshot(dir + "/screen.png");
|
||||
CRobotMain::GetInstancePointer()->IOWriteScene(dir + "/data.sav", dir + "/cbot.run", dir + "/screen.png", const_cast<char*>(info.c_str()));
|
||||
}
|
||||
|
||||
void CPlayerProfile::LoadScene(std::string dir)
|
||||
|
|
|
@ -244,6 +244,9 @@ CRobotMain::CRobotMain()
|
|||
m_autosaveSlots = 3;
|
||||
m_autosaveLast = 0.0f;
|
||||
|
||||
m_shotDelay = 0;
|
||||
m_shotSaving = 0;
|
||||
|
||||
m_cameraPan = 0.0f;
|
||||
m_cameraZoom = 0.0f;
|
||||
|
||||
|
@ -484,8 +487,7 @@ void CRobotMain::ChangePhase(Phase phase)
|
|||
dim.y = 18.0f/480.0f;
|
||||
pos.x = 20.0f/640.0f;
|
||||
pos.y = 100.0f/480.0f;
|
||||
Ui::CEdit* pe = static_cast<Ui::CEdit*>(m_interface->CreateEdit(pos, dim, 0, EVENT_CMD));
|
||||
if (pe == nullptr) return;
|
||||
Ui::CEdit* pe = m_interface->CreateEdit(pos, dim, 0, EVENT_CMD);
|
||||
pe->ClearState(Ui::STATE_VISIBLE);
|
||||
pe->SetMaxChar(100);
|
||||
m_cmdEdit = false; // hidden for now
|
||||
|
@ -496,8 +498,8 @@ void CRobotMain::ChangePhase(Phase phase)
|
|||
pos.x = 4.0f/640.0f;
|
||||
pos.y = 426.0f/480.0f;
|
||||
|
||||
// Creates the save indicator
|
||||
Ui::CButton* pb = m_interface->CreateButton(pos, dim, 0, EVENT_SPEED);
|
||||
if (pb == nullptr) return;
|
||||
pb->SetState(Ui::STATE_SIMPLY);
|
||||
pb->ClearState(Ui::STATE_VISIBLE);
|
||||
|
||||
|
@ -2519,6 +2521,15 @@ bool CRobotMain::EventFrame(const Event &event)
|
|||
}
|
||||
}
|
||||
|
||||
if ( m_shotDelay > 0 && !m_ui->GetDialog()->IsDialog() )
|
||||
{
|
||||
m_shotDelay --;
|
||||
if ( m_shotDelay == 0 )
|
||||
{
|
||||
m_engine->WriteScreenShot(m_shotName);
|
||||
}
|
||||
}
|
||||
|
||||
m_water->EventProcess(event);
|
||||
m_cloud->EventProcess(event);
|
||||
m_lightning->EventProcess(event);
|
||||
|
@ -2645,6 +2656,35 @@ bool CRobotMain::EventFrame(const Event &event)
|
|||
}
|
||||
}
|
||||
|
||||
Ui::CControl* pc = m_interface->SearchControl(EVENT_OBJECT_SAVING);
|
||||
if (pc != nullptr)
|
||||
{
|
||||
Math::Point pos, dim;
|
||||
|
||||
if (m_shotSaving == 0)
|
||||
{
|
||||
dim.x = 10.0f/640.0f;
|
||||
dim.y = 10.0f/480.0f;
|
||||
pos.x = -20.0f/640.0f;
|
||||
pos.y = -20.0f/480.0f; // invisible!
|
||||
}
|
||||
else
|
||||
{
|
||||
dim.x = 32.0f/640.0f;
|
||||
dim.y = 32.0f/480.0f;
|
||||
pos.x = (640.0f-24.0f)/640.0f;
|
||||
pos.y = (480.0f-24.0f)/480.0f;
|
||||
|
||||
float zoom = 1.0f+sinf(m_time*6.0f)*0.1f; // 0.9 .. 1.1
|
||||
dim.x *= zoom;
|
||||
dim.y *= zoom;
|
||||
pos.x -= dim.x/2.0f;
|
||||
pos.y -= dim.y/2.0f;
|
||||
}
|
||||
pc->SetPos(pos);
|
||||
pc->SetDim(dim);
|
||||
}
|
||||
|
||||
// Will move the arrow to visit.
|
||||
if (m_camera->GetType() == Gfx::CAM_TYPE_VISIT)
|
||||
FrameVisit(event.rTime);
|
||||
|
@ -4920,7 +4960,7 @@ void CRobotMain::IOWriteObject(CLevelParserLine* line, CObject* obj)
|
|||
}
|
||||
|
||||
//! Saves the current game
|
||||
bool CRobotMain::IOWriteScene(std::string filename, std::string filecbot, char *info)
|
||||
bool CRobotMain::IOWriteScene(std::string filename, std::string filecbot, std::string filescreenshot, char *info)
|
||||
{
|
||||
CLevelParser levelParser(filename);
|
||||
CLevelParserLineUPtr line;
|
||||
|
@ -5043,6 +5083,10 @@ bool CRobotMain::IOWriteScene(std::string filename, std::string filecbot, char *
|
|||
CBotClass::SaveStaticState(file);
|
||||
fClose(file);
|
||||
|
||||
m_shotDelay = 3;
|
||||
m_shotName = CResourceManager::GetSaveLocation() + "/" + filescreenshot; //TODO: Use PHYSFS?
|
||||
m_shotSaving++;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -5050,6 +5094,7 @@ bool CRobotMain::IOWriteScene(std::string filename, std::string filecbot, char *
|
|||
void CRobotMain::IOWriteSceneFinished()
|
||||
{
|
||||
m_displayText->DisplayError(INFO_WRITEOK, Math::Vector(0.0f,0.0f,0.0f));
|
||||
m_shotSaving--;
|
||||
}
|
||||
|
||||
//! Resumes the game
|
||||
|
@ -5747,11 +5792,6 @@ void CRobotMain::UpdateChapterPassed()
|
|||
return m_ui->UpdateChapterPassed();
|
||||
}
|
||||
|
||||
void CRobotMain::MakeSaveScreenshot(const std::string& name)
|
||||
{
|
||||
return m_ui->MakeSaveScreenshot(name);
|
||||
}
|
||||
|
||||
|
||||
//! Changes on the pause mode
|
||||
void CRobotMain::ChangePause(PauseType pause)
|
||||
|
|
|
@ -253,7 +253,6 @@ public:
|
|||
std::string GetCustomLevelDir();
|
||||
void SetReadScene(std::string path);
|
||||
void UpdateChapterPassed();
|
||||
void MakeSaveScreenshot(const std::string& name);
|
||||
|
||||
void StartMusic();
|
||||
void StartPauseMusic(PauseType pause);
|
||||
|
@ -290,7 +289,7 @@ public:
|
|||
CPlayerProfile* GetPlayerProfile();
|
||||
|
||||
bool IsBusy();
|
||||
bool IOWriteScene(std::string filename, std::string filecbot, char *info);
|
||||
bool IOWriteScene(std::string filename, std::string filecbot, std::string filescreenshot, char *info);
|
||||
void IOWriteSceneFinished();
|
||||
CObject* IOReadScene(std::string filename, std::string filecbot);
|
||||
void IOWriteObject(CLevelParserLine *line, CObject* obj);
|
||||
|
@ -588,5 +587,9 @@ protected:
|
|||
int m_autosaveSlots;
|
||||
float m_autosaveLast;
|
||||
|
||||
unsigned int m_shotDelay;
|
||||
std::string m_shotName;
|
||||
unsigned int m_shotSaving;
|
||||
|
||||
std::deque<CObject*> m_selectionHistory;
|
||||
};
|
||||
|
|
|
@ -110,7 +110,7 @@ void CShortcut::Draw()
|
|||
zoom = 1.0f;
|
||||
mode = Gfx::ENG_RSTATE_NORMAL;
|
||||
}
|
||||
if ( m_icon == 6 || m_icon == 7 ) // pause or film?
|
||||
if ( m_icon == 128+6 || m_icon == 128+7 || m_icon == 58 ) // pause or film?
|
||||
{
|
||||
icon = -1; // no bottom
|
||||
zoom = 1.0f;
|
||||
|
@ -124,8 +124,35 @@ void CShortcut::Draw()
|
|||
DrawVertex(icon, 0.95f);
|
||||
}
|
||||
|
||||
m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_BLACK);
|
||||
DrawVertex(m_icon, zoom);
|
||||
icon = m_icon;
|
||||
if ( icon >= 192 )
|
||||
{
|
||||
icon -= 192;
|
||||
m_engine->SetTexture("textures/interface/text.png");
|
||||
}
|
||||
else if ( icon >= 128 )
|
||||
{
|
||||
icon -= 128;
|
||||
m_engine->SetTexture("textures/interface/button3.png");
|
||||
}
|
||||
else if ( icon >= 64 )
|
||||
{
|
||||
icon -= 64;
|
||||
m_engine->SetTexture("textures/interface/button2.png");
|
||||
}
|
||||
else
|
||||
{
|
||||
m_engine->SetTexture("textures/interface/button1.png");
|
||||
}
|
||||
if (m_icon == 58)
|
||||
{
|
||||
m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_WHITE);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_BLACK);
|
||||
}
|
||||
DrawVertex(icon, zoom);
|
||||
|
||||
if ( m_state & STATE_FRAME )
|
||||
{
|
||||
|
@ -239,4 +266,3 @@ void CShortcut::DrawVertex(int icon, float zoom)
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -67,6 +67,7 @@ bool CMainShort::CreateShortcuts()
|
|||
// Delete all old controls
|
||||
m_interface->DeleteControl(EVENT_OBJECT_MOVIELOCK);
|
||||
m_interface->DeleteControl(EVENT_OBJECT_EDITLOCK);
|
||||
m_interface->DeleteControl(EVENT_OBJECT_SAVING);
|
||||
m_interface->DeleteControl(EVENT_OBJECT_SHORTCUT_MODE);
|
||||
for (int i = EVENT_OBJECT_SHORTCUT; i <= EVENT_OBJECT_SHORTCUT_MAX; i++)
|
||||
{
|
||||
|
@ -84,17 +85,19 @@ bool CMainShort::CreateShortcuts()
|
|||
pos.x = 4.0f/640.0f;
|
||||
pos.y = (480.0f-32.0f)/480.0f;
|
||||
|
||||
m_interface->CreateShortcut(pos, dim, 58, EVENT_OBJECT_SAVING);
|
||||
|
||||
if ( m_main->GetMovieLock() &&
|
||||
!m_main->GetEditLock() ) // hangs during film?
|
||||
{
|
||||
m_interface->CreateShortcut(pos, dim, 7, EVENT_OBJECT_MOVIELOCK);
|
||||
m_interface->CreateShortcut(pos, dim, 128+7, EVENT_OBJECT_MOVIELOCK);
|
||||
return true;
|
||||
}
|
||||
if ( !m_main->GetFreePhoto() &&
|
||||
(m_main->GetEditLock() ||
|
||||
m_engine->GetPause()) ) // hangs during edition?
|
||||
{
|
||||
m_interface->CreateShortcut(pos, dim, 6, EVENT_OBJECT_EDITLOCK);
|
||||
m_interface->CreateShortcut(pos, dim, 128+6, EVENT_OBJECT_EDITLOCK);
|
||||
if(!m_engine->GetPause() || CPauseManager::GetInstancePointer()->GetPauseType() == PAUSE_DIALOG)
|
||||
return true;
|
||||
}
|
||||
|
@ -105,7 +108,7 @@ bool CMainShort::CreateShortcuts()
|
|||
|
||||
// Create new shortcuts
|
||||
|
||||
m_interface->CreateShortcut(pos, dim, 2, EVENT_OBJECT_SHORTCUT_MODE);
|
||||
m_interface->CreateShortcut(pos, dim, 128+2, EVENT_OBJECT_SHORTCUT_MODE);
|
||||
pos.x += dim.x*1.2f;
|
||||
|
||||
std::vector<int> teams;
|
||||
|
@ -216,7 +219,8 @@ int CMainShort::GetShortcutIcon(ObjectType type)
|
|||
if ( type == OBJECT_MOBILEdr ) icon = 48;
|
||||
if ( type == OBJECT_APOLLO2 ) icon = 49;
|
||||
}
|
||||
return icon;
|
||||
if ( icon == -1 ) return -1;
|
||||
return 128+icon;
|
||||
}
|
||||
|
||||
// Updates the interface shortcuts to the units.
|
||||
|
|
|
@ -91,8 +91,6 @@ CMainUserInterface::CMainUserInterface()
|
|||
|
||||
m_phase = PHASE_PLAYER_SELECT;
|
||||
|
||||
m_shotDelay = 0;
|
||||
|
||||
m_glintMouse = Math::Point(0.0f, 0.0f);
|
||||
m_glintTime = 1000.0f;
|
||||
|
||||
|
@ -248,15 +246,6 @@ bool CMainUserInterface::EventProcess(const Event &event)
|
|||
}
|
||||
}
|
||||
|
||||
if ( m_shotDelay > 0 && !m_dialog->IsDialog() )
|
||||
{
|
||||
m_shotDelay --;
|
||||
if ( m_shotDelay == 0 )
|
||||
{
|
||||
m_engine->WriteScreenShot(m_shotName);
|
||||
}
|
||||
}
|
||||
|
||||
m_glintTime += event.rTime;
|
||||
GlintMove(); // moves reflections
|
||||
|
||||
|
@ -784,12 +773,6 @@ void CMainUserInterface::AllMissionUpdate()
|
|||
}
|
||||
}
|
||||
|
||||
void CMainUserInterface::MakeSaveScreenshot(const std::string& name)
|
||||
{
|
||||
m_shotDelay = 3;
|
||||
m_shotName = CResourceManager::GetSaveLocation() + "/" + name; //TODO: Use PHYSFS?
|
||||
}
|
||||
|
||||
// Updates the button "solution" according to cheat code.
|
||||
|
||||
void CMainUserInterface::ShowSoluceUpdate()
|
||||
|
|
|
@ -82,8 +82,6 @@ public:
|
|||
std::string GetCustomLevelName(int id);
|
||||
const std::vector<std::string>& GetCustomLevelList();
|
||||
|
||||
void MakeSaveScreenshot(const std::string& name);
|
||||
|
||||
protected:
|
||||
void GlintMove();
|
||||
void FrameParticle(float rTime);
|
||||
|
|
Loading…
Reference in New Issue