From 8deb1305726966b3b583865dec1ba7ba1327d8cb Mon Sep 17 00:00:00 2001 From: Piotr Dziwinski Date: Tue, 3 Dec 2013 00:11:26 +0100 Subject: Changed char[] to std::string in restext Experimental changes --- src/ui/button.cpp | 7 +------ src/ui/check.cpp | 7 +------ src/ui/color.cpp | 7 +------ src/ui/control.cpp | 26 ++++++++++++++++++-------- src/ui/control.h | 2 ++ src/ui/displayinfo.cpp | 50 +++++++++++++++++++++++--------------------------- src/ui/displaytext.cpp | 8 +++----- src/ui/edit.cpp | 12 +++++++++--- src/ui/group.cpp | 7 +------ src/ui/image.cpp | 7 +------ src/ui/key.cpp | 28 ++++++++++++++++++---------- src/ui/maindialog.cpp | 39 ++++++++++++++++++++++----------------- src/ui/mainshort.cpp | 8 ++++---- src/ui/studio.cpp | 48 ++++++++++++++++++++++++------------------------ src/ui/window.cpp | 12 ++++++------ 15 files changed, 134 insertions(+), 134 deletions(-) (limited to 'src/ui') diff --git a/src/ui/button.cpp b/src/ui/button.cpp index 348382d..810d365 100644 --- a/src/ui/button.cpp +++ b/src/ui/button.cpp @@ -60,12 +60,7 @@ bool CButton::Create(Math::Point pos, Math::Point dim, int icon, EventType event if ( icon == -1 ) { - char name[100]; - char* p; - - GetResource(RES_EVENT, eventType, name); - p = strchr(name, '\\'); - if ( p != 0 ) *p = 0; + std::string name = GetResourceName(eventType); SetName(name); } diff --git a/src/ui/check.cpp b/src/ui/check.cpp index 362c930..6a92554 100644 --- a/src/ui/check.cpp +++ b/src/ui/check.cpp @@ -47,16 +47,11 @@ CCheck::~CCheck() bool CCheck::Create(Math::Point pos, Math::Point dim, int icon, EventType eventType) { - char name[100]; - char* p; - if ( eventType == EVENT_NULL ) eventType = GetUniqueEventType(); CControl::Create(pos, dim, icon, eventType); - GetResource(RES_EVENT, eventType, name); - p = strchr(name, '\\'); - if ( p != 0 ) *p = 0; + std::string name = GetResourceName(eventType); SetName(name); return true; diff --git a/src/ui/color.cpp b/src/ui/color.cpp index 623ff89..cbbc0dc 100644 --- a/src/ui/color.cpp +++ b/src/ui/color.cpp @@ -64,12 +64,7 @@ bool CColor::Create(Math::Point pos, Math::Point dim, int icon, EventType eventT if ( icon == -1 ) { - char name[100]; - char* p; - - GetResource(RES_EVENT, eventType, name); - p = strchr(name, '\\'); - if ( p != 0 ) *p = 0; + std::string name = GetResourceName(eventType); SetName(name); } diff --git a/src/ui/control.cpp b/src/ui/control.cpp index bed84dd..501350e 100644 --- a/src/ui/control.cpp +++ b/src/ui/control.cpp @@ -57,9 +57,6 @@ CControl::~CControl() bool CControl::Create(Math::Point pos, Math::Point dim, int icon, EventType eventType) { - char text[200]; - std::string str_text; - if ( eventType == EVENT_NULL ) eventType = GetUniqueEventType(); @@ -72,17 +69,17 @@ bool CControl::Create(Math::Point pos, Math::Point dim, int icon, EventType even pos.y = m_pos.y + m_dim.y; GlintCreate(pos); + std::string text; GetResource(RES_EVENT, m_eventType, text); - str_text = std::string(text); - auto p = str_text.find("\\"); - if ( p == std::string::npos ) + auto p = text.find("\\"); + if (p == std::string::npos) { if ( icon != -1 ) - m_tooltip = str_text; + m_tooltip = text; } else { - m_tooltip = str_text.substr(p + 1); + m_tooltip = text.substr(p + 1); } return true; @@ -837,5 +834,18 @@ bool CControl::Detect(Math::Point pos) pos.y <= m_pos.y + m_dim.y ); } +std::string CControl::GetResourceName(EventType eventType) +{ + std::string name; + GetResource(RES_EVENT, eventType, name); + auto index = name.find('\\'); + if (index != std::string::npos) + { + name = name.substr(0, index); + } + return name; +} + + } diff --git a/src/ui/control.h b/src/ui/control.h index aee7d1c..1ca07cf 100644 --- a/src/ui/control.h +++ b/src/ui/control.h @@ -112,6 +112,8 @@ protected: void DrawShadow(Math::Point pos, Math::Point dim, float deep=1.0f); virtual bool Detect(Math::Point pos); + std::string GetResourceName(EventType eventType); + protected: Gfx::CEngine* m_engine; Gfx::CParticle* m_particle; diff --git a/src/ui/displayinfo.cpp b/src/ui/displayinfo.cpp index 3aa3d73..bd20452 100644 --- a/src/ui/displayinfo.cpp +++ b/src/ui/displayinfo.cpp @@ -972,7 +972,6 @@ void ObjectAdd(ObjectList list[], ObjectType type) void ObjectWrite(FILE* file, ObjectList list[], int i) { char line[100]; - char res[100]; char* p; if ( list[i].total < 10 ) @@ -984,12 +983,14 @@ void ObjectWrite(FILE* file, ObjectList list[], int i) sprintf(line, "\\c;%dx \\n;\\l;", list[i].total); } + std::string res; GetResource(RES_OBJECT, list[i].type, res); - if ( res[0] == 0 ) return; - strcat(line, res); + if (res.empty()) return; + strcat(line, res.c_str()); strcat(line, "\\u "); - p = const_cast(GetHelpFilename(list[i].type).c_str()); + std::string helpFilename = GetHelpFilename(list[i].type); + p = const_cast(helpFilename.c_str()); if ( p[0] == 0 ) return; strcat(line, p+7); // skip "help\?\" p = strstr(line, ".txt"); @@ -1006,7 +1007,7 @@ void CDisplayInfo::CreateObjectsFile() CObject* pObj; ObjectType type; ObjectList list[200]; - char line[100]; + std::string line; int i; bool bRadar, bAtLeast; @@ -1038,7 +1039,7 @@ void CDisplayInfo::CreateObjectsFile() if ( bRadar ) { GetResource(RES_TEXT, RT_SATCOM_LIST, line); - fputs(line, file); + fputs(line.c_str(), file); bAtLeast = false; for ( i=0 ; i<200 ; i++ ) { @@ -1054,13 +1055,12 @@ void CDisplayInfo::CreateObjectsFile() if ( !bAtLeast ) { GetResource(RES_TEXT, RT_SATCOM_NULL, line); - fputs(line, file); + fputs(line.c_str(), file); } - strcpy(line, "\n"); - fputs(line, file); + fputs("\n", file); GetResource(RES_TEXT, RT_SATCOM_BOT, line); - fputs(line, file); + fputs(line.c_str(), file); bAtLeast = false; for ( i=0 ; i<200 ; i++ ) { @@ -1101,13 +1101,12 @@ void CDisplayInfo::CreateObjectsFile() if ( !bAtLeast ) { GetResource(RES_TEXT, RT_SATCOM_NULL, line); - fputs(line, file); + fputs(line.c_str(), file); } - strcpy(line, "\n"); - fputs(line, file); + fputs("\n", file); GetResource(RES_TEXT, RT_SATCOM_BUILDING, line); - fputs(line, file); + fputs(line.c_str(), file); bAtLeast = false; for ( i=0 ; i<200 ; i++ ) { @@ -1142,13 +1141,12 @@ void CDisplayInfo::CreateObjectsFile() if ( !bAtLeast ) { GetResource(RES_TEXT, RT_SATCOM_NULL, line); - fputs(line, file); + fputs(line.c_str(), file); } - strcpy(line, "\n"); - fputs(line, file); + fputs("\n", file); GetResource(RES_TEXT, RT_SATCOM_FRET, line); - fputs(line, file); + fputs(line.c_str(), file); bAtLeast = false; for ( i=0 ; i<200 ; i++ ) { @@ -1170,13 +1168,12 @@ void CDisplayInfo::CreateObjectsFile() if ( !bAtLeast ) { GetResource(RES_TEXT, RT_SATCOM_NULL, line); - fputs(line, file); + fputs(line.c_str(), file); } - strcpy(line, "\n"); - fputs(line, file); + fputs("\n", file); GetResource(RES_TEXT, RT_SATCOM_ALIEN, line); - fputs(line, file); + fputs(line.c_str(), file); bAtLeast = false; for ( i=0 ; i<200 ; i++ ) { @@ -1195,19 +1192,18 @@ void CDisplayInfo::CreateObjectsFile() if ( !bAtLeast ) { GetResource(RES_TEXT, RT_SATCOM_NULL, line); - fputs(line, file); + fputs(line.c_str(), file); } } else { GetResource(RES_TEXT, RT_SATCOM_ERROR1, line); - fputs(line, file); + fputs(line.c_str(), file); GetResource(RES_TEXT, RT_SATCOM_ERROR2, line); - fputs(line, file); + fputs(line.c_str(), file); } - strcpy(line, "\n"); - fputs(line, file); + fputs("\n", file); fclose(file); } diff --git a/src/ui/displaytext.cpp b/src/ui/displaytext.cpp index d88674a..5b3144d 100644 --- a/src/ui/displaytext.cpp +++ b/src/ui/displaytext.cpp @@ -127,9 +127,6 @@ void CDisplayText::DisplayError(Error err, CObject* pObj, float time) void CDisplayText::DisplayError(Error err, Math::Vector goal, float height, float dist, float time) { - TextType type; - char text[100]; - if ( err == ERR_OK ) return; #if 0 @@ -148,7 +145,7 @@ void CDisplayText::DisplayError(Error err, Math::Vector goal, float height, type = TT_WARNING; } #else - type = TT_WARNING; + TextType type = TT_WARNING; if ( err >= INFO_FIRST ) { type = TT_INFO; @@ -164,8 +161,9 @@ void CDisplayText::DisplayError(Error err, Math::Vector goal, float height, } #endif + std::string text; GetResource(RES_ERR, err, text); - DisplayText(text, goal, height, dist, time, type); + DisplayText(text.c_str(), goal, height, dist, time, type); } // Displays text. diff --git a/src/ui/edit.cpp b/src/ui/edit.cpp index a187688..271a8e7 100644 --- a/src/ui/edit.cpp +++ b/src/ui/edit.cpp @@ -1798,8 +1798,10 @@ bool CEdit::ReadText(std::string filename, int addSize) res = main->GetInputBinding(slot).primary; if ( res != 0 ) { - if ( GetResource(RES_KEY, res, iName) ) + std::string iNameStr; + if ( GetResource(RES_KEY, res, iNameStr) ) { + strcpy(iName, iNameStr.c_str()); m_text[j] = ' '; m_format[j] = font; j ++; @@ -1817,9 +1819,13 @@ bool CEdit::ReadText(std::string filename, int addSize) res = main->GetInputBinding(slot).secondary; if ( res != 0 ) { - if ( GetResource(RES_KEY, res, iName) ) + if ( GetResource(RES_KEY, res, iNameStr) ) { - GetResource(RES_TEXT, RT_KEY_OR, text); + strcpy(iName, iNameStr.c_str()); + + std::string textStr; + GetResource(RES_TEXT, RT_KEY_OR, textStr); + strcpy(text, textStr.c_str()); n = 0; while ( text[n] != 0 ) { diff --git a/src/ui/group.cpp b/src/ui/group.cpp index 908ac19..64495e0 100644 --- a/src/ui/group.cpp +++ b/src/ui/group.cpp @@ -52,12 +52,7 @@ bool CGroup::Create(Math::Point pos, Math::Point dim, int icon, EventType eventT if ( icon == -1 ) { - char name[100]; - char* p; - - GetResource(RES_EVENT, eventType, name); - p = strchr(name, '\\'); - if ( p != 0 ) *p = 0; + std::string name = GetResourceName(eventType); SetName(name); } diff --git a/src/ui/image.cpp b/src/ui/image.cpp index 9a14789..8f9b5ca 100644 --- a/src/ui/image.cpp +++ b/src/ui/image.cpp @@ -58,12 +58,7 @@ bool CImage::Create(Math::Point pos, Math::Point dim, int icon, EventType eventT if ( icon == -1 ) { - char name[100]; - char* p; - - GetResource(RES_EVENT, eventType, name); - p = strchr(name, '\\'); - if ( p != 0 ) *p = 0; + std::string name = GetResourceName(eventType); SetName(name); } diff --git a/src/ui/key.cpp b/src/ui/key.cpp index 1f8cff5..aacc8d8 100644 --- a/src/ui/key.cpp +++ b/src/ui/key.cpp @@ -19,16 +19,19 @@ #include "ui/key.h" #include "common/global.h" +#include "common/stringutils.h" #include namespace Ui { -void GetKeyName(char* name, unsigned int key) +static void GetKeyName(std::string& name, unsigned int key) { if (!GetResource(RES_KEY, key, name)) - sprintf(name, "Code %d", key); + { + name = StrUtils::Format("Code %d", key); + } } @@ -51,9 +54,9 @@ bool CKey::Create(Math::Point pos, Math::Point dim, int icon, EventType eventMsg CControl::Create(pos, dim, icon, eventMsg); - char name[100]; + std::string name; GetResource(RES_EVENT, eventMsg, name); - SetName(std::string(name)); + SetName(name); return true; } @@ -176,19 +179,24 @@ void CKey::Draw() float h = m_engine->GetText()->GetHeight(m_fontType, m_fontSize) / 2.0f; - char text[100]; - GetKeyName(text, m_binding.primary); + std::string keyName; + GetKeyName(keyName, m_binding.primary); if (m_binding.secondary != KEY_INVALID) { - GetResource(RES_TEXT, RT_KEY_OR, text+strlen(text)); - GetKeyName(text+strlen(text), m_binding.secondary); + std::string orText; + GetResource(RES_TEXT, RT_KEY_OR, orText); + keyName.append(orText); + + std::string secondaryKeyName; + GetKeyName(secondaryKeyName, m_binding.secondary); + keyName.append(secondaryKeyName); } Math::Point pos; pos.x = m_pos.x + m_dim.x * 0.5f; pos.y = m_pos.y + m_dim.y * 0.5f; pos.y -= h; - m_engine->GetText()->DrawText(std::string(text), m_fontType, m_fontSize, pos, m_dim.x, Gfx::TEXT_ALIGN_CENTER, 0); + m_engine->GetText()->DrawText(keyName, m_fontType, m_fontSize, pos, m_dim.x, Gfx::TEXT_ALIGN_CENTER, 0); m_dim = iDim; @@ -199,7 +207,7 @@ void CKey::Draw() pos.x = m_pos.x + (214.0f / 640.0f); pos.y = m_pos.y + m_dim.y * 0.5f; pos.y -= h; - m_engine->GetText()->DrawText(std::string(m_name), m_fontType, m_fontSize, pos, m_dim.x, Gfx::TEXT_ALIGN_LEFT, 0); + m_engine->GetText()->DrawText(m_name, m_fontType, m_fontSize, pos, m_dim.x, Gfx::TEXT_ALIGN_LEFT, 0); } void CKey::SetBinding(InputBinding b) diff --git a/src/ui/maindialog.cpp b/src/ui/maindialog.cpp index 407f8da..e07e40c 100644 --- a/src/ui/maindialog.cpp +++ b/src/ui/maindialog.cpp @@ -26,7 +26,7 @@ #include "common/misc.h" #include "common/profile.h" #include "common/restext.h" -#include "common/logger.h" +#include "common/stringutils.h" #include "object/robotmain.h" @@ -215,7 +215,7 @@ void CMainDialog::ChangePhase(Phase phase) CImage* pi; Math::Point pos, dim, ddim; float ox, oy, sx, sy; - char name[100]; + std::string name; char* gamer; int res, i, j; @@ -458,10 +458,10 @@ pb->SetState(STATE_SHADOW); } else { - strcpy(name, gamer); + name = gamer; } - pe->SetText(name); - pe->SetCursor(strlen(name), 0); + pe->SetText(name.c_str()); + pe->SetCursor(name.length(), 0); pe->SetFocus(true); pos.x = 380.0f/640.0f; @@ -4019,7 +4019,7 @@ void CMainDialog::UpdatePerso() CColor* pc; CSlider* ps; Gfx::Color color; - char name[100]; + std::string name; int i; pw = static_cast(m_interface->SearchControl(EVENT_WINDOW5)); @@ -4434,8 +4434,9 @@ void CMainDialog::IOReadList() // invalid index if ( m_phase == PHASE_WRITE || m_phase == PHASE_WRITEs ) { - GetResource(RES_TEXT, RT_IO_NEW, name); - pl->SetItemName(m_saveList.size(), name); + std::string nameStr; + GetResource(RES_TEXT, RT_IO_NEW, nameStr); + pl->SetItemName(m_saveList.size(), nameStr.c_str()); } pl->SetSelect(m_saveList.size()); @@ -6026,7 +6027,7 @@ void CMainDialog::StartAbort() CWindow* pw; CButton* pb; Math::Point pos, dim; - char name[100]; + std::string name; StartDialog(Math::Point(0.3f, 0.8f), true, false, false); m_bDialogDelete = false; @@ -6105,7 +6106,7 @@ void CMainDialog::StartDeleteObject() CWindow* pw; CButton* pb; Math::Point pos, dim; - char name[100]; + std::string name; StartDialog(Math::Point(0.7f, 0.3f), false, true, true); m_bDialogDelete = true; @@ -6139,21 +6140,22 @@ void CMainDialog::StartDeleteGame(char *gamer) CWindow* pw; CButton* pb; Math::Point pos, dim; - char name[100]; - char text[100]; StartDialog(Math::Point(0.7f, 0.3f), false, true, true); m_bDialogDelete = true; pw = static_cast(m_interface->SearchControl(EVENT_WINDOW9)); - if ( pw == 0 ) return; + if (pw == nullptr) + return; + + std::string name; pos.x = 0.00f; pos.y = 0.50f; dim.x = 1.00f; dim.y = 0.05f; GetResource(RES_TEXT, RT_DIALOG_DELGAME, name); - sprintf(text, name, gamer); + std::string text = StrUtils::Format(name.c_str(), gamer); pw->CreateLabel(pos, dim, -1, EVENT_DIALOG_LABEL, text); pb = static_cast(pw->SearchControl(EVENT_DIALOG_OK)); @@ -6175,12 +6177,14 @@ void CMainDialog::StartQuit() CWindow* pw; CButton* pb; Math::Point pos, dim; - char name[100]; StartDialog(Math::Point(0.6f, 0.3f), false, true, true); pw = static_cast(m_interface->SearchControl(EVENT_WINDOW9)); - if ( pw == 0 ) return; + if (pw == nullptr) + return; + + std::string name; pos.x = 0.00f; pos.y = 0.50f; @@ -6208,7 +6212,6 @@ void CMainDialog::StartDialog(Math::Point dim, bool bFire, bool bOK, bool bCance CWindow* pw; CButton* pb; Math::Point pos, ddim; - char name[100]; StartSuspend(); @@ -6247,6 +6250,8 @@ void CMainDialog::StartDialog(Math::Point dim, bool bFire, bool bOK, bool bCance m_bDialogFire = bFire; + std::string name; + pos.x = (1.0f-dim.x)/2.0f; pos.y = (1.0f-dim.y)/2.0f; pw = m_interface->CreateWindows(pos, dim, bFire?12:8, EVENT_WINDOW9); diff --git a/src/ui/mainshort.cpp b/src/ui/mainshort.cpp index d33482c..f6dce4b 100644 --- a/src/ui/mainshort.cpp +++ b/src/ui/mainshort.cpp @@ -97,7 +97,6 @@ bool CMainShort::CreateShortcuts() ObjectType type; Math::Point pos, dim; int i, rank, icon; - char name[100]; if ( m_main->GetFixScene() ) return false; @@ -208,10 +207,11 @@ bool CMainShort::CreateShortcuts() m_shortcuts[rank] = pObj; pc = m_interface->SearchControl(table_sc_em[rank]); - if ( pc != 0 ) + if ( pc != nullptr ) { - pObj->GetTooltipName(name); - pc->SetTooltip(name); + std::string tooltipName; + pObj->GetTooltipName(tooltipName); + pc->SetTooltip(tooltipName); } rank ++; diff --git a/src/ui/studio.cpp b/src/ui/studio.cpp index e44a465..ba28a0a 100644 --- a/src/ui/studio.cpp +++ b/src/ui/studio.cpp @@ -97,7 +97,6 @@ bool CStudio::EventProcess(const Event &event) CWindow* pw; CEdit* edit; CSlider* slider; - char res[100]; if ( m_dialog != SD_NULL ) // dialogue exists? { @@ -184,17 +183,17 @@ bool CStudio::EventProcess(const Event &event) if ( event.type == EVENT_STUDIO_COMPILE ) // compile? { - char buffer[100]; - if ( m_script->GetScript(edit) ) // compile { + std::string res; GetResource(RES_TEXT, RT_STUDIO_COMPOK, res); SetInfoText(res, false); } else { - m_script->GetError(buffer); - SetInfoText(buffer, false); + std::string error; + m_script->GetError(error); + SetInfoText(error, false); } } @@ -218,9 +217,9 @@ bool CStudio::EventProcess(const Event &event) } else { - char buffer[100]; - m_script->GetError(buffer); - SetInfoText(buffer, false); + std::string error; + m_script->GetError(error); + SetInfoText(error, false); } } } @@ -344,7 +343,6 @@ bool CStudio::EventFrame(const Event &event) CList* list; float time; int cursor1, cursor2, iCursor1, iCursor2; - char res[100]; m_time += event.rTime; m_fixInfoTextTime -= event.rTime; @@ -363,6 +361,7 @@ bool CStudio::EventFrame(const Event &event) m_bRunning = false; UpdateFlux(); // stop AdjustEditScript(); + std::string res; GetResource(RES_TEXT, RT_STUDIO_PROGSTOP, res); SetInfoText(res, false); @@ -558,7 +557,6 @@ void CStudio::StartEditScript(CScript *script, std::string name, int rank) CButton* button; CSlider* slider; CList* list; - char res[100]; m_script = script; m_rank = rank; @@ -575,28 +573,33 @@ void CStudio::StartEditScript(CScript *script, std::string name, int rank) m_script->SetStepMode(!m_bRealTime); button = static_cast< CButton* >(m_interface->SearchControl(EVENT_BUTTON_QUIT)); - if ( button != 0 ) - { + if (button != nullptr) button->ClearState(STATE_VISIBLE); - } pos = m_editFinalPos = m_editActualPos = m_main->GetWindowPos(); dim = m_editFinalDim = m_editActualDim = m_main->GetWindowDim(); pw = m_interface->CreateWindows(pos, dim, 8, EVENT_WINDOW3); - if ( pw == nullptr ) return; + if (pw == nullptr) + return; + pw->SetState(STATE_SHADOW); pw->SetRedim(true); // before SetName! pw->SetMovable(true); pw->SetClosable(true); + + std::string res; GetResource(RES_TEXT, RT_STUDIO_TITLE, res); pw->SetName(res); + pw->SetMinDim(Math::Point(0.49f, 0.50f)); pw->SetMaximized(m_bEditMaximized); pw->SetMinimized(m_bEditMinimized); m_main->SetEditFull(m_bEditMaximized); edit = pw->CreateEdit(pos, dim, 0, EVENT_STUDIO_EDIT); - if ( edit == 0 ) return; + if (edit == nullptr) + return; + edit->SetState(STATE_SHADOW); edit->SetInsideScroll(false); //? if ( m_bRunning ) edit->SetEdit(false); @@ -851,7 +854,6 @@ bool CStudio::StopEditScript(bool bCancel) CWindow* pw; CEdit* edit; CButton* button; - char buffer[100]; pw = static_cast< CWindow* >(m_interface->SearchControl(EVENT_WINDOW3)); if ( pw == nullptr ) return false; @@ -863,8 +865,9 @@ bool CStudio::StopEditScript(bool bCancel) { if ( !m_script->GetScript(edit) ) // compile { - m_script->GetError(buffer); - SetInfoText(buffer, false); + std::string error; + m_script->GetError(error); + SetInfoText(error, false); return false; } } @@ -892,8 +895,6 @@ bool CStudio::StopEditScript(bool bCancel) void CStudio::SetInfoText(std::string text, bool bClickable) { - char res[100]; - if ( bClickable && m_fixInfoTextTime > 0.0f ) return; if ( !bClickable ) m_fixInfoTextTime = 8.0f; @@ -911,6 +912,7 @@ void CStudio::SetInfoText(std::string text, bool bClickable) if ( bClickable ) { + std::string res; GetResource(RES_TEXT, RT_STUDIO_LISTTT, res); list->SetTooltip(res); list->SetState(STATE_ENABLE); @@ -1029,7 +1031,7 @@ void CStudio::StartDialog(StudioDialog type) CList* pli; CEdit* pe; Math::Point pos, dim; - char name[100]; + std::string name; m_dialog = type; @@ -1476,8 +1478,6 @@ void CStudio::UpdateDialogPublic() CWindow* pw; CCheck* pc; CLabel* pl; - char name[100]; - //char text[MAX_FNAME+100]; pw = static_cast< CWindow* >(m_interface->SearchControl(EVENT_WINDOW9)); if ( pw == nullptr ) return; @@ -1497,7 +1497,7 @@ void CStudio::UpdateDialogPublic() pl = static_cast< CLabel* >(pw->SearchControl(EVENT_DIALOG_LABEL1)); if ( pl != 0 ) { - GetResource(RES_TEXT, RT_IO_LIST, name); + //? GetResource(RES_TEXT, RT_IO_LIST, name); pl->SetName(SearchDirectory(false).c_str(), false); } } diff --git a/src/ui/window.cpp b/src/ui/window.cpp index 6e082e6..ed18ce4 100644 --- a/src/ui/window.cpp +++ b/src/ui/window.cpp @@ -788,7 +788,7 @@ bool CWindow::GetFixed() void CWindow::AdjustButtons() { - char res[100]; + std::string res; if ( m_buttonFull != 0 ) { @@ -796,13 +796,13 @@ void CWindow::AdjustButtons() { m_buttonFull->SetIcon(54); GetResource(RES_TEXT, RT_WINDOW_STANDARD, res); - m_buttonFull->SetTooltip(std::string(res)); + m_buttonFull->SetTooltip(res); } else { m_buttonFull->SetIcon(52); GetResource(RES_TEXT, RT_WINDOW_MAXIMIZED, res); - m_buttonFull->SetTooltip(std::string(res)); + m_buttonFull->SetTooltip(res); } } @@ -812,13 +812,13 @@ void CWindow::AdjustButtons() { m_buttonReduce->SetIcon(54); GetResource(RES_TEXT, RT_WINDOW_STANDARD, res); - m_buttonReduce->SetTooltip(std::string(res)); + m_buttonReduce->SetTooltip(res); } else { m_buttonReduce->SetIcon(51); GetResource(RES_TEXT, RT_WINDOW_MINIMIZED, res); - m_buttonReduce->SetTooltip(std::string(res)); + m_buttonReduce->SetTooltip(res); } } @@ -826,7 +826,7 @@ void CWindow::AdjustButtons() { m_buttonClose->SetIcon(11); // x GetResource(RES_TEXT, RT_WINDOW_CLOSE, res); - m_buttonClose->SetTooltip(std::string(res)); + m_buttonClose->SetTooltip(res); } } -- cgit v1.2.3-1-g7c22 From fe3f9ea38cfae89fdd83d4c3fe79ea355f50bce9 Mon Sep 17 00:00:00 2001 From: erihel Date: Thu, 19 Dec 2013 22:41:16 +0100 Subject: Sound support changes * removed 2d sound * fixed listener orientation (propably issue #235) * removed unused code and minor refactoring --- src/ui/maindialog.cpp | 26 -------------------------- 1 file changed, 26 deletions(-) (limited to 'src/ui') diff --git a/src/ui/maindialog.cpp b/src/ui/maindialog.cpp index 407f8da..720eb66 100644 --- a/src/ui/maindialog.cpp +++ b/src/ui/maindialog.cpp @@ -1522,13 +1522,6 @@ pos.y -= 0.048f; pl->SetTextAlign(Gfx::TEXT_ALIGN_LEFT); // #endif - ddim.x = dim.x*6; - ddim.y = dim.y*0.5f; - pos.x = ox+sx*10; - pos.y = 0.55f; - pc = pw->CreateCheck(pos, ddim, -1, EVENT_INTERFACE_SOUND3D); - pc->SetState(STATE_SHADOW); - ddim.x = dim.x*3; ddim.y = dim.y*1; pos.x = ox+sx*10; @@ -2913,12 +2906,6 @@ bool CMainDialog::EventProcess(const Event &event) ChangeSetupButtons(); break; - case EVENT_INTERFACE_SOUND3D: - m_sound->SetSound3D(!m_sound->GetSound3D()); - ChangeSetupButtons(); - UpdateSetupButtons(); - break; - case EVENT_INTERFACE_SILENT: m_sound->SetAudioVolume(0); m_sound->SetMusicVolume(0); @@ -5456,13 +5443,6 @@ void CMainDialog::UpdateSetupButtons() value = static_cast(m_sound->GetMusicVolume()); ps->SetVisibleValue(value); } - - pc = static_cast(pw->SearchControl(EVENT_INTERFACE_SOUND3D)); - if ( pc != 0 ) - { - pc->SetState(STATE_CHECK, m_sound->GetSound3D()); - pc->SetState(STATE_ENABLE, m_sound->GetSound3DCap()); - } } // Updates the engine function of the buttons after the setup phase. @@ -5564,7 +5544,6 @@ void CMainDialog::SetupMemorize() GetProfile().SetLocalProfileInt("Setup", "TotoMode", m_engine->GetTotoMode()); GetProfile().SetLocalProfileInt("Setup", "AudioVolume", m_sound->GetAudioVolume()); GetProfile().SetLocalProfileInt("Setup", "MusicVolume", m_sound->GetMusicVolume()); - GetProfile().SetLocalProfileInt("Setup", "Sound3D", m_sound->GetSound3D()); GetProfile().SetLocalProfileInt("Setup", "EditIndentMode", m_engine->GetEditIndentMode()); GetProfile().SetLocalProfileInt("Setup", "EditIndentValue", m_engine->GetEditIndentValue()); @@ -5802,11 +5781,6 @@ void CMainDialog::SetupRecall() m_sound->SetMusicVolume(iValue); } - if ( GetProfile().GetLocalProfileInt("Setup", "Sound3D", iValue) ) - { - m_sound->SetSound3D(iValue == 1); - } - if ( GetProfile().GetLocalProfileInt("Setup", "EditIndentMode", iValue) ) { m_engine->SetEditIndentMode(iValue); -- cgit v1.2.3-1-g7c22 From 95661918ce5da32cce84055e80fcc15343591638 Mon Sep 17 00:00:00 2001 From: Piotr Dziwinski Date: Fri, 20 Dec 2013 20:18:30 +0100 Subject: Some further refactoring and test corrections --- src/ui/displayinfo.cpp | 38 ++++++++++++++++++++++++-------------- src/ui/studio.cpp | 2 +- 2 files changed, 25 insertions(+), 15 deletions(-) (limited to 'src/ui') diff --git a/src/ui/displayinfo.cpp b/src/ui/displayinfo.cpp index bd20452..79eb38a 100644 --- a/src/ui/displayinfo.cpp +++ b/src/ui/displayinfo.cpp @@ -23,6 +23,7 @@ #include "common/iman.h" #include "common/misc.h" #include "common/restext.h" +#include "common/stringutils.h" #include "graphics/core/light.h" #include "graphics/engine/engine.h" @@ -971,32 +972,41 @@ void ObjectAdd(ObjectList list[], ObjectType type) void ObjectWrite(FILE* file, ObjectList list[], int i) { - char line[100]; - char* p; + std::string line; if ( list[i].total < 10 ) { - sprintf(line, "\\c; %dx \\n;\\l;", list[i].total); + line = StrUtils::Format("\\c; %dx \\n;\\l;", list[i].total); } else { - sprintf(line, "\\c;%dx \\n;\\l;", list[i].total); + line = StrUtils::Format("\\c;%dx \\n;\\l;", list[i].total); } std::string res; GetResource(RES_OBJECT, list[i].type, res); - if (res.empty()) return; - strcat(line, res.c_str()); + if (res.empty()) + return; + + line += res; + + line += "\\u "; - strcat(line, "\\u "); std::string helpFilename = GetHelpFilename(list[i].type); - p = const_cast(helpFilename.c_str()); - if ( p[0] == 0 ) return; - strcat(line, p+7); // skip "help\?\" - p = strstr(line, ".txt"); - if ( p != 0 ) *p = 0; - strcat(line, ";\n"); - fputs(line, file); + if (helpFilename.empty()) + return; + + line += helpFilename.substr(7); // skip "help\?\" + + auto pos = line.find(".txt"); + if (pos != std::string::npos) + { + line = line.substr(0, pos); + } + + line += ";\n"; + + fputs(line.c_str(), file); } // Creates the file containing the list of objects. diff --git a/src/ui/studio.cpp b/src/ui/studio.cpp index ba28a0a..fb4dd3d 100644 --- a/src/ui/studio.cpp +++ b/src/ui/studio.cpp @@ -1497,7 +1497,7 @@ void CStudio::UpdateDialogPublic() pl = static_cast< CLabel* >(pw->SearchControl(EVENT_DIALOG_LABEL1)); if ( pl != 0 ) { - //? GetResource(RES_TEXT, RT_IO_LIST, name); + // GetResource(RES_TEXT, RT_IO_LIST, name); // TODO: unused? pl->SetName(SearchDirectory(false).c_str(), false); } } -- cgit v1.2.3-1-g7c22 From 5661f5a413836307c7a2943ba32cfd17f92480ea Mon Sep 17 00:00:00 2001 From: krzys-h Date: Wed, 25 Dec 2013 19:41:15 +0100 Subject: Fixed "default controls" button (#263) --- src/ui/maindialog.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ui') diff --git a/src/ui/maindialog.cpp b/src/ui/maindialog.cpp index 5e95685..7cbcef5 100644 --- a/src/ui/maindialog.cpp +++ b/src/ui/maindialog.cpp @@ -2881,7 +2881,7 @@ bool CMainDialog::EventProcess(const Event &event) break; case EVENT_INTERFACE_KDEF: - m_app->ResetKeyStates(); + m_main->SetDefaultInputBindings(); UpdateKey(); break; -- cgit v1.2.3-1-g7c22 From fcda183b96098e9ed388cad6257049a44d6bbbed Mon Sep 17 00:00:00 2001 From: krzys-h Date: Thu, 26 Dec 2013 21:05:58 +0100 Subject: Hide userlevels menu in release version Userlevels aren't working right now (issue #219) --- src/ui/maindialog.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/ui') diff --git a/src/ui/maindialog.cpp b/src/ui/maindialog.cpp index 7cbcef5..7540f3d 100644 --- a/src/ui/maindialog.cpp +++ b/src/ui/maindialog.cpp @@ -351,6 +351,7 @@ pb->SetState(STATE_SHADOW); pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_QUIT); pb->SetState(STATE_SHADOW); + #if DEV_BUILD // TODO: #if !_DEMO & !_SCHOOL if ( m_accessEnable && m_accessUser ) { @@ -365,6 +366,7 @@ pb->SetState(STATE_SHADOW); pb->SetState(STATE_SHADOW); } // #endif + #endif // TODO: remove? if (m_app->GetProtoMode()) -- cgit v1.2.3-1-g7c22 From 8b5b2eeaa152129dd23a9c127bd59ec260956c42 Mon Sep 17 00:00:00 2001 From: krzys-h Date: Fri, 27 Dec 2013 10:50:52 +0100 Subject: Added error message when CEdit is unable to read a file --- src/ui/edit.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/ui') diff --git a/src/ui/edit.cpp b/src/ui/edit.cpp index 271a8e7..67ed6a1 100644 --- a/src/ui/edit.cpp +++ b/src/ui/edit.cpp @@ -1466,7 +1466,10 @@ bool CEdit::ReadText(std::string filename, int addSize) } file = fopen(fs::path(path).make_preferred().string().c_str(), "rb"); - if ( file == NULL ) return false; + if ( file == NULL ) { + CLogger::GetInstancePointer()->Error("Unable to read text from file \"%s\"\n", path.c_str()); + return false; + } fseek(file, 0, SEEK_END); len = ftell(file); -- cgit v1.2.3-1-g7c22 From 9a741a66a4982cf324834dc2f1e5cff6e6038ade Mon Sep 17 00:00:00 2001 From: krzys-h Date: Fri, 27 Dec 2013 11:15:36 +0100 Subject: Changed version display in bottom-right corner to be actually version number instead of date --- src/ui/maindialog.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/ui') diff --git a/src/ui/maindialog.cpp b/src/ui/maindialog.cpp index 7540f3d..f9ca09c 100644 --- a/src/ui/maindialog.cpp +++ b/src/ui/maindialog.cpp @@ -20,6 +20,7 @@ #include "app/app.h" #include "app/system.h" +#include "common/config.h" #include "common/global.h" #include "common/event.h" #include "common/logger.h" @@ -1976,7 +1977,7 @@ ddim.y = 9.0f/480.0f; ddim.y = 10.0f/480.0f; //#endif //GetResource(RES_TEXT, RT_VERSION_ID, name); - pl = pw->CreateLabel(pos, ddim, 0, EVENT_LABEL1, __DATE__); + pl = pw->CreateLabel(pos, ddim, 0, EVENT_LABEL1, COLOBOT_VERSION_DISPLAY); pl->SetFontType(Gfx::FONT_COURIER); pl->SetFontSize(9.0f); } -- cgit v1.2.3-1-g7c22 From 246b7e107e058e9da972e038e28ccdb7085c09cc Mon Sep 17 00:00:00 2001 From: krzys-h Date: Fri, 27 Dec 2013 20:36:11 +0100 Subject: Removed prototypes support --- src/ui/maindialog.cpp | 48 +++++++++++------------------------------------- 1 file changed, 11 insertions(+), 37 deletions(-) (limited to 'src/ui') diff --git a/src/ui/maindialog.cpp b/src/ui/maindialog.cpp index f9ca09c..4726933 100644 --- a/src/ui/maindialog.cpp +++ b/src/ui/maindialog.cpp @@ -369,15 +369,11 @@ pb->SetState(STATE_SHADOW); // #endif #endif - // TODO: remove? - if (m_app->GetProtoMode()) - { - pos.x = 139.0f/640.0f; - pos.y = 313.0f/480.0f; - ddim.x = 0.09f; - pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_PROTO); - pb->SetState(STATE_SHADOW); - } + /*pos.x = 139.0f/640.0f; + pos.y = 313.0f/480.0f; + ddim.x = 0.09f; + pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_PROTO); + pb->SetState(STATE_SHADOW);*/ pos.x = 0.40f; ddim.x = 0.20f; @@ -773,15 +769,13 @@ pb->SetState(STATE_SHADOW); m_phase == PHASE_MISSION || m_phase == PHASE_FREE || m_phase == PHASE_TEEN || - m_phase == PHASE_USER || - m_phase == PHASE_PROTO ) + m_phase == PHASE_USER ) { if ( m_phase == PHASE_TRAINER ) m_index = 0; if ( m_phase == PHASE_DEFI ) m_index = 1; if ( m_phase == PHASE_MISSION ) m_index = 2; if ( m_phase == PHASE_FREE ) m_index = 3; if ( m_phase == PHASE_USER ) m_index = 4; - if ( m_phase == PHASE_PROTO ) m_index = 5; if ( m_phase == PHASE_TEEN ) m_index = 6; if ( m_phase == PHASE_FREE ) @@ -797,7 +791,6 @@ pb->SetState(STATE_SHADOW); if ( m_phase == PHASE_FREE ) strcpy(m_sceneName, "free"); if ( m_phase == PHASE_TEEN ) strcpy(m_sceneName, "teen"); if ( m_phase == PHASE_USER ) strcpy(m_sceneName, "user"); - if ( m_phase == PHASE_PROTO ) strcpy(m_sceneName, "proto"); ReadGamerInfo(); @@ -813,7 +806,6 @@ pb->SetState(STATE_SHADOW); if ( m_phase == PHASE_FREE ) res = RT_TITLE_FREE; if ( m_phase == PHASE_TEEN ) res = RT_TITLE_TEEN; if ( m_phase == PHASE_USER ) res = RT_TITLE_USER; - if ( m_phase == PHASE_PROTO ) res = RT_TITLE_PROTO; GetResource(RES_TEXT, res, name); pw->SetName(name); @@ -862,7 +854,6 @@ pb->SetState(STATE_SHADOW); if ( m_phase == PHASE_FREE ) res = RT_PLAY_CHAPf; if ( m_phase == PHASE_TEEN ) res = RT_PLAY_CHAPte; if ( m_phase == PHASE_USER ) res = RT_PLAY_CHAPu; - if ( m_phase == PHASE_PROTO ) res = RT_PLAY_CHAPp; GetResource(RES_TEXT, res, name); pl = pw->CreateLabel(pos, ddim, 0, EVENT_LABEL11, name); pl->SetTextAlign(Gfx::TEXT_ALIGN_LEFT); @@ -886,7 +877,6 @@ pb->SetState(STATE_SHADOW); if ( m_phase == PHASE_FREE ) res = RT_PLAY_LISTf; if ( m_phase == PHASE_TEEN ) res = RT_PLAY_LISTk; if ( m_phase == PHASE_USER ) res = RT_PLAY_LISTu; - if ( m_phase == PHASE_PROTO ) res = RT_PLAY_LISTp; GetResource(RES_TEXT, res, name); pl = pw->CreateLabel(pos, ddim, 0, EVENT_LABEL12, name); pl->SetTextAlign(Gfx::TEXT_ALIGN_LEFT); @@ -1949,7 +1939,6 @@ pos.y -= 0.048f; m_phase == PHASE_FREE || m_phase == PHASE_TEEN || m_phase == PHASE_USER || - m_phase == PHASE_PROTO || m_phase == PHASE_SETUPd || m_phase == PHASE_SETUPg || m_phase == PHASE_SETUPp || @@ -2233,10 +2222,6 @@ bool CMainDialog::EventProcess(const Event &event) m_main->ChangePhase(PHASE_USER); break; - case EVENT_INTERFACE_PROTO: - m_main->ChangePhase(PHASE_PROTO); - break; - case EVENT_INTERFACE_SETUP: m_main->ChangePhase(m_phaseSetup); break; @@ -2440,8 +2425,7 @@ bool CMainDialog::EventProcess(const Event &event) m_phase == PHASE_MISSION || m_phase == PHASE_FREE || m_phase == PHASE_TEEN || - m_phase == PHASE_USER || - m_phase == PHASE_PROTO ) + m_phase == PHASE_USER ) { pw = static_cast(m_interface->SearchControl(EVENT_WINDOW5)); if ( pw == 0 ) return false; @@ -2460,8 +2444,7 @@ bool CMainDialog::EventProcess(const Event &event) m_phase == PHASE_MISSION || m_phase == PHASE_FREE || m_phase == PHASE_TEEN || - m_phase == PHASE_USER || - m_phase == PHASE_PROTO ) + m_phase == PHASE_USER ) { switch( event.type ) { @@ -2488,11 +2471,6 @@ bool CMainDialog::EventProcess(const Event &event) break; case EVENT_INTERFACE_PLAY: - if ( m_phase == PHASE_PROTO && m_chap[m_index] == 0 && m_sel[m_index] == 0 ) - { - m_main->ChangePhase(PHASE_MODEL); - break; - } m_sceneRank = (m_chap[m_index]+1)*100+(m_sel[m_index]+1); m_phaseTerm = m_phase; m_main->ChangePhase(PHASE_LOADING); @@ -3109,8 +3087,7 @@ void CMainDialog::GlintMove() m_phase == PHASE_MISSION || m_phase == PHASE_FREE || m_phase == PHASE_TEEN || - m_phase == PHASE_USER || - m_phase == PHASE_PROTO ) + m_phase == PHASE_USER ) { pg = static_cast(pw->SearchControl(EVENT_INTERFACE_GLINTl)); if ( pg != 0 ) @@ -3338,7 +3315,6 @@ void CMainDialog::FrameParticle(float rTime) m_phase == PHASE_FREE || m_phase == PHASE_TEEN || m_phase == PHASE_USER || - m_phase == PHASE_PROTO || m_phase == PHASE_SETUPd || m_phase == PHASE_SETUPg || m_phase == PHASE_SETUPp || @@ -4685,8 +4661,7 @@ void CMainDialog::AllMissionUpdate() m_phase == PHASE_MISSION || m_phase == PHASE_FREE || m_phase == PHASE_TEEN || - m_phase == PHASE_USER || - m_phase == PHASE_PROTO ) + m_phase == PHASE_USER ) { UpdateSceneChap(m_chap[m_index]); UpdateSceneList(m_chap[m_index], m_sel[m_index]); @@ -4989,8 +4964,7 @@ void CMainDialog::ShowSoluceUpdate() m_phase == PHASE_MISSION || m_phase == PHASE_FREE || m_phase == PHASE_TEEN || - m_phase == PHASE_USER || - m_phase == PHASE_PROTO ) + m_phase == PHASE_USER ) { m_bSceneSoluce = false; -- cgit v1.2.3-1-g7c22 From 1b7389367897b858781790f2ada63203b4035ada Mon Sep 17 00:00:00 2001 From: krzys-h Date: Fri, 27 Dec 2013 21:46:16 +0100 Subject: Temporary fix for #232 - don't try to show the buttons This makes SatCom usable for now --- src/ui/edit.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/ui') diff --git a/src/ui/edit.cpp b/src/ui/edit.cpp index 67ed6a1..ff06161 100644 --- a/src/ui/edit.cpp +++ b/src/ui/edit.cpp @@ -1672,12 +1672,14 @@ bool CEdit::ReadText(std::string filename, int addSize) buffer[i+6] == 'n' && buffer[i+7] == ' ' ) { + /* TODO: \button X; isn't working. Issue #232 if ( m_bSoluce || !bInSoluce ) { m_text[j] = GetValueParam(buffer+i+8, 0); m_format[j] = font|Gfx::FONT_BUTTON; j ++; } + */ i += strchr(buffer+i, ';')-(buffer+i)+1; } else if ( //m_format.size() > 0 && -- cgit v1.2.3-1-g7c22 From 0ff7e55b3343fbca959fb11236a009fb3790b652 Mon Sep 17 00:00:00 2001 From: krzys-h Date: Fri, 27 Dec 2013 22:28:25 +0100 Subject: Fix for #177 - save list sorting --- src/ui/maindialog.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'src/ui') diff --git a/src/ui/maindialog.cpp b/src/ui/maindialog.cpp index 4726933..f3eca3a 100644 --- a/src/ui/maindialog.cpp +++ b/src/ui/maindialog.cpp @@ -53,6 +53,7 @@ #include #include #include +#include #include #include @@ -4332,8 +4333,8 @@ void CMainDialog::IOReadName() } time(&now); - TimeToAscii(now, line); - sprintf(name, "%s %d - %s", resume, m_sel[m_index]+1, line); + TimeToAsciiClean(now, line); + sprintf(name, "%s - %s %d", line, resume, m_sel[m_index]+1); pe->SetText(name); pe->SetCursor(strlen(name), 0); pe->SetFocus(true); @@ -4349,7 +4350,7 @@ void CMainDialog::IOReadList() char line[500]; char name[100]; int i; - fs::directory_iterator end_iter; + std::vector v; pw = static_cast(m_interface->SearchControl(EVENT_WINDOW5)); if ( pw == 0 ) return; @@ -4363,12 +4364,14 @@ void CMainDialog::IOReadList() if (fs::exists(saveDir) && fs::is_directory(saveDir)) { - for( fs::directory_iterator dir_iter(saveDir) ; dir_iter != end_iter ; ++dir_iter) + copy(fs::directory_iterator(saveDir), fs::directory_iterator(), back_inserter(v)); + std::sort(v.begin(), v.end()); + for( std::vector::iterator iter = v.begin(); iter != v.end(); ++iter) { - if ( fs::is_directory(dir_iter->status()) && fs::exists(dir_iter->path() / "data.sav") ) + if ( fs::is_directory(*iter) && fs::exists(*iter / "data.sav") ) { - file = fopen((dir_iter->path() / "data.sav").make_preferred().string().c_str(), "r"); + file = fopen((*iter / "data.sav").make_preferred().string().c_str(), "r"); if ( file == NULL ) continue; while ( fgets(line, 500, file) != NULL ) @@ -4392,7 +4395,7 @@ void CMainDialog::IOReadList() fclose(file); pl->SetItemName(m_saveList.size(), name); - m_saveList.push_back(dir_iter->path()); + m_saveList.push_back(*iter); } } } -- cgit v1.2.3-1-g7c22 From 4a237f5925eb0d371e097416b17dd5e919cd2258 Mon Sep 17 00:00:00 2001 From: krzys-h Date: Tue, 31 Dec 2013 12:58:45 +0100 Subject: CPauseManager --- src/ui/displayinfo.cpp | 11 ++++++----- src/ui/displayinfo.h | 19 +++++++++++-------- src/ui/maindialog.cpp | 7 ++++--- src/ui/maindialog.h | 33 ++++++++++++++++++--------------- src/ui/studio.cpp | 13 +++++++------ src/ui/studio.h | 13 ++++++++----- 6 files changed, 54 insertions(+), 42 deletions(-) (limited to 'src/ui') diff --git a/src/ui/displayinfo.cpp b/src/ui/displayinfo.cpp index 79eb38a..8db53c5 100644 --- a/src/ui/displayinfo.cpp +++ b/src/ui/displayinfo.cpp @@ -59,6 +59,7 @@ CDisplayInfo::CDisplayInfo() m_main = CRobotMain::GetInstancePointer(); m_interface = m_main->GetInterface(); m_camera = m_main->GetCamera(); + m_pause = CPauseManager::GetInstancePointer(); m_bInfoMaximized = true; m_bInfoMinimized = false; @@ -330,13 +331,13 @@ void CDisplayInfo::HyperUpdate() void CDisplayInfo::StartDisplayInfo(std::string filename, int index, bool bSoluce) { - Gfx::Light light; + Gfx::Light light; Math::Point pos, dim; Ui::CWindow* pw; Ui::CEdit* edit; Ui::CButton* button; Ui::CSlider* slider; - CMotionToto* toto; + CMotionToto* toto; m_index = index; m_bSoluce = bSoluce; @@ -355,8 +356,8 @@ void CDisplayInfo::StartDisplayInfo(std::string filename, int index, bool bSoluc m_main->SetEditLock(true, false); m_main->SetEditFull(false); - m_bInitPause = m_engine->GetPause(); - m_engine->SetPause(true); + m_bInitPause = m_pause->GetPauseType(); + m_pause->SetPause(PAUSE_SATCOM); m_infoCamera = m_camera->GetType(); m_camera->SetType(Gfx::CAM_TYPE_INFO); @@ -839,7 +840,7 @@ void CDisplayInfo::StopDisplayInfo() } else { - if ( !m_bInitPause ) m_engine->SetPause(false); + m_pause->SetPause(m_bInitPause); m_main->SetEditLock(false, false); } m_camera->SetType(m_infoCamera); diff --git a/src/ui/displayinfo.h b/src/ui/displayinfo.h index eea50b7..891551b 100644 --- a/src/ui/displayinfo.h +++ b/src/ui/displayinfo.h @@ -25,6 +25,8 @@ #include "graphics/engine/camera.h" +#include "app/pausemanager.h" + class CRobotMain; class CObject; class CEventQueue; @@ -67,13 +69,14 @@ protected: void CreateObjectsFile(); protected: - Gfx::CEngine* m_engine; - CEventQueue* m_event; - CRobotMain* m_main; - Gfx::CCamera* m_camera; - CInterface* m_interface; - Gfx::CParticle* m_particle; - Gfx::CLightManager* m_light; + Gfx::CEngine* m_engine; + CEventQueue* m_event; + CRobotMain* m_main; + Gfx::CCamera* m_camera; + CInterface* m_interface; + Gfx::CParticle* m_particle; + Gfx::CLightManager* m_light; + CPauseManager* m_pause; bool m_bInfoMaximized; bool m_bInfoMinimized; @@ -88,7 +91,7 @@ protected: Math::Point m_infoFinalDim; int m_lightSuppl; bool m_bEditLock; - bool m_bInitPause; + PauseType m_bInitPause; bool m_bSoluce; CObject* m_toto; }; diff --git a/src/ui/maindialog.cpp b/src/ui/maindialog.cpp index f3eca3a..b954c71 100644 --- a/src/ui/maindialog.cpp +++ b/src/ui/maindialog.cpp @@ -120,6 +120,7 @@ CMainDialog::CMainDialog() m_camera = m_main->GetCamera(); m_engine = Gfx::CEngine::GetInstancePointer(); m_particle = m_engine->GetParticle(); + m_pause = CPauseManager::GetInstancePointer(); m_phase = PHASE_NAME; m_phaseSetup = PHASE_SETUPg; @@ -6401,8 +6402,8 @@ void CMainDialog::StartSuspend() { m_sound->MuteAll(true); m_main->ClearInterface(); - m_bInitPause = m_engine->GetPause(); - m_engine->SetPause(true); + m_bInitPause = m_pause->GetPauseType(); + m_pause->SetPause(PAUSE_DIALOG); m_engine->SetOverFront(false); // over flat behind m_main->CreateShortcuts(); m_main->StartSuspend(); @@ -6416,7 +6417,7 @@ void CMainDialog::StopSuspend() { m_sound->MuteAll(false); m_main->ClearInterface(); - if ( !m_bInitPause ) m_engine->SetPause(false); + m_pause->SetPause(m_bInitPause); m_engine->SetOverFront(true); // over flat front m_main->CreateShortcuts(); m_main->StopSuspend(); diff --git a/src/ui/maindialog.h b/src/ui/maindialog.h index 96aff2a..444a568 100644 --- a/src/ui/maindialog.h +++ b/src/ui/maindialog.h @@ -23,6 +23,8 @@ #include "object/robotmain.h" +#include "app/pausemanager.h" + #include #include @@ -186,6 +188,7 @@ protected: Gfx::CParticle* m_particle; Gfx::CCamera* m_camera; CSoundInterface* m_sound; + CPauseManager* m_pause; Phase m_phase; // copy of CRobotMain Phase m_phaseSetup; // tab selected @@ -242,26 +245,26 @@ protected: bool m_bCameraInvertY; // for CCamera bool m_bEffect; // for CCamera - Math::Point m_glintMouse; - float m_glintTime; + Math::Point m_glintMouse; + float m_glintTime; - int m_loadingCounter; + int m_loadingCounter; - bool m_bDialog; // this dialogue? - bool m_bDialogFire; // setting on fire? - bool m_bDialogDelete; - Math::Point m_dialogPos; - Math::Point m_dialogDim; - float m_dialogParti; - float m_dialogTime; - bool m_bInitPause; + bool m_bDialog; // this dialogue? + bool m_bDialogFire; // setting on fire? + bool m_bDialogDelete; + Math::Point m_dialogPos; + Math::Point m_dialogDim; + float m_dialogParti; + float m_dialogTime; + PauseType m_bInitPause; Gfx::CameraType m_initCamera; - int m_partiPhase[10]; - float m_partiTime[10]; - Math::Point m_partiPos[10]; + int m_partiPhase[10]; + float m_partiTime[10]; + Math::Point m_partiPos[10]; - SceneInfo m_sceneInfo[MAXSCENE]; + SceneInfo m_sceneInfo[MAXSCENE]; std::vector m_saveList; }; diff --git a/src/ui/studio.cpp b/src/ui/studio.cpp index fb4dd3d..5a3b403 100644 --- a/src/ui/studio.cpp +++ b/src/ui/studio.cpp @@ -71,6 +71,7 @@ CStudio::CStudio() m_main = CRobotMain::GetInstancePointer(); m_interface = m_main->GetInterface(); m_camera = m_main->GetCamera(); + m_pause = CPauseManager::GetInstancePointer(); m_bEditMaximized = false; m_bEditMinimized = false; @@ -563,7 +564,7 @@ void CStudio::StartEditScript(CScript *script, std::string name, int rank) m_main->SetEditLock(true, true); m_main->SetEditFull(false); - m_bInitPause = m_engine->GetPause(); + m_bInitPause = m_pause->GetPauseType(); m_main->SetSpeed(1.0f); m_editCamera = m_camera->GetType(); m_camera->SetType(Gfx::CAM_TYPE_EDIT); @@ -882,7 +883,7 @@ bool CStudio::StopEditScript(bool bCancel) button->SetState(STATE_VISIBLE); } - if ( !m_bInitPause ) m_engine->SetPause(false); + m_pause->SetPause(m_bInitPause); m_sound->MuteAll(false); m_main->SetEditLock(false, true); m_camera->SetType(m_editCamera); @@ -954,22 +955,22 @@ void CStudio::UpdateFlux() #if 1 if ( m_bRealTime ) // run? { - m_engine->SetPause(false); + m_pause->ClearPause(); m_sound->MuteAll(false); } else // step by step? { - m_engine->SetPause(true); + m_pause->SetPause(PAUSE_EDITOR); m_sound->MuteAll(true); } #else - m_engine->SetPause(false); + m_pause->ClearPause(); m_sound->MuteAll(false); #endif } else // stop? { - m_engine->SetPause(true); + m_pause->SetPause(PAUSE_EDITOR); m_sound->MuteAll(true); } } diff --git a/src/ui/studio.h b/src/ui/studio.h index 1c14124..d1c6a51 100644 --- a/src/ui/studio.h +++ b/src/ui/studio.h @@ -22,6 +22,8 @@ #include "graphics/engine/camera.h" +#include "app/pausemanager.h" + #include namespace fs = boost::filesystem; @@ -96,6 +98,7 @@ protected: CSoundInterface* m_sound; CInterface* m_interface; CApplication* m_app; + CPauseManager* m_pause; int m_rank; CScript* m_script; @@ -109,11 +112,11 @@ protected: Math::Point m_editFinalPos; Math::Point m_editFinalDim; - float m_time; - float m_fixInfoTextTime; - bool m_bRunning; - bool m_bRealTime; - bool m_bInitPause; + float m_time; + float m_fixInfoTextTime; + bool m_bRunning; + bool m_bRealTime; + PauseType m_bInitPause; std::string m_helpFilename; StudioDialog m_dialog; -- cgit v1.2.3-1-g7c22 From f0d97bfdb91a2c0a17d1697b145d4df930280dbb Mon Sep 17 00:00:00 2001 From: krzys-h Date: Sun, 18 May 2014 12:12:47 +0200 Subject: Better datadir mod support --- src/ui/edit.cpp | 3 ++- src/ui/maindialog.cpp | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'src/ui') diff --git a/src/ui/edit.cpp b/src/ui/edit.cpp index ff06161..6602651 100644 --- a/src/ui/edit.cpp +++ b/src/ui/edit.cpp @@ -19,6 +19,7 @@ #include "ui/edit.h" #include "app/app.h" +#include "app/gamedata.h" #include "clipboard/clipboard.h" @@ -1462,7 +1463,7 @@ bool CEdit::ReadText(std::string filename, int addSize) std::string path = filename; if (!fs::exists(path)) { - path = CApplication::GetInstancePointer()->GetDataDirPath() + "/" + filename; + path = CGameData::GetInstancePointer()->GetDataPath(filename); } file = fopen(fs::path(path).make_preferred().string().c_str(), "rb"); diff --git a/src/ui/maindialog.cpp b/src/ui/maindialog.cpp index b954c71..1964531 100644 --- a/src/ui/maindialog.cpp +++ b/src/ui/maindialog.cpp @@ -18,6 +18,7 @@ #include "ui/maindialog.h" #include "app/app.h" +#include "app/gamedata.h" #include "app/system.h" #include "common/config.h" @@ -3588,7 +3589,7 @@ void CMainDialog::BuildSceneName(std::string &filename, char *base, int rank) { rankStream << std::setfill('0') << std::setw(3) << rank; filename = base + rankStream.str() + ".txt"; - filename = CApplication::GetInstance().GetDataFilePath(DIR_LEVEL, filename); + filename = CGameData::GetInstancePointer()->GetFilePath(DIR_LEVEL, filename); } } -- cgit v1.2.3-1-g7c22 From 613e1d74c47cf3a756af9aff75575c7567699381 Mon Sep 17 00:00:00 2001 From: Mohamed Waheed Date: Tue, 24 Jun 2014 01:35:05 +0300 Subject: implemented savefile screenshot feature --- src/ui/maindialog.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/ui') diff --git a/src/ui/maindialog.cpp b/src/ui/maindialog.cpp index 1964531..784cd59 100644 --- a/src/ui/maindialog.cpp +++ b/src/ui/maindialog.cpp @@ -2075,9 +2075,10 @@ bool CMainDialog::EventProcess(const Event &event) { m_shotDelay --; if ( m_shotDelay == 0 ) - { - m_engine->WriteScreenShot(m_shotName, 320, 240); - //? m_engine->WriteScreenShot(m_shotName, 160, 120); + { + Math::IntPoint screenSize = m_app->GetVideoConfig().size; + + m_engine->WriteScreenShot(m_shotName, screenSize.x, screenSize.y); } } -- cgit v1.2.3-1-g7c22 From b7125a5b24bc6d2581bec0d3f792ba948e0e7edd Mon Sep 17 00:00:00 2001 From: Mohamed Waheed Date: Tue, 24 Jun 2014 20:27:31 +0300 Subject: formatting and enhancements for savefile screenshot feature --- src/ui/maindialog.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/ui') diff --git a/src/ui/maindialog.cpp b/src/ui/maindialog.cpp index 784cd59..fc5bb30 100644 --- a/src/ui/maindialog.cpp +++ b/src/ui/maindialog.cpp @@ -2076,9 +2076,9 @@ bool CMainDialog::EventProcess(const Event &event) m_shotDelay --; if ( m_shotDelay == 0 ) { - Math::IntPoint screenSize = m_app->GetVideoConfig().size; + Math::IntPoint windowSize = m_engine->GetWindowSize(); - m_engine->WriteScreenShot(m_shotName, screenSize.x, screenSize.y); + m_engine->WriteScreenShot(m_shotName, windowSize.x, windowSize.y); } } -- cgit v1.2.3-1-g7c22 From 1835d2ae580525603308206f7b8e6b4552b3ca0f Mon Sep 17 00:00:00 2001 From: krzys-h Date: Fri, 27 Jun 2014 19:50:09 +0200 Subject: Removed old code based on #ifs (issue #55) --- src/ui/color.cpp | 34 +---- src/ui/control.cpp | 4 - src/ui/displayinfo.cpp | 6 - src/ui/edit.cpp | 4 - src/ui/maindialog.cpp | 357 +------------------------------------------------ src/ui/studio.cpp | 6 - src/ui/window.cpp | 3 - 7 files changed, 6 insertions(+), 408 deletions(-) (limited to 'src/ui') diff --git a/src/ui/color.cpp b/src/ui/color.cpp index cbbc0dc..d1dc746 100644 --- a/src/ui/color.cpp +++ b/src/ui/color.cpp @@ -141,38 +141,7 @@ void CColor::Draw() m_engine->SetTexture("button1.png"); m_engine->SetState(Gfx::ENG_RSTATE_NORMAL); CControl::Draw(); - -#if _TEEN -// color = GetColor(m_color); - color = GetColor(); - - m_engine->SetTexture(""); // no texture - m_engine->SetState(Gfx::ENG_RSTATE_NORMAL); - - device = m_engine->GetDevice(); - - p1.x = m_pos.x + (4.0f / 640.0f); - p1.y = m_pos.y + (4.0f / 480.0f); - p2.x = m_pos.x + m_dim.x - (4.0f / 640.0f); - p2.y = m_pos.y + m_dim.y - (4.0f / 480.0f); - vertex[0] = Gfx::Vertex(Math::Vector(p1.x, p1.y, 0.0f), 0x00000000,0x00000000, Math::Point( 0.0f, 0.0f)); - vertex[1] = Gfx::Vertex(Math::Vector(p1.x, p2.y, 0.0f), 0x00000000,0x00000000, Math::Point( 0.0f, 0.0f)); - vertex[2] = Gfx::Vertex(Math::Vector(p2.x, p1.y, 0.0f), 0x00000000,0x00000000, Math::Point( 0.0f, 0.0f)); - vertex[3] = Gfx::Vertex(Math::Vector(p2.x, p2.y, 0.0f), 0x00000000,0x00000000, Math::Point( 0.0f, 0.0f)); - device->DrawPrimitive(Gfx::PRIMITIVE_TRIANGLE_STRIP, vertex, 4); - - p1.x = m_pos.x + (5.0f / 640.0f); - p1.y = m_pos.y + (5.0f / 480.0f); - p2.x = m_pos.x + m_dim.x - (5.0f / 640.0f); - p2.y = m_pos.y + m_dim.y - (5.0f / 480.0f); - vertex[0] = Gfx::Vertex(Math::Vector(p1.x, p1.y, 0.0f), color,0x00000000, Math::Point( 0.0f, 0.0f)); - vertex[1] = Gfx::Vertex(Math::Vector(p1.x, p2.y, 0.0f), color,0x00000000, Math::Point( 0.0f, 0.0f)); - vertex[2] = Gfx::Vertex(Math::Vector(p2.x, p1.y, 0.0f), color,0x00000000, Math::Point( 0.0f, 0.0f)); - vertex[3] = Gfx::Vertex(Math::Vector(p2.x, p2.y, 0.0f), color,0x00000000, Math::Point( 0.0f, 0.0f)); - device->DrawPrimitive(Gfx::PRIMITIVE_TRIANGLE_STRIP, vertex, 4); - - m_engine->AddStatisticTriangle(4); -#else + p1.x = m_pos.x + (3.0f / 640.0f); p1.y = m_pos.y + (3.0f / 480.0f); p2.x = m_pos.x + m_dim.x - (3.0f / 640.0f); @@ -191,7 +160,6 @@ void CColor::Draw() device = m_engine->GetDevice(); device->DrawPrimitive(Gfx::PRIMITIVE_TRIANGLE_STRIP, vertex, 4); m_engine->AddStatisticTriangle(2); -#endif } diff --git a/src/ui/control.cpp b/src/ui/control.cpp index 501350e..4e64ee9 100644 --- a/src/ui/control.cpp +++ b/src/ui/control.cpp @@ -506,11 +506,7 @@ void CControl::Draw() if ( icon >= 192 ) { icon -= 192; -#if _POLISH - m_engine->SetTexture("textp.png"); -#else m_engine->SetTexture("text.png"); -#endif m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_WHITE); } else if ( icon >= 128 ) diff --git a/src/ui/displayinfo.cpp b/src/ui/displayinfo.cpp index 8db53c5..e7748ae 100644 --- a/src/ui/displayinfo.cpp +++ b/src/ui/displayinfo.cpp @@ -390,13 +390,7 @@ void CDisplayInfo::StartDisplayInfo(std::string filename, int index, bool bSoluc button = pw->CreateButton(pos, dim, 128+57, EVENT_SATCOM_HUSTON); button->SetState(STATE_SHADOW); -#if _TEEN -#if !_ENGLISH - button = pw->CreateButton(pos, dim, 46, EVENT_SATCOM_SAT); -#endif -#else button = pw->CreateButton(pos, dim, 128+58, EVENT_SATCOM_SAT); -#endif button->SetState(STATE_SHADOW); //? button = pw->CreateButton(pos, dim, 128+59, EVENT_SATCOM_OBJECT); //? button->SetState(STATE_SHADOW); diff --git a/src/ui/edit.cpp b/src/ui/edit.cpp index 6602651..e2df62b 100644 --- a/src/ui/edit.cpp +++ b/src/ui/edit.cpp @@ -1225,11 +1225,7 @@ void CEdit::DrawPart(Math::Point pos, Math::Point dim, int icon) Math::Point uv1, uv2; float dp; -#if _POLISH - m_engine->SetTexture("textp.png"); -#else m_engine->SetTexture("text.png"); -#endif m_engine->SetState(Gfx::ENG_RSTATE_NORMAL); uv1.x = (16.0f/256.0f)*(icon%16); diff --git a/src/ui/maindialog.cpp b/src/ui/maindialog.cpp index fc5bb30..11f8f4a 100644 --- a/src/ui/maindialog.cpp +++ b/src/ui/maindialog.cpp @@ -157,9 +157,6 @@ CMainDialog::CMainDialog() m_bMovies = true; m_bNiceReset = true; m_bHimselfDamage = true; -/* TODO: #if _TEEN - m_bCameraScroll = false; -#else*/ m_bCameraScroll = true; m_bCameraInvertX = false; @@ -247,9 +244,6 @@ void CMainDialog::ChangePhase(Phase phase) pos.y = 0.10f; ddim.x = 0.30f; ddim.y = 0.80f; - /* TODO: #if _TEEN - pw = m_interface->CreateWindows(pos, ddim, 12, EVENT_WINDOW5); -#else*/ pw = m_interface->CreateWindows(pos, ddim, 10, EVENT_WINDOW5); GetResource(RES_TEXT, RT_TITLE_INIT, name); @@ -265,22 +259,7 @@ void CMainDialog::ChangePhase(Phase phase) ddim.x = 0.30f; ddim.y = 0.30f; pw->CreateGroup(pos, ddim, 4, EVENT_INTERFACE_GLINTr); // blue corner - - /* TODO: #if _SCHOOL - ddim.x = 0.20f; - ddim.y = dim.y*2.4f; - pos.x = 0.40f; - pos.y = oy+sy*7.9f; - pg = pw->CreateGroup(pos, ddim, 24, EVENT_LABEL1); // orange - pg->SetState(STATE_SHADOW); - pos.y = oy+sy*3.9f; - pg = pw->CreateGroup(pos, ddim, 25, EVENT_LABEL1); // orange - pg->SetState(STATE_SHADOW); - ddim.y = dim.y*1.2f; - pos.y = oy+sy*1.9f; - pg = pw->CreateGroup(pos, ddim, 26, EVENT_LABEL1); // red - pg->SetState(STATE_SHADOW); -#else */ + ddim.x = 0.20f; ddim.y = dim.y*2.4f; pos.x = 0.40f; @@ -300,26 +279,7 @@ void CMainDialog::ChangePhase(Phase phase) pos.y = oy+sy*1.9f; pg = pw->CreateGroup(pos, ddim, 26, EVENT_LABEL1); // red pg->SetState(STATE_SHADOW); - - /* TODO: #if _SCHOOL - ddim.x = 0.18f; - ddim.y = dim.y*1; - pos.x = 0.41f; - pos.y = oy+sy*9.1f; - pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_TRAINER); - pb->SetState(STATE_SHADOW); - - pos.y = oy+sy*8.0f; -#if _TEEN -pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_TEEN); -#else -pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_DEFI); -#endif -#if _CEEBOTDEMO -pb->ClearState(STATE_ENABLE); -#endif -pb->SetState(STATE_SHADOW); -#else */ + ddim.x = 0.18f; ddim.y = dim.y*1; pos.x = 0.41f; @@ -356,20 +316,14 @@ pb->SetState(STATE_SHADOW); pb->SetState(STATE_SHADOW); #if DEV_BUILD - // TODO: #if !_DEMO & !_SCHOOL if ( m_accessEnable && m_accessUser ) { pos.x = 447.0f/640.0f; pos.y = 313.0f/480.0f; ddim.x = 0.09f; - /*#if _POLISH - pos.x -= 5.0f/640.0f; - ddim.x += 10.0f/640.0f; -#endif*/ pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_USER); pb->SetState(STATE_SHADOW); } - // #endif #endif /*pos.x = 139.0f/640.0f; @@ -408,19 +362,6 @@ pb->SetState(STATE_SHADOW); GetResource(RES_TEXT, RT_TITLE_NAME, name); pw->SetName(name); - /* TODO: #if _NEWLOOK - pos.x = 80.0f/640.0f; - pos.y = 93.0f/480.0f; - ddim.x = 285.0f/640.0f; - ddim.y = 266.0f/480.0f; - pg = pw->CreateGroup(pos, ddim, 23, EVENT_LABEL1); // blue - pg->SetState(STATE_SHADOW); - pos.x = 372.0f/640.0f; - ddim.x = 188.0f/640.0f; - pg = pw->CreateGroup(pos, ddim, 26, EVENT_LABEL1); // violet - pg->SetState(STATE_SHADOW); -#endif*/ - pos.x = 0.10f; pos.y = 0.40f; ddim.x = 0.50f; @@ -528,15 +469,6 @@ pb->SetState(STATE_SHADOW); GetResource(RES_TEXT, RT_TITLE_PERSO, name); pw->SetName(name); - /* TODO: #if _NEWLOOK - pos.x = 95.0f/640.0f; - pos.y = 66.0f/480.0f; - ddim.x = 443.0f/640.0f; - ddim.y = 42.0f/480.0f; - pg = pw->CreateGroup(pos, ddim, 26, EVENT_LABEL1); // violet - pg->SetState(STATE_SHADOW); -#endif*/ - pos.x = 0.10f; pos.y = 0.40f; ddim.x = 0.50f; @@ -812,29 +744,6 @@ pb->SetState(STATE_SHADOW); GetResource(RES_TEXT, res, name); pw->SetName(name); - /* TODO: #if _NEWLOOK - pos.x = 100.0f/640.0f; - pos.y = 226.0f/480.0f; - ddim.x = 216.0f/640.0f; - ddim.y = 160.0f/480.0f; - pg = pw->CreateGroup(pos, ddim, 23, EVENT_LABEL1); // blue - pg->SetState(STATE_SHADOW); - pos.x = 322.0f/640.0f; - pg = pw->CreateGroup(pos, ddim, 24, EVENT_LABEL1); // cyan - pg->SetState(STATE_SHADOW); - - pos.x = 100.0f/640.0f; - pos.y = 122.0f/480.0f; - ddim.x = 438.0f/640.0f; - ddim.y = 98.0f/480.0f; - pg = pw->CreateGroup(pos, ddim, 25, EVENT_LABEL1); // green - pg->SetState(STATE_SHADOW); - pos.y = 66.0f/480.0f; - ddim.y = 42.0f/480.0f; - pg = pw->CreateGroup(pos, ddim, 26, EVENT_LABEL1); // violet - pg->SetState(STATE_SHADOW); -#endif */ - pos.x = 0.10f; pos.y = 0.40f; ddim.x = 0.50f; @@ -1045,80 +954,6 @@ pb->SetState(STATE_SHADOW); ddim.y = 0.05f; pw->CreateGroup(pos, ddim, 3, EVENT_NULL); // transparent -> gray - /* TODO: #if _NEWLOOK - if ( m_phase == PHASE_SETUPd || // setup/display ? - m_phase == PHASE_SETUPds ) - { - pos.x = 100.0f/640.0f; - pos.y = 130.0f/480.0f; - ddim.x = 216.0f/640.0f; - ddim.y = 212.0f/480.0f; - pg = pw->CreateGroup(pos, ddim, 23, EVENT_LABEL1); // blue - pg->SetState(STATE_SHADOW); - pos.x = 324.0f/640.0f; - pg = pw->CreateGroup(pos, ddim, 24, EVENT_LABEL1); // cyan - pg->SetState(STATE_SHADOW); - } - if ( m_phase == PHASE_SETUPg || // setup/graphic ? - m_phase == PHASE_SETUPgs ) - { - pos.x = 100.0f/640.0f; - pos.y = 130.0f/480.0f; - ddim.x = 174.0f/640.0f; - ddim.y = 212.0f/480.0f; - pg = pw->CreateGroup(pos, ddim, 23, EVENT_LABEL1); // blue - pg->SetState(STATE_SHADOW); - pos.x = 282.0f/640.0f; - ddim.x = 258.0f/640.0f; - pg = pw->CreateGroup(pos, ddim, 24, EVENT_LABEL1); // cyan - pg->SetState(STATE_SHADOW); - } - if ( m_phase == PHASE_SETUPp || // setup/game ? - m_phase == PHASE_SETUPps ) - { - pos.x = 100.0f/640.0f; - pos.y = 130.0f/480.0f; - ddim.x = 226.0f/640.0f; - ddim.y = 212.0f/480.0f; - pg = pw->CreateGroup(pos, ddim, 23, EVENT_LABEL1); // blue - pg->SetState(STATE_SHADOW); - pos.x = 334.0f/640.0f; - ddim.x = 206.0f/640.0f; - pg = pw->CreateGroup(pos, ddim, 24, EVENT_LABEL1); // cyan - pg->SetState(STATE_SHADOW); - } - if ( m_phase == PHASE_SETUPc || // setup/command ? - m_phase == PHASE_SETUPcs ) - { - pos.x = 100.0f/640.0f; - pos.y = 125.0f/480.0f; - ddim.x = 440.0f/640.0f; - ddim.y = 222.0f/480.0f; - pg = pw->CreateGroup(pos, ddim, 23, EVENT_LABEL1); // blue - pg->SetState(STATE_SHADOW); - } - if ( m_phase == PHASE_SETUPs || // setup/sound ? - m_phase == PHASE_SETUPss ) - { - pos.x = 100.0f/640.0f; - pos.y = 130.0f/480.0f; - ddim.x = 216.0f/640.0f; - ddim.y = 212.0f/480.0f; - pg = pw->CreateGroup(pos, ddim, 23, EVENT_LABEL1); // blue - pg->SetState(STATE_SHADOW); - pos.x = 324.0f/640.0f; - pg = pw->CreateGroup(pos, ddim, 24, EVENT_LABEL1); // cyan - pg->SetState(STATE_SHADOW); - } - - pos.x = 100.0f/640.0f; - pos.y = 66.0f/480.0f; - ddim.x = 440.0f/640.0f; - ddim.y = 42.0f/480.0f; - pg = pw->CreateGroup(pos, ddim, 26, EVENT_LABEL1); // violet - pg->SetState(STATE_SHADOW); -#endif */ - ddim.x = 0.78f/5-0.01f; ddim.y = 0.06f; pos.x = 0.115f; @@ -1349,10 +1184,7 @@ pb->SetState(STATE_SHADOW); ddim.y = dim.y*1; pos.x = ox+sx*10; pos.y = oy+sy*2; - /* TODO: #if _POLISH - ddim.x += 20.0f/640.0f; - pos.x -= 20.0f/640.0f*3.0f; -#endif*/ + pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_MIN); pb->SetState(STATE_SHADOW); pos.x += ddim.x; @@ -1375,13 +1207,7 @@ pb->SetState(STATE_SHADOW); //? pc = pw->CreateCheck(pos, ddim, -1, EVENT_INTERFACE_TOTO); //? pc->SetState(STATE_SHADOW); //? pos.y -= 0.048f; - /*TODO: #if _SCHOOL -#if _EDU -pc = pw->CreateCheck(pos, ddim, -1, EVENT_INTERFACE_SOLUCE4); -pc->SetState(STATE_SHADOW); -pos.y -= 0.048f; -#endif -#else*/ + pc = pw->CreateCheck(pos, ddim, -1, EVENT_INTERFACE_MOVIES); pc->SetState(STATE_SHADOW); pos.y -= 0.048f; @@ -1503,7 +1329,6 @@ pos.y -= 0.048f; pl = pw->CreateLabel(pos, ddim, 0, EVENT_LABEL1, name); pl->SetTextAlign(Gfx::TEXT_ALIGN_LEFT); - // TODO: #if (_FULL | _NET) & _SOUNDTRACKS pos.x = ox+sx*3; pos.y = 0.40f; ddim.x = dim.x*4.0f; @@ -1516,7 +1341,6 @@ pos.y -= 0.048f; GetResource(RES_EVENT, EVENT_INTERFACE_VOLMUSIC, name); pl = pw->CreateLabel(pos, ddim, 0, EVENT_LABEL2, name); pl->SetTextAlign(Gfx::TEXT_ALIGN_LEFT); - // #endif ddim.x = dim.x*3; ddim.y = dim.y*1; @@ -1554,15 +1378,6 @@ pos.y -= 0.048f; ddim.y = 0.50f; pw->CreateGroup(pos, ddim, 4, EVENT_INTERFACE_GLINTr); // blue corner - /* TODO: #if _NEWLOOK - pos.x = 100.0f/640.0f; - pos.y = 66.0f/480.0f; - ddim.x = 438.0f/640.0f; - ddim.y = 42.0f/480.0f; - pg = pw->CreateGroup(pos, ddim, 26, EVENT_LABEL1); // violet - pg->SetState(STATE_SHADOW); -#endif */ - pos.x = 290.0f/640.0f; ddim.x = 245.0f/640.0f; @@ -1638,15 +1453,6 @@ pos.y -= 0.048f; ddim.y = 0.50f; pw->CreateGroup(pos, ddim, 4, EVENT_INTERFACE_GLINTr); // blue corner - /* TODO: #if _NEWLOOK - pos.x = 100.0f/640.0f; - pos.y = 66.0f/480.0f; - ddim.x = 438.0f/640.0f; - ddim.y = 42.0f/480.0f; - pg = pw->CreateGroup(pos, ddim, 26, EVENT_LABEL1); // violet - pg->SetState(STATE_SHADOW); -#endif*/ - pos.x = 290.0f/640.0f; ddim.x = 245.0f/640.0f; @@ -1706,9 +1512,6 @@ pos.y -= 0.048f; pos.y = 0.10f; ddim.x = 0.30f; ddim.y = 0.80f; - /*TODO: #if _TEEN - pw = m_interface->CreateWindows(pos, ddim, 12, EVENT_WINDOW5); -#else*/ pw = m_interface->CreateWindows(pos, ddim, 10, EVENT_WINDOW5); pw->SetName(" "); @@ -1817,7 +1620,6 @@ pos.y -= 0.048f; ddim.y = 0.0f; pw = m_interface->CreateWindows(pos, ddim, -1, EVENT_WINDOW5); - // TODO: #if _FULL | _NET pos.x = 80.0f/640.0f; pos.y = 240.0f/480.0f; ddim.x = 490.0f/640.0f; @@ -1830,54 +1632,6 @@ pos.y -= 0.048f; pe->SetFontSize(Gfx::FONT_SIZE_SMALL); pe->ReadText(std::string("help/") + m_app->GetLanguageChar() + std::string("/authors.txt")); - // #endif - /* TODO: #if _SCHOOL - #if _CEEBOTDEMO - pos.x = 80.0f/640.0f; - pos.y = 210.0f/480.0f; - ddim.x = 490.0f/640.0f; - ddim.y = 150.0f/480.0f; - #else - pos.x = 80.0f/640.0f; - pos.y = 200.0f/480.0f; - ddim.x = 490.0f/640.0f; - ddim.y = 150.0f/480.0f; - #endif - pe = pw->CreateEdit(pos, ddim, 0, EVENT_EDIT1); - pe->SetGenericMode(true); - pe->SetEditCap(false); - pe->SetHighlightCap(false); - pe->SetFontType(Gfx::FONT_COURIER); - pe->SetFontSize(Gfx::FONT_SIZE_SMALL); - pe->ReadText("help/authors.txt");*/ - - /* #if _DEMO - //? pos.x = 80.0f/640.0f; - //? pos.y = 240.0f/480.0f; - //? ddim.x = 490.0f/640.0f; - //? ddim.y = 110.0f/480.0f; - //? pe = pw->CreateEdit(pos, ddim, 0, EVENT_EDIT1); - //? pe->SetGenericMode(true); - //? pe->SetEditCap(false); - //? pe->SetHiliteCap(false); - //? pe->SetFontType(Gfx::FONT_COURIER); - //? pe->SetFontSize(Gfx::FONT_SIZE_SMALL); - //? pe->ReadText("help/demo.txt"); - - //? pos.x = 80.0f/640.0f; - //? pos.y = 140.0f/480.0f; - //? ddim.x = 490.0f/640.0f; - //? ddim.y = 100.0f/480.0f; - //? pe = pw->CreateEdit(pos, ddim, 0, EVENT_EDIT2); - //? pe->SetGenericMode(true); - //? pe->SetEditCap(false); - //? pe->SetHiliteCap(false); - //? pe->SetFontType(Gfx::FONT_COURIER); - //? pe->SetFontSize(Gfx::FONT_SIZE_SMALL); - //? pe->ReadText("help/authors.txt"); -#endif */ - - // TODO: #if !_DEMO pos.x = 40.0f/640.0f; pos.y = 83.0f/480.0f; ddim.x = 246.0f/640.0f; @@ -1907,23 +1661,13 @@ pos.y -= 0.048f; pl = pw->CreateLabel(pos, ddim, 0, EVENT_LABEL4, name); pl->SetFontType(Gfx::FONT_COURIER); pl->SetFontSize(Gfx::FONT_SIZE_SMALL); - // #endif - - /* TODO: #if _DEMO - pos.x = 481.0f/640.0f; - pos.y = 51.0f/480.0f; - ddim.x = 30.0f/640.0f; - ddim.y = 30.0f/480.0f; - pb = pw->CreateButton(pos, ddim, 49, EVENT_INTERFACE_ABORT); - pb->SetState(STATE_SHADOW); -#else */ + pos.x = 306.0f/640.0f; pos.y = 17.0f/480.0f; ddim.x = 30.0f/640.0f; ddim.y = 30.0f/480.0f; pb = pw->CreateButton(pos, ddim, 49, EVENT_INTERFACE_ABORT); pb->SetState(STATE_SHADOW); - // #endif m_engine->SetBackground("generico.png", Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f), @@ -1950,24 +1694,10 @@ pos.y -= 0.048f; m_phase == PHASE_READ || m_phase == PHASE_LOADING ) { - /*TODO: #if _SCHOOL -#if _TEEN -pos.x = 50.0f/640.0f; -pos.y = 430.0f/480.0f; -ddim.x = 200.0f/640.0f; -ddim.y = 10.0f/480.0f; -#else -pos.x = 450.0f/640.0f; -pos.y = 0.0f/480.0f; -ddim.x = 170.0f/640.0f; -ddim.y = 9.0f/480.0f; -#endif -#else */ pos.x = 540.0f/640.0f; pos.y = 9.0f/480.0f; ddim.x = 90.0f/640.0f; ddim.y = 10.0f/480.0f; - //#endif //GetResource(RES_TEXT, RT_VERSION_ID, name); pl = pw->CreateLabel(pos, ddim, 0, EVENT_LABEL1, COLOBOT_VERSION_DISPLAY); pl->SetFontType(Gfx::FONT_COURIER); @@ -3227,8 +2957,6 @@ Math::Vector SoundRand() void CMainDialog::FrameParticle(float rTime) { - /* TODO: #if _NEWLOOK -#else */ Math::Vector pos, speed; Math::Point dim; float *pParti, *pGlint; @@ -4765,17 +4493,6 @@ void CMainDialog::UpdateSceneChap(int &chap) { for ( j=0 ; j<9 ; j++ ) { -/* TODO: #if _SCHOOL - if ( m_phase == PHASE_MISSION ) break; - if ( m_phase == PHASE_FREE ) break; -#if _CEEBOTDEMO - if ( m_phase == PHASE_TRAINER && j >= 2 ) break; -#endif -#endif -#if _DEMO - if ( m_phase == PHASE_MISSION && j >= 4 ) break; - if ( m_phase == PHASE_TRAINER && j >= 1 ) break; -#endif */ BuildSceneName(fileName, m_sceneName, (j+1)*100); file = fopen(fileName.c_str(), "r"); if ( file == NULL ) break; @@ -4820,14 +4537,6 @@ void CMainDialog::UpdateSceneChap(int &chap) break; } -/* TODO: #if _TEEN - if ( m_phase == PHASE_TRAINER && !m_main->GetShowAll() && !bPassed ) - { - j ++; - break; - } -#endif*/ - if ( m_phase == PHASE_FREE && j == m_accessChap ) { j ++; @@ -4871,21 +4580,6 @@ void CMainDialog::UpdateSceneList(int chap, int &sel) for ( j=0 ; j<99 ; j++ ) { -/* TODO: #if _SCHOOL - if ( m_phase == PHASE_MISSION ) break; - if ( m_phase == PHASE_FREE ) break; -#if _CEEBOTDEMO -#if _TEEN - if ( m_phase == PHASE_TRAINER && j >= 5 ) break; -#else - if ( m_phase == PHASE_TRAINER && j >= 3 ) break; -#endif -#endif -#endif -#if _DEMO - if ( m_phase == PHASE_MISSION && j >= 3 ) break; - if ( m_phase == PHASE_TRAINER && j >= 5 ) break; -#endif */ BuildSceneName(fileName, m_sceneName, (chap+1)*100+(j+1)); file = fopen(fileName.c_str(), "r"); if ( file == NULL ) break; @@ -4929,14 +4623,6 @@ void CMainDialog::UpdateSceneList(int chap, int &sel) j ++; break; } - -/* TODO: #if _TEEN - if ( m_phase == PHASE_TRAINER && !m_main->GetShowAll() && !bPassed ) - { - j ++; - break; - } -#endif*/ } BuildSceneName(fileName, m_sceneName, (chap+1)*100+(j+1)); @@ -5564,21 +5250,7 @@ void CMainDialog::SetupMemorize() GetProfile().SetLocalProfileString("Setup", "KeyMap", key.str()); -#if _NET - if ( m_accessEnable ) - { - iValue = m_accessMission; - SetLocalProfileInt("Setup", "AccessMission", iValue); - - iValue = m_accessUser; - SetLocalProfileInt("Setup", "AccessUser", iValue); - } -#endif - GetProfile().SetLocalProfileInt("Setup", "DeleteGamer", m_bDeleteGamer); - - // TODO: write graphic engine profile - //m_engine->WriteProfile(); } // Remember all the settings. @@ -5788,21 +5460,6 @@ void CMainDialog::SetupRecall() } } -#if _NET - if ( m_accessEnable ) - { - if ( GetProfile().GetLocalProfileInt("Setup", "AccessMission", iValue) ) - { - m_accessMission = iValue; - } - - if ( GetProfile().GetLocalProfileInt("Setup", "AccessUser", iValue) ) - { - m_accessUser = iValue; - } - } -#endif - if ( GetProfile().GetLocalProfileInt("Setup", "DeleteGamer", iValue) ) { m_bDeleteGamer = iValue; @@ -6005,10 +5662,6 @@ void CMainDialog::StartAbort() pos.x = 0.40f; dim.x = 0.20f; -/* TODO: #if _POLISH - pos.x -= 7.0f/640.0f; - dim.x += 14.0f/640.0f; -#endif*/ dim.y = 32.0f/480.0f; pos.y = 0.74f; diff --git a/src/ui/studio.cpp b/src/ui/studio.cpp index 5a3b403..f83704e 100644 --- a/src/ui/studio.cpp +++ b/src/ui/studio.cpp @@ -1111,17 +1111,11 @@ void CStudio::StartDialog(StudioDialog type) GetResource(RES_TEXT, RT_IO_PRIVATE, name); pc->SetName(name); pc->SetState(STATE_SHADOW); -#if _POLISH - pc->SetFontSize(8.0f); -#endif pc = pw->CreateCheck(pos, dim, 0, EVENT_DIALOG_CHECK2); GetResource(RES_TEXT, RT_IO_PUBLIC, name); pc->SetName(name); pc->SetState(STATE_SHADOW); -#if _POLISH - pc->SetFontSize(8.0f); -#endif pb = pw->CreateButton(pos, dim, -1, EVENT_DIALOG_OK); pb->SetState(STATE_SHADOW); diff --git a/src/ui/window.cpp b/src/ui/window.cpp index ed18ce4..98e1e6c 100644 --- a/src/ui/window.cpp +++ b/src/ui/window.cpp @@ -1536,8 +1536,6 @@ void CWindow::DrawVertex(Math::Point pos, Math::Point dim, int icon) void CWindow::DrawHach(Math::Point pos, Math::Point dim) { -#if _NEWLOOK -#else Math::Point ppos, ddim, uv1, uv2; float dp, max, ndim; bool bStop; @@ -1575,7 +1573,6 @@ void CWindow::DrawHach(Math::Point pos, Math::Point dim) ppos.x += ddim.x; } while ( !bStop ); -#endif } } -- cgit v1.2.3-1-g7c22