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/object/auto/auto.cpp | 2 +- src/object/brain.cpp | 12 +++++++----- src/object/object.cpp | 4 ++-- src/object/object.h | 2 +- src/object/robotmain.cpp | 27 ++++++++++++++------------- src/object/robotmain.h | 4 ++-- 6 files changed, 27 insertions(+), 24 deletions(-) (limited to 'src/object') diff --git a/src/object/auto/auto.cpp b/src/object/auto/auto.cpp index 0aeaa0a..9e593a9 100644 --- a/src/object/auto/auto.cpp +++ b/src/object/auto/auto.cpp @@ -175,7 +175,6 @@ bool CAuto::CreateInterface(bool bSelect) Ui::CWindow* pw; Math::Point pos, dim, ddim; float ox, oy, sx, sy; - char name[100]; pw = static_cast(m_interface->SearchControl(EVENT_WINDOW0)); if ( pw != nullptr ) @@ -195,6 +194,7 @@ bool CAuto::CreateInterface(bool bSelect) pw = static_cast(m_interface->SearchControl(EVENT_WINDOW0)); if ( pw == 0 ) return false; + std::string name; m_object->GetTooltipName(name); pos.x = 0.0f; pos.y = 64.0f/480.0f; diff --git a/src/object/brain.cpp b/src/object/brain.cpp index 1b1565a..b27acd1 100644 --- a/src/object/brain.cpp +++ b/src/object/brain.cpp @@ -1238,7 +1238,6 @@ bool CBrain::CreateInterface(bool bSelect) Ui::CLabel* pl; Math::Point pos, dim, ddim; float ox, oy, sx, sy; - char name[100]; pw = static_cast< Ui::CWindow* >(m_interface->SearchControl(EVENT_WINDOW0)); if ( pw != 0 ) @@ -1259,13 +1258,14 @@ bool CBrain::CreateInterface(bool bSelect) pw = static_cast< Ui::CWindow* >(m_interface->SearchControl(EVENT_WINDOW0)); if ( pw == 0 ) return false; - m_object->GetTooltipName(name); + std::string tooltipLabel; + m_object->GetTooltipName(tooltipLabel); pos.x = 0.0f; pos.y = 64.0f/480.0f; ddim.x = 540.0f/640.0f; if ( !m_main->GetShowMap() ) ddim.x = 640.0f/640.0f; ddim.y = 16.0f/480.0f; - pw->CreateLabel(pos, ddim, 0, EVENT_LABEL0, name); + pw->CreateLabel(pos, ddim, 0, EVENT_LABEL0, tooltipLabel); dim.x = 33.0f/640.0f; dim.y = 33.0f/480.0f; @@ -1674,8 +1674,10 @@ bool CBrain::CreateInterface(bool bSelect) pos.y = oy+sy*1.2f; ddim.x = dim.x*2.2f; ddim.y = dim.y*0.4f; - GetResource(RES_TEXT, RT_INTERFACE_REC, name); - pl = pw->CreateLabel(pos, ddim, 0, EVENT_LABEL1, name); + + std::string recordLabel; + GetResource(RES_TEXT, RT_INTERFACE_REC, recordLabel); + pl = pw->CreateLabel(pos, ddim, 0, EVENT_LABEL1, recordLabel); pl->SetFontSize(9.0f); pos.x = ox+sx*7.0f; diff --git a/src/object/object.cpp b/src/object/object.cpp index 5a709e6..f1de424 100644 --- a/src/object/object.cpp +++ b/src/object/object.cpp @@ -7263,10 +7263,10 @@ int CObject::GetDefRank() // Getes the object name for the tooltip. -bool CObject::GetTooltipName(char* name) +bool CObject::GetTooltipName(std::string& name) { GetResource(RES_OBJECT, m_type, name); - return ( name[0] != 0 ); + return !name.empty(); } diff --git a/src/object/object.h b/src/object/object.h index e8b83d9..b5c0385 100644 --- a/src/object/object.h +++ b/src/object/object.h @@ -639,7 +639,7 @@ public: void SetDefRank(int rank); int GetDefRank(); - bool GetTooltipName(char* name); + bool GetTooltipName(std::string& name); void AddDeselList(CObject* pObj); CObject* SubDeselList(); diff --git a/src/object/robotmain.cpp b/src/object/robotmain.cpp index 26fa827..35ffe97 100644 --- a/src/object/robotmain.cpp +++ b/src/object/robotmain.cpp @@ -690,7 +690,7 @@ CRobotMain::CRobotMain(CApplication* app, bool loadProfile) m_movieInfoIndex = -1; m_tooltipPos = Math::Point(0.0f, 0.0f); - m_tooltipName[0] = 0; + m_tooltipName.clear(); m_tooltipTime = 0.0f; m_endingWinRank = 0; @@ -3025,7 +3025,7 @@ bool CRobotMain::DeleteObject() void CRobotMain::HiliteClear() { ClearTooltip(); - m_tooltipName[0] = 0; // really removes the tooltip + m_tooltipName.clear(); // really removes the tooltip if (!m_hilite) return; @@ -3059,11 +3059,11 @@ void CRobotMain::HiliteObject(Math::Point pos) CObject* obj = m_short->DetectShort(pos); - std::string nameStr; - if (m_dialog->GetTooltip() && m_interface->GetTooltip(pos, nameStr)) + std::string interfaceTooltipName; + if (m_dialog->GetTooltip() && m_interface->GetTooltip(pos, interfaceTooltipName)) { m_tooltipPos = pos; - strcpy(m_tooltipName, nameStr.c_str()); + m_tooltipName = interfaceTooltipName; m_tooltipTime = 0.0f; if (obj == nullptr) return; } @@ -3086,13 +3086,13 @@ void CRobotMain::HiliteObject(Math::Point pos) } } - char name[100]; if (obj != nullptr) { - if (m_dialog->GetTooltip() && obj->GetTooltipName(name)) + std::string objectTooltipName; + if (m_dialog->GetTooltip() && obj->GetTooltipName(objectTooltipName)) { m_tooltipPos = pos; - strcpy(m_tooltipName, name); + m_tooltipName = objectTooltipName; m_tooltipTime = 0.0f; } @@ -3117,15 +3117,14 @@ void CRobotMain::HiliteFrame(float rTime) ClearTooltip(); - if (m_tooltipTime >= 0.2f && - m_tooltipName[0] != 0) + if (m_tooltipTime >= 0.2f && !m_tooltipName.empty()) { CreateTooltip(m_tooltipPos, m_tooltipName); } } //! Creates a tooltip -void CRobotMain::CreateTooltip(Math::Point pos, const char* text) +void CRobotMain::CreateTooltip(Math::Point pos, const std::string& text) { Math::Point corner; corner.x = pos.x+0.022f; @@ -3949,7 +3948,9 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject) m_dialog->BuildResumeName(m_title, base, rank); m_dialog->BuildResumeName(m_resume, base, rank); - GetResource(RES_TEXT, RT_SCRIPT_NEW, m_scriptName); + std::string scriptNameStr; + GetResource(RES_TEXT, RT_SCRIPT_NEW, scriptNameStr); + strcpy(m_scriptName, scriptNameStr.c_str()); m_scriptFile[0] = 0; m_beginObject = false; @@ -7504,7 +7505,7 @@ void CRobotMain::StartMusic() void CRobotMain::ClearInterface() { HiliteClear(); // removes setting evidence - m_tooltipName[0] = 0; // really removes the tooltip + m_tooltipName.clear(); // really removes the tooltip } void CRobotMain::SetNumericLocale() diff --git a/src/object/robotmain.h b/src/object/robotmain.h index 035698c..76535de 100644 --- a/src/object/robotmain.h +++ b/src/object/robotmain.h @@ -398,7 +398,7 @@ protected: void HiliteClear(); void HiliteObject(Math::Point pos); void HiliteFrame(float rTime); - void CreateTooltip(Math::Point pos, const char* text); + void CreateTooltip(Math::Point pos, const std::string& text); void ClearTooltip(); CObject* DetectObject(Math::Point pos); void ChangeCamera(); @@ -506,7 +506,7 @@ protected: char m_mapFilename[100]; Math::Point m_tooltipPos; - char m_tooltipName[100]; + std::string m_tooltipName; float m_tooltipTime; char m_infoFilename[SATCOM_MAX][100]; // names of text files -- cgit v1.2.3-1-g7c22 From d0285d688615beb62a5b9e742b8d4103371695c5 Mon Sep 17 00:00:00 2001 From: krzys-h Date: Wed, 25 Dec 2013 18:53:32 +0100 Subject: Fixed AudioChange --- src/object/robotmain.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'src/object') diff --git a/src/object/robotmain.cpp b/src/object/robotmain.cpp index 35ffe97..4b45a20 100644 --- a/src/object/robotmain.cpp +++ b/src/object/robotmain.cpp @@ -4110,12 +4110,12 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject) if (i < 10) { m_audioChange[i].pos = OpPos(line, "pos")*g_unit; - m_audioChange[i].dist = OpFloat(line, "dist", 8.0f)*g_unit; + m_audioChange[i].dist = OpFloat(line, "dist", 1000.0f)*g_unit; m_audioChange[i].type = OpTypeObject(line, "type", OBJECT_NULL); m_audioChange[i].min = OpInt(line, "min", 1); m_audioChange[i].max = OpInt(line, "max", 9999); - m_audioChange[i].powermin = OpInt(line, "powermin", -1); - m_audioChange[i].powermax = OpInt(line, "powermax", 100); + m_audioChange[i].powermin = OpFloat(line, "powermin", -1); + m_audioChange[i].powermax = OpFloat(line, "powermax", 100); OpString(line, "filename", m_audioChange[i].music); m_audioChange[i].repeat = OpInt(line, "repeat", 1); m_audioChange[i].changed = false; @@ -4911,14 +4911,14 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject) if (i < 10) { m_endTake[i].pos = OpPos(line, "pos")*g_unit; - m_endTake[i].dist = OpFloat(line, "dist", 8.0f)*g_unit; + m_endTake[i].dist = OpFloat(line, "dist", (m_version < 2 ? 8.0f : 100.0f))*g_unit; m_endTake[i].type = OpTypeObject(line, "type", OBJECT_NULL); m_endTake[i].min = OpInt(line, "min", 1); m_endTake[i].max = OpInt(line, "max", 9999); if (m_version >= 2) { - m_endTake[i].powermin = OpInt(line, "powermin", -1); - m_endTake[i].powermax = OpInt(line, "powermax", 100); + m_endTake[i].powermin = OpFloat(line, "powermin", -1); + m_endTake[i].powermax = OpFloat(line, "powermax", 100); } else { @@ -6923,7 +6923,8 @@ void CRobotMain::UpdateAudio(bool frame) energyLevel = power->GetEnergy(); if (power->GetType() == OBJECT_ATOMIC) energyLevel *= 100; } - if (energyLevel < m_audioChange[t].powermin || energyLevel > m_audioChange[t].powermax) continue; + if (energyLevel < m_audioChange[t].powermin || energyLevel > m_audioChange[t].powermax) + continue; if (obj->GetTruck() == 0) oPos = obj->GetPosition(0); @@ -6939,7 +6940,7 @@ void CRobotMain::UpdateAudio(bool frame) if (nb >= m_audioChange[t].min && nb <= m_audioChange[t].max) { - CLogger::GetInstancePointer()->Debug("Changing music...\n"); + CLogger::GetInstancePointer()->Info("Changing music to \"%s\"\n", m_audioChange[t].music); m_sound->StopMusic(); m_sound->PlayMusic(std::string(m_audioChange[t].music), m_audioChange[t].repeat); m_audioChange[t].changed = true; -- cgit v1.2.3-1-g7c22 From 55fd03ade36f30c5ac18b5e9037622d0872d9bf3 Mon Sep 17 00:00:00 2001 From: krzys-h Date: Wed, 25 Dec 2013 19:34:34 +0100 Subject: Added WSAD as secondary controls (#231) --- src/object/robotmain.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/object') diff --git a/src/object/robotmain.cpp b/src/object/robotmain.cpp index 4b45a20..ba6e1c4 100644 --- a/src/object/robotmain.cpp +++ b/src/object/robotmain.cpp @@ -987,6 +987,10 @@ void CRobotMain::SetDefaultInputBindings() m_inputBindings[INPUT_SLOT_RIGHT ].primary = KEY(RIGHT); m_inputBindings[INPUT_SLOT_UP ].primary = KEY(UP); m_inputBindings[INPUT_SLOT_DOWN ].primary = KEY(DOWN); + m_inputBindings[INPUT_SLOT_LEFT ].secondary = KEY(a); + m_inputBindings[INPUT_SLOT_RIGHT ].secondary = KEY(d); + m_inputBindings[INPUT_SLOT_UP ].secondary = KEY(w); + m_inputBindings[INPUT_SLOT_DOWN ].secondary = KEY(s); m_inputBindings[INPUT_SLOT_GUP ].primary = VIRTUAL_KMOD(SHIFT); m_inputBindings[INPUT_SLOT_GDOWN ].primary = VIRTUAL_KMOD(CTRL); m_inputBindings[INPUT_SLOT_CAMERA ].primary = KEY(SPACE); -- cgit v1.2.3-1-g7c22 From c8ec3f2020151543f2ebe61e94ea5d985927d20c Mon Sep 17 00:00:00 2001 From: krzys-h Date: Wed, 25 Dec 2013 19:43:11 +0100 Subject: Added "E" as a secondary action button As requested by @Emxx52 on IRC --- src/object/robotmain.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'src/object') diff --git a/src/object/robotmain.cpp b/src/object/robotmain.cpp index ba6e1c4..22e8152 100644 --- a/src/object/robotmain.cpp +++ b/src/object/robotmain.cpp @@ -994,19 +994,20 @@ void CRobotMain::SetDefaultInputBindings() m_inputBindings[INPUT_SLOT_GUP ].primary = VIRTUAL_KMOD(SHIFT); m_inputBindings[INPUT_SLOT_GDOWN ].primary = VIRTUAL_KMOD(CTRL); m_inputBindings[INPUT_SLOT_CAMERA ].primary = KEY(SPACE); - m_inputBindings[INPUT_SLOT_CAMERA ].secondary = VIRTUAL_JOY(2); +// m_inputBindings[INPUT_SLOT_CAMERA ].secondary = VIRTUAL_JOY(2); m_inputBindings[INPUT_SLOT_DESEL ].primary = KEY(KP0); - m_inputBindings[INPUT_SLOT_DESEL ].secondary = VIRTUAL_JOY(6); +// m_inputBindings[INPUT_SLOT_DESEL ].secondary = VIRTUAL_JOY(6); m_inputBindings[INPUT_SLOT_ACTION ].primary = KEY(RETURN); - m_inputBindings[INPUT_SLOT_ACTION ].secondary = VIRTUAL_JOY(1); +// m_inputBindings[INPUT_SLOT_ACTION ].secondary = VIRTUAL_JOY(1); + m_inputBindings[INPUT_SLOT_ACTION ].secondary = KEY(e); m_inputBindings[INPUT_SLOT_NEAR ].primary = KEY(KP_PLUS); - m_inputBindings[INPUT_SLOT_NEAR ].secondary = VIRTUAL_JOY(5); +// m_inputBindings[INPUT_SLOT_NEAR ].secondary = VIRTUAL_JOY(5); m_inputBindings[INPUT_SLOT_AWAY ].primary = KEY(KP_MINUS); - m_inputBindings[INPUT_SLOT_AWAY ].secondary = VIRTUAL_JOY(4); +// m_inputBindings[INPUT_SLOT_AWAY ].secondary = VIRTUAL_JOY(4); m_inputBindings[INPUT_SLOT_NEXT ].primary = KEY(TAB); - m_inputBindings[INPUT_SLOT_NEXT ].secondary = VIRTUAL_JOY(3); +// m_inputBindings[INPUT_SLOT_NEXT ].secondary = VIRTUAL_JOY(3); m_inputBindings[INPUT_SLOT_HUMAN ].primary = KEY(HOME); - m_inputBindings[INPUT_SLOT_HUMAN ].secondary = VIRTUAL_JOY(7); +// m_inputBindings[INPUT_SLOT_HUMAN ].secondary = VIRTUAL_JOY(7); m_inputBindings[INPUT_SLOT_QUIT ].primary = KEY(ESCAPE); m_inputBindings[INPUT_SLOT_HELP ].primary = KEY(F1); m_inputBindings[INPUT_SLOT_PROG ].primary = KEY(F2); -- cgit v1.2.3-1-g7c22 From 0d31f59b124658155bf93ca78eb427a98c664572 Mon Sep 17 00:00:00 2001 From: krzys-h Date: Thu, 26 Dec 2013 18:50:05 +0100 Subject: .takeoff() for SpaceShip (#265) --- src/object/auto/autobase.cpp | 99 ++++++++++++++++++++++++-------------------- src/object/auto/autobase.h | 2 + src/object/robotmain.cpp | 1 + 3 files changed, 57 insertions(+), 45 deletions(-) (limited to 'src/object') diff --git a/src/object/auto/autobase.cpp b/src/object/auto/autobase.cpp index 6d61bc2..06b5dbb 100644 --- a/src/object/auto/autobase.cpp +++ b/src/object/auto/autobase.cpp @@ -121,7 +121,6 @@ bool CAutoBase::EventProcess(const Event &event) CObject* pObj; Math::Vector pos, speed, vibCir, iPos; Math::Point dim, p; - Error err; float angle, dist, time, h, len, vSpeed; int i, max; @@ -313,50 +312,7 @@ begin: if ( event.type == EVENT_OBJECT_BTAKEOFF ) { - err = CheckCloseDoor(); - if ( err != ERR_OK ) - { - m_main->DisplayError(err, m_object); - return false; - } - - err = m_main->CheckEndMission(false); - if ( err != ERR_OK ) - { - m_main->DisplayError(err, m_object); - return false; - } - - FreezeCargo(true); // freeze whole cargo - m_main->SetMovieLock(true); // blocks everything until the end - m_main->DeselectAll(); - - newEvent.type = EVENT_UPDINTERFACE; - m_eventQueue->AddEvent(newEvent); - - m_camera->SetType(Gfx::CAM_TYPE_SCRIPT); - - pos = m_pos; - pos.x -= 110.0f; - m_terrain->AdjustToFloor(pos); - pos.y += 10.0f; - m_camera->SetScriptEye(pos); - m_posSound = pos; - - pos = m_object->GetPosition(0); - pos.y += 50.0f; - m_camera->SetScriptLookat(pos); - - m_engine->SetFocus(1.0f); - - m_soundChannel = m_sound->Play(SOUND_MANIP, m_posSound, 0.3f, 1.5f, true); - m_sound->AddEnvelope(m_soundChannel, 0.3f, 1.5f, BASE_DOOR_TIME2, SOPER_CONTINUE); - m_sound->AddEnvelope(m_soundChannel, 0.0f, 1.5f, 0.5f, SOPER_STOP); - - m_phase = ABP_CLOSE2; - m_progress = 0.0f; - m_speed = 1.0f/BASE_DOOR_TIME2; - return true; + return TakeOff(true); } if ( event.type != EVENT_FRAME ) return true; @@ -1444,3 +1400,56 @@ void CAutoBase::EndTransit() m_main->StartMusic(); } +Error CAutoBase::TakeOff(bool printMsg) +{ + + Event newEvent; + Math::Vector pos; + Error err; + + err = CheckCloseDoor(); + if ( err != ERR_OK ) + { + if(printMsg) m_main->DisplayError(err, m_object); + return err; + } + + err = m_main->CheckEndMission(false); + if ( err != ERR_OK ) + { + if(printMsg) m_main->DisplayError(err, m_object); + return err; + } + + FreezeCargo(true); // freeze whole cargo + m_main->SetMovieLock(true); // blocks everything until the end + m_main->DeselectAll(); + + newEvent.type = EVENT_UPDINTERFACE; + m_eventQueue->AddEvent(newEvent); + + m_camera->SetType(Gfx::CAM_TYPE_SCRIPT); + + pos = m_pos; + pos.x -= 110.0f; + m_terrain->AdjustToFloor(pos); + pos.y += 10.0f; + m_camera->SetScriptEye(pos); + m_posSound = pos; + + pos = m_object->GetPosition(0); + pos.y += 50.0f; + m_camera->SetScriptLookat(pos); + + m_engine->SetFocus(1.0f); + + m_soundChannel = m_sound->Play(SOUND_MANIP, m_posSound, 0.3f, 1.5f, true); + m_sound->AddEnvelope(m_soundChannel, 0.3f, 1.5f, BASE_DOOR_TIME2, SOPER_CONTINUE); + m_sound->AddEnvelope(m_soundChannel, 0.0f, 1.5f, 0.5f, SOPER_STOP); + + m_phase = ABP_CLOSE2; + m_progress = 0.0f; + m_speed = 1.0f/BASE_DOOR_TIME2; + return ERR_OK; +} + diff --git a/src/object/auto/autobase.h b/src/object/auto/autobase.h index 422f340..967e43d 100644 --- a/src/object/auto/autobase.h +++ b/src/object/auto/autobase.h @@ -77,6 +77,8 @@ public: Error GetError(); bool CreateInterface(bool bSelect); + + Error TakeOff(bool printMsg); protected: void UpdateInterface(); diff --git a/src/object/robotmain.cpp b/src/object/robotmain.cpp index 22e8152..47f06b3 100644 --- a/src/object/robotmain.cpp +++ b/src/object/robotmain.cpp @@ -881,6 +881,7 @@ CRobotMain::CRobotMain(CApplication* app, bool loadProfile) bc->AddFunction("busy", CScript::rBusy, CScript::cBusy); bc->AddFunction("factory", CScript::rFactory, CScript::cFactory); bc->AddFunction("research", CScript::rResearch, CScript::cClassOneFloat); + bc->AddFunction("takeoff", CScript::rTakeOff, CScript::cClassNull); bc->AddFunction("destroy", CScript::rDestroy, CScript::cClassNull); // Initializes the class FILE. -- cgit v1.2.3-1-g7c22 From 46a7aa98b092592a1d886ef60c662ffcf826611a Mon Sep 17 00:00:00 2001 From: krzys-h Date: Thu, 26 Dec 2013 19:36:17 +0100 Subject: Added error message when unable to load script from file specified in CreateObject --- src/object/robotmain.cpp | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'src/object') diff --git a/src/object/robotmain.cpp b/src/object/robotmain.cpp index 47f06b3..8b79c89 100644 --- a/src/object/robotmain.cpp +++ b/src/object/robotmain.cpp @@ -4546,13 +4546,6 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject) if (Cmd(line, "MissionController") && read[0] == 0 && m_version >= 2) { - /* TODO: ??? - if (!m_beginObject) - { - GetLogger()->Error("Syntax error in file '%s' (line %d): MissionController before BeginObject\n", filename, lineNum); - continue; - }*/ - m_controller = CreateObject(Math::Vector(0.0f, 0.0f, 0.0f), 0.0f, 1.0f, 0.0f, OBJECT_CONTROLLER, 100.0f, false, false, 0); m_controller->SetMagnifyDamage(100.0f); CBrain* brain = m_controller->GetBrain(); @@ -6021,7 +6014,9 @@ void CRobotMain::CompileScript(bool soluce) char* name = brain->GetScriptName(j); if (name[0] != 0) { - brain->ReadProgram(j, name); + if(! brain->ReadProgram(j, name)) { + CLogger::GetInstancePointer()->Error("Unable to read script from file \"%s\"\n", name); + } if (!brain->GetCompile(j)) nbError++; } } -- cgit v1.2.3-1-g7c22 From 8b121910c1f762cb83f438c9595ba98f6b4cbc2e Mon Sep 17 00:00:00 2001 From: krzys-h Date: Thu, 26 Dec 2013 19:39:32 +0100 Subject: Indentation fixes --- src/object/auto/autobase.cpp | 4 ++-- src/object/robotmain.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src/object') diff --git a/src/object/auto/autobase.cpp b/src/object/auto/autobase.cpp index 06b5dbb..25320d3 100644 --- a/src/object/auto/autobase.cpp +++ b/src/object/auto/autobase.cpp @@ -312,7 +312,7 @@ begin: if ( event.type == EVENT_OBJECT_BTAKEOFF ) { - return TakeOff(true); + return TakeOff(true); } if ( event.type != EVENT_FRAME ) return true; @@ -1405,7 +1405,7 @@ Error CAutoBase::TakeOff(bool printMsg) Event newEvent; Math::Vector pos; - Error err; + Error err; err = CheckCloseDoor(); if ( err != ERR_OK ) diff --git a/src/object/robotmain.cpp b/src/object/robotmain.cpp index 8b79c89..87b8311 100644 --- a/src/object/robotmain.cpp +++ b/src/object/robotmain.cpp @@ -6015,7 +6015,7 @@ void CRobotMain::CompileScript(bool soluce) if (name[0] != 0) { if(! brain->ReadProgram(j, name)) { - CLogger::GetInstancePointer()->Error("Unable to read script from file \"%s\"\n", name); + CLogger::GetInstancePointer()->Error("Unable to read script from file \"%s\"\n", name); } if (!brain->GetCompile(j)) nbError++; } -- cgit v1.2.3-1-g7c22 From 3a78d587bd781d7bd5429dc777522d43129952c1 Mon Sep 17 00:00:00 2001 From: krzys-h Date: Thu, 26 Dec 2013 21:54:05 +0100 Subject: Exit the game after finishing the mission while using -runscene --- src/object/robotmain.cpp | 8 ++++++++ src/object/robotmain.h | 2 ++ 2 files changed, 10 insertions(+) (limited to 'src/object') diff --git a/src/object/robotmain.cpp b/src/object/robotmain.cpp index 87b8311..da2ccc4 100644 --- a/src/object/robotmain.cpp +++ b/src/object/robotmain.cpp @@ -696,6 +696,8 @@ CRobotMain::CRobotMain(CApplication* app, bool loadProfile) m_endingWinRank = 0; m_endingLostRank = 0; m_winTerminate = false; + + m_exitAfterMission = true; m_joystickDeadzone = 0.2f; SetDefaultInputBindings(); @@ -945,6 +947,7 @@ Ui::CDisplayText* CRobotMain::GetDisplayText() void CRobotMain::LoadSceneOnStart(const std::string& name, int rank) { + m_exitAfterMission = true; // TODO: fix this ugly dependency :( m_dialog->SetSceneName(name.c_str()); m_dialog->SetSceneRank(rank); @@ -1747,10 +1750,14 @@ bool CRobotMain::ProcessEvent(Event &event) case EVENT_WIN: ChangePhase(PHASE_WIN); + if(m_exitAfterMission) + m_eventQueue->AddEvent(Event(EVENT_QUIT)); break; case EVENT_LOST: ChangePhase(PHASE_LOST); + if(m_exitAfterMission) + m_eventQueue->AddEvent(Event(EVENT_QUIT)); break; default: @@ -1787,6 +1794,7 @@ bool CRobotMain::ProcessEvent(Event &event) ChangePhase(PHASE_INIT); else ChangePhase(PHASE_TERM); + break; default: diff --git a/src/object/robotmain.h b/src/object/robotmain.h index 76535de..1a79457 100644 --- a/src/object/robotmain.h +++ b/src/object/robotmain.h @@ -522,6 +522,8 @@ protected: int m_endingWinRank; int m_endingLostRank; bool m_winTerminate; + + bool m_exitAfterMission; float m_fontSize; Math::Point m_windowPos; -- cgit v1.2.3-1-g7c22 From 0f57809f5112a6e4acbc2cb95d92be2cf6108a0c Mon Sep 17 00:00:00 2001 From: krzys-h Date: Thu, 26 Dec 2013 22:13:04 +0100 Subject: Added scene test mode ... and fixed a "small" bug in previous commit ;) --- src/object/robotmain.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/object') diff --git a/src/object/robotmain.cpp b/src/object/robotmain.cpp index da2ccc4..0ed5d07 100644 --- a/src/object/robotmain.cpp +++ b/src/object/robotmain.cpp @@ -697,7 +697,7 @@ CRobotMain::CRobotMain(CApplication* app, bool loadProfile) m_endingLostRank = 0; m_winTerminate = false; - m_exitAfterMission = true; + m_exitAfterMission = false; m_joystickDeadzone = 0.2f; SetDefaultInputBindings(); @@ -5082,6 +5082,9 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject) m_dialog->SetStackRead(""); RestoreNumericLocale(); + + if(m_app->GetSceneTestMode()) + m_eventQueue->AddEvent(Event(EVENT_WIN)); } //! Creates an object of decoration mobile or stationary -- cgit v1.2.3-1-g7c22 From 555c486fc63600dd5527346d1689a706dc33a45d Mon Sep 17 00:00:00 2001 From: krzys-h Date: Thu, 26 Dec 2013 22:33:17 +0100 Subject: Disable immediat SatCom when scene test is enabled --- src/object/robotmain.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/object') diff --git a/src/object/robotmain.cpp b/src/object/robotmain.cpp index 0ed5d07..0fc17f3 100644 --- a/src/object/robotmain.cpp +++ b/src/object/robotmain.cpp @@ -4064,6 +4064,7 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject) m_immediatSatCom = OpInt(line, "immediat", 0); if (m_version >= 2) m_beginSatCom = m_lockedSatCom = OpInt(line, "lock", 0); + if (m_app->GetSceneTestMode()) m_immediatSatCom = false; continue; } -- 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/object/robotmain.h | 1 - 1 file changed, 1 deletion(-) (limited to 'src/object') diff --git a/src/object/robotmain.h b/src/object/robotmain.h index 1a79457..b25a0a4 100644 --- a/src/object/robotmain.h +++ b/src/object/robotmain.h @@ -44,7 +44,6 @@ enum Phase PHASE_FREE, PHASE_TEEN, PHASE_USER, - PHASE_PROTO, PHASE_LOADING, PHASE_SIMUL, PHASE_MODEL, -- cgit v1.2.3-1-g7c22 From e9addb5a5e072b28eecfa1739ae38d67b68a2b23 Mon Sep 17 00:00:00 2001 From: krzys-h Date: Sat, 28 Dec 2013 12:30:46 +0100 Subject: Added smooth transition in music - issue #205 --- src/object/robotmain.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'src/object') diff --git a/src/object/robotmain.cpp b/src/object/robotmain.cpp index 0fc17f3..1fa3058 100644 --- a/src/object/robotmain.cpp +++ b/src/object/robotmain.cpp @@ -1072,7 +1072,7 @@ void CRobotMain::ChangePhase(Phase phase) if (m_phase == PHASE_SIMUL) // ends a simulation? { SaveAllScript(); - m_sound->StopMusic(); + m_sound->StopMusic(0.0f); m_camera->SetControllingObject(0); /* TODO: #if _SCHOOL @@ -1226,7 +1226,7 @@ void CRobotMain::ChangePhase(Phase phase) m_infoFilename[SATCOM_HUSTON][0] != 0) StartDisplayInfo(SATCOM_HUSTON, false); // shows the instructions - m_sound->StopMusic(); + m_sound->StopMusic(0.0f); if (!m_base || loading) StartMusic(); } @@ -6954,7 +6954,6 @@ void CRobotMain::UpdateAudio(bool frame) nb <= m_audioChange[t].max) { CLogger::GetInstancePointer()->Info("Changing music to \"%s\"\n", m_audioChange[t].music); - m_sound->StopMusic(); m_sound->PlayMusic(std::string(m_audioChange[t].music), m_audioChange[t].repeat); m_audioChange[t].changed = true; } @@ -7510,8 +7509,7 @@ void CRobotMain::StartMusic() CLogger::GetInstancePointer()->Debug("Starting music...\n"); if (m_audioTrack != "") { - m_sound->StopMusic(); - m_sound->PlayMusic(m_audioTrack, m_audioRepeat); + m_sound->PlayMusic(m_audioTrack, m_audioRepeat, 0.0f); } } -- cgit v1.2.3-1-g7c22 From dc81cda4b1f27af6fe8abcd566ffac03255f2642 Mon Sep 17 00:00:00 2001 From: krzys-h Date: Sun, 29 Dec 2013 12:08:59 +0100 Subject: Cleaned up creating objects --- src/object/objman.cpp | 7 +- src/object/objman.h | 2 +- src/object/robotmain.cpp | 350 ++--------------------------------------------- src/object/robotmain.h | 3 - 4 files changed, 13 insertions(+), 349 deletions(-) (limited to 'src/object') diff --git a/src/object/objman.cpp b/src/object/objman.cpp index e4102b8..0471ebf 100644 --- a/src/object/objman.cpp +++ b/src/object/objman.cpp @@ -63,10 +63,9 @@ CObject* CObjectManager::SearchInstance(int id) return m_table[id]; } -CObject* CObjectManager::CreateObject(Math::Vector pos, float angle, float zoom, float height, - ObjectType type, float power, - bool trainer, bool toy, - int option) +CObject* CObjectManager::CreateObject(Math::Vector pos, float angle, ObjectType type, + float power, float zoom, float height, + bool trainer, bool toy, int option) { CObject* object = nullptr; diff --git a/src/object/objman.h b/src/object/objman.h index 3087383..1d67468 100644 --- a/src/object/objman.h +++ b/src/object/objman.h @@ -44,7 +44,7 @@ public: //! Seeks for an object CObject* SearchInstance(int id); //! Creates an object - CObject* CreateObject(Math::Vector pos, float angle, float zoom, float height, ObjectType type, float power, bool trainer, bool toy, int option); + CObject* CreateObject(Math::Vector pos, float angle, ObjectType type, float power = -1.f, float zoom = 1.f, float height = 0.f, bool trainer = false, bool toy = false, int option = 0); protected: CObject* m_table[MAX_OBJECTS]; diff --git a/src/object/robotmain.cpp b/src/object/robotmain.cpp index 1fa3058..af463c7 100644 --- a/src/object/robotmain.cpp +++ b/src/object/robotmain.cpp @@ -2459,7 +2459,7 @@ void CRobotMain::StartDisplayVisit(EventType event) } Math::Vector goal = m_displayText->GetVisitGoal(event); - m_visitArrow = CreateObject(goal, 0.0f, 1.0f, 10.0f, OBJECT_SHOW, false, false, 0); + m_visitArrow = CObjectManager::GetInstancePointer()->CreateObject(goal, 0.0f, OBJECT_SHOW, -1.0f, 1.0f, 10.0f); m_visitPos = m_visitArrow->GetPosition(0); m_visitPosArrow = m_visitPos; @@ -4555,7 +4555,7 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject) if (Cmd(line, "MissionController") && read[0] == 0 && m_version >= 2) { - m_controller = CreateObject(Math::Vector(0.0f, 0.0f, 0.0f), 0.0f, 1.0f, 0.0f, OBJECT_CONTROLLER, 100.0f, false, false, 0); + m_controller = CObjectManager::GetInstancePointer()->CreateObject(Math::Vector(0.0f, 0.0f, 0.0f), 0.0f, OBJECT_CONTROLLER, 100.0f); m_controller->SetMagnifyDamage(100.0f); CBrain* brain = m_controller->GetBrain(); if (brain != nullptr) @@ -4614,13 +4614,14 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject) Math::Vector pos = OpPos(line, "pos")*g_unit; float dirAngle = OpFloat(line, "dir", 0.0f)*Math::PI; - bool trainer = OpInt(line, "trainer", 0); - CObject* obj = CreateObject(pos, dirAngle, - OpFloat(line, "z", 1.0f), - OpFloat(line, "h", 0.0f), + bool trainer; + CObject* obj = CObjectManager::GetInstancePointer()->CreateObject( + pos, dirAngle, type, OpFloat(line, "power", 1.0f), - trainer, + OpFloat(line, "z", 1.0f), + OpFloat(line, "h", 0.0f), + trainer = OpInt(line, "trainer", 0), OpInt(line, "toy", 0), OpInt(line, "option", 0)); @@ -5088,339 +5089,6 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject) m_eventQueue->AddEvent(Event(EVENT_WIN)); } -//! Creates an object of decoration mobile or stationary -CObject* CRobotMain::CreateObject(Math::Vector pos, float angle, float zoom, float height, - ObjectType type, float power, - bool trainer, bool toy, - int option) -{ - CObject* object = nullptr; - - if ( type == OBJECT_NULL ) return nullptr; - - if ( type == OBJECT_HUMAN || - type == OBJECT_TECH ) - { - trainer = false; // necessarily - } - - if ( type == OBJECT_PORTICO || - type == OBJECT_BASE || - type == OBJECT_DERRICK || - type == OBJECT_FACTORY || - type == OBJECT_STATION || - type == OBJECT_CONVERT || - type == OBJECT_REPAIR || - type == OBJECT_DESTROYER|| - type == OBJECT_TOWER || - type == OBJECT_NEST || - type == OBJECT_RESEARCH || - type == OBJECT_RADAR || - type == OBJECT_INFO || - type == OBJECT_ENERGY || - type == OBJECT_LABO || - type == OBJECT_NUCLEAR || - type == OBJECT_PARA || - type == OBJECT_SAFE || - type == OBJECT_HUSTON || - type == OBJECT_TARGET1 || - type == OBJECT_TARGET2 || - type == OBJECT_START || - type == OBJECT_END ) - { - object = new CObject(); - object->CreateBuilding(pos, angle, height, type, power); - - CAuto* automat = object->GetAuto(); - if (automat != nullptr) - { - automat->Init(); - } - } - else - if ( type == OBJECT_FRET || - type == OBJECT_STONE || - type == OBJECT_URANIUM || - type == OBJECT_METAL || - type == OBJECT_POWER || - type == OBJECT_ATOMIC || - type == OBJECT_BULLET || - type == OBJECT_BBOX || - type == OBJECT_KEYa || - type == OBJECT_KEYb || - type == OBJECT_KEYc || - type == OBJECT_KEYd || - type == OBJECT_TNT || - type == OBJECT_SCRAP1 || - type == OBJECT_SCRAP2 || - type == OBJECT_SCRAP3 || - type == OBJECT_SCRAP4 || - type == OBJECT_SCRAP5 || - type == OBJECT_BOMB || - type == OBJECT_WAYPOINT || - type == OBJECT_SHOW || - type == OBJECT_WINFIRE || - type == OBJECT_BAG || - type == OBJECT_MARKPOWER || - type == OBJECT_MARKSTONE || - type == OBJECT_MARKURANIUM || - type == OBJECT_MARKKEYa || - type == OBJECT_MARKKEYb || - type == OBJECT_MARKKEYc || - type == OBJECT_MARKKEYd || - type == OBJECT_EGG ) - { - object = new CObject(); - object->CreateResource(pos, angle, type, power); - } - else - if ( type == OBJECT_FLAGb || - type == OBJECT_FLAGr || - type == OBJECT_FLAGg || - type == OBJECT_FLAGy || - type == OBJECT_FLAGv ) - { - object = new CObject(); - object->CreateFlag(pos, angle, type); - } - else - if ( type == OBJECT_BARRIER0 || - type == OBJECT_BARRIER1 || - type == OBJECT_BARRIER2 || - type == OBJECT_BARRIER3 || - type == OBJECT_BARRIER4 ) - { - object = new CObject(); - object->CreateBarrier(pos, angle, height, type); - } - else - if ( type == OBJECT_PLANT0 || - type == OBJECT_PLANT1 || - type == OBJECT_PLANT2 || - type == OBJECT_PLANT3 || - type == OBJECT_PLANT4 || - type == OBJECT_PLANT5 || - type == OBJECT_PLANT6 || - type == OBJECT_PLANT7 || - type == OBJECT_PLANT8 || - type == OBJECT_PLANT9 || - type == OBJECT_PLANT10 || - type == OBJECT_PLANT11 || - type == OBJECT_PLANT12 || - type == OBJECT_PLANT13 || - type == OBJECT_PLANT14 || - type == OBJECT_PLANT15 || - type == OBJECT_PLANT16 || - type == OBJECT_PLANT17 || - type == OBJECT_PLANT18 || - type == OBJECT_PLANT19 || - type == OBJECT_TREE0 || - type == OBJECT_TREE1 || - type == OBJECT_TREE2 || - type == OBJECT_TREE3 || - type == OBJECT_TREE4 || - type == OBJECT_TREE5 || - type == OBJECT_TREE6 || - type == OBJECT_TREE7 || - type == OBJECT_TREE8 || - type == OBJECT_TREE9 ) - { - object = new CObject(); - object->CreatePlant(pos, angle, height, type); - } - else - if ( type == OBJECT_MUSHROOM0 || - type == OBJECT_MUSHROOM1 || - type == OBJECT_MUSHROOM2 || - type == OBJECT_MUSHROOM3 || - type == OBJECT_MUSHROOM4 || - type == OBJECT_MUSHROOM5 || - type == OBJECT_MUSHROOM6 || - type == OBJECT_MUSHROOM7 || - type == OBJECT_MUSHROOM8 || - type == OBJECT_MUSHROOM9 ) - { - object = new CObject(); - object->CreateMushroom(pos, angle, height, type); - } - else - if ( type == OBJECT_TEEN0 || - type == OBJECT_TEEN1 || - type == OBJECT_TEEN2 || - type == OBJECT_TEEN3 || - type == OBJECT_TEEN4 || - type == OBJECT_TEEN5 || - type == OBJECT_TEEN6 || - type == OBJECT_TEEN7 || - type == OBJECT_TEEN8 || - type == OBJECT_TEEN9 || - type == OBJECT_TEEN10 || - type == OBJECT_TEEN11 || - type == OBJECT_TEEN12 || - type == OBJECT_TEEN13 || - type == OBJECT_TEEN14 || - type == OBJECT_TEEN15 || - type == OBJECT_TEEN16 || - type == OBJECT_TEEN17 || - type == OBJECT_TEEN18 || - type == OBJECT_TEEN19 || - type == OBJECT_TEEN20 || - type == OBJECT_TEEN21 || - type == OBJECT_TEEN22 || - type == OBJECT_TEEN23 || - type == OBJECT_TEEN24 || - type == OBJECT_TEEN25 || - type == OBJECT_TEEN26 || - type == OBJECT_TEEN27 || - type == OBJECT_TEEN28 || - type == OBJECT_TEEN29 || - type == OBJECT_TEEN30 || - type == OBJECT_TEEN31 || - type == OBJECT_TEEN32 || - type == OBJECT_TEEN33 || - type == OBJECT_TEEN34 || - type == OBJECT_TEEN35 || - type == OBJECT_TEEN36 || - type == OBJECT_TEEN37 || - type == OBJECT_TEEN38 || - type == OBJECT_TEEN39 || - type == OBJECT_TEEN40 || - type == OBJECT_TEEN41 || - type == OBJECT_TEEN42 || - type == OBJECT_TEEN43 || - type == OBJECT_TEEN44 || - type == OBJECT_TEEN45 || - type == OBJECT_TEEN46 || - type == OBJECT_TEEN47 || - type == OBJECT_TEEN48 || - type == OBJECT_TEEN49 ) - { - object = new CObject(); - object->SetOption(option); - object->CreateTeen(pos, angle, zoom, height, type); - } - else - if ( type == OBJECT_QUARTZ0 || - type == OBJECT_QUARTZ1 || - type == OBJECT_QUARTZ2 || - type == OBJECT_QUARTZ3 || - type == OBJECT_QUARTZ4 || - type == OBJECT_QUARTZ5 || - type == OBJECT_QUARTZ6 || - type == OBJECT_QUARTZ7 || - type == OBJECT_QUARTZ8 || - type == OBJECT_QUARTZ9 ) - { - object = new CObject(); - object->CreateQuartz(pos, angle, height, type); - } - else - if ( type == OBJECT_ROOT0 || - type == OBJECT_ROOT1 || - type == OBJECT_ROOT2 || - type == OBJECT_ROOT3 || - type == OBJECT_ROOT4 || - type == OBJECT_ROOT5 || - type == OBJECT_ROOT6 || - type == OBJECT_ROOT7 || - type == OBJECT_ROOT8 || - type == OBJECT_ROOT9 ) - { - object = new CObject(); - object->CreateRoot(pos, angle, height, type); - } - else - if ( type == OBJECT_HOME1 ) - { - object = new CObject(); - object->CreateHome(pos, angle, height, type); - } - else - if ( type == OBJECT_RUINmobilew1 || - type == OBJECT_RUINmobilew2 || - type == OBJECT_RUINmobilet1 || - type == OBJECT_RUINmobilet2 || - type == OBJECT_RUINmobiler1 || - type == OBJECT_RUINmobiler2 || - type == OBJECT_RUINfactory || - type == OBJECT_RUINdoor || - type == OBJECT_RUINsupport || - type == OBJECT_RUINradar || - type == OBJECT_RUINconvert || - type == OBJECT_RUINbase || - type == OBJECT_RUINhead ) - { - object = new CObject(); - object->CreateRuin(pos, angle, height, type); - } - else - if ( type == OBJECT_APOLLO1 || - type == OBJECT_APOLLO3 || - type == OBJECT_APOLLO4 || - type == OBJECT_APOLLO5 ) - { - object = new CObject(); - object->CreateApollo(pos, angle, type); - } - else - if ( type == OBJECT_MOTHER || - type == OBJECT_ANT || - type == OBJECT_SPIDER || - type == OBJECT_BEE || - type == OBJECT_WORM ) - { - object = new CObject(); - object->CreateInsect(pos, angle, type); // no eggs - } - else - if ( type == OBJECT_HUMAN || - type == OBJECT_TECH || - type == OBJECT_TOTO || - type == OBJECT_MOBILEfa || - type == OBJECT_MOBILEta || - type == OBJECT_MOBILEwa || - type == OBJECT_MOBILEia || - type == OBJECT_MOBILEfc || - type == OBJECT_MOBILEtc || - type == OBJECT_MOBILEwc || - type == OBJECT_MOBILEic || - type == OBJECT_MOBILEfi || - type == OBJECT_MOBILEti || - type == OBJECT_MOBILEwi || - type == OBJECT_MOBILEii || - type == OBJECT_MOBILEfs || - type == OBJECT_MOBILEts || - type == OBJECT_MOBILEws || - type == OBJECT_MOBILEis || - type == OBJECT_MOBILErt || - type == OBJECT_MOBILErc || - type == OBJECT_MOBILErr || - type == OBJECT_MOBILErs || - type == OBJECT_MOBILEsa || - type == OBJECT_MOBILEtg || - type == OBJECT_MOBILEft || - type == OBJECT_MOBILEtt || - type == OBJECT_MOBILEwt || - type == OBJECT_MOBILEit || - type == OBJECT_MOBILEdr || - type == OBJECT_APOLLO2 || - type == OBJECT_CONTROLLER ) - { - object = new CObject(); - object->SetOption(option); - object->CreateVehicle(pos, angle, type, power, trainer, toy); - } - - if (m_fixScene && type == OBJECT_HUMAN) - { - CMotion* motion = object->GetMotion(); - if (m_phase == PHASE_WIN ) motion->SetAction(MHS_WIN, 0.4f); - if (m_phase == PHASE_LOST) motion->SetAction(MHS_LOST, 0.5f); - } - - return object; -} - //! Creates a directional light int CRobotMain::CreateLight(Math::Vector direction, Gfx::Color color) { @@ -6510,7 +6178,7 @@ CObject* CRobotMain::IOReadObject(char *line, const char* filename, int objRank) int toy = OpInt(line, "toy", 0); int option = OpInt(line, "option", 0); - CObject* obj = CreateObject(pos, dir.y, 1.0f, 0.0f, type, 0.0f, trainer, toy, option); + CObject* obj = CObjectManager::GetInstancePointer()->CreateObject(pos, dir.y, type, 0.0f, 1.0f, 0.0f, trainer, toy, option); obj->SetDefRank(objRank); obj->SetPosition(0, pos); obj->SetAngle(0, dir); diff --git a/src/object/robotmain.h b/src/object/robotmain.h index b25a0a4..c300b5a 100644 --- a/src/object/robotmain.h +++ b/src/object/robotmain.h @@ -390,9 +390,6 @@ protected: void CreateScene(bool soluce, bool fixScene, bool resetObject); Math::Vector LookatPoint(Math::Vector eye, float angleH, float angleV, float length); - CObject* CreateObject(Math::Vector pos, float angle, float zoom, - float height, ObjectType type, float power=1.0f, - bool trainer=false, bool toy=false, int option=0); int CreateLight(Math::Vector direction, Gfx::Color color); void HiliteClear(); void HiliteObject(Math::Point pos); -- cgit v1.2.3-1-g7c22 From a36450a6dae20912ba89a9c49e8b951a20a32bfb Mon Sep 17 00:00:00 2001 From: krzys-h Date: Sun, 29 Dec 2013 15:03:21 +0100 Subject: Added tool= i drive= --- src/object/object.cpp | 67 +++++++++++++++++++++++++++++++++++++++++ src/object/object.h | 77 ++++++++++++++++++++++++++++++------------------ src/object/robotmain.cpp | 20 +++++++++++-- src/object/robotmain.h | 4 +++ 4 files changed, 138 insertions(+), 30 deletions(-) (limited to 'src/object') diff --git a/src/object/object.cpp b/src/object/object.cpp index f1de424..2c32da0 100644 --- a/src/object/object.cpp +++ b/src/object/object.cpp @@ -7390,3 +7390,70 @@ void CObject::SetTraceWidth(float width) mv->SetTraceWidth(width); } +DriveType CObject::GetDriveFromObject(ObjectType type) +{ + switch(type) { + case OBJECT_MOBILEwt: + case OBJECT_MOBILEwa: + case OBJECT_MOBILEwc: + case OBJECT_MOBILEwi: + case OBJECT_MOBILEws: + return DRIVE_WHEELED; + + case OBJECT_MOBILEtt: + case OBJECT_MOBILEta: + case OBJECT_MOBILEtc: + case OBJECT_MOBILEti: + case OBJECT_MOBILEts: + return DRIVE_TRACKED; + + case OBJECT_MOBILEft: + case OBJECT_MOBILEfa: + case OBJECT_MOBILEfc: + case OBJECT_MOBILEfi: + case OBJECT_MOBILEfs: + return DRIVE_WINGED; + + case OBJECT_MOBILEit: + case OBJECT_MOBILEia: + case OBJECT_MOBILEic: + case OBJECT_MOBILEii: + case OBJECT_MOBILEis: + return DRIVE_LEGGED; + + default: + return DRIVE_OTHER; + } +} + +ToolType CObject::GetToolFromObject(ObjectType type) +{ + switch(type) { + case OBJECT_MOBILEwa: + case OBJECT_MOBILEta: + case OBJECT_MOBILEfa: + case OBJECT_MOBILEia: + return TOOL_GRABBER; + + case OBJECT_MOBILEws: + case OBJECT_MOBILEts: + case OBJECT_MOBILEfs: + case OBJECT_MOBILEis: + return TOOL_SNIFFER; + + case OBJECT_MOBILEwc: + case OBJECT_MOBILEtc: + case OBJECT_MOBILEfc: + case OBJECT_MOBILEic: + return TOOL_SHOOTER; + + case OBJECT_MOBILEwi: + case OBJECT_MOBILEti: + case OBJECT_MOBILEfi: + case OBJECT_MOBILEii: + return TOOL_ORGASHOOTER; + + default: + return TOOL_OTHER; + } +} diff --git a/src/object/object.h b/src/object/object.h index b5c0385..64689eb 100644 --- a/src/object/object.h +++ b/src/object/object.h @@ -125,34 +125,34 @@ enum ObjectType OBJECT_TREE7 = 97, //! < tree 7 OBJECT_TREE8 = 98, //! < tree 8 OBJECT_TREE9 = 99, //! < tree 9 - OBJECT_MOBILEwt = 100, //! < wheel-trainer - OBJECT_MOBILEtt = 101, //! < track-trainer - OBJECT_MOBILEft = 102, //! < fly-trainer - OBJECT_MOBILEit = 103, //! < insect-trainer - OBJECT_MOBILEwa = 110, //! < wheel-arm - OBJECT_MOBILEta = 111, //! < track-arm - OBJECT_MOBILEfa = 112, //! < fly-arm - OBJECT_MOBILEia = 113, //! < insect-arm - OBJECT_MOBILEwc = 120, //! < wheel-cannon - OBJECT_MOBILEtc = 121, //! < track-cannon - OBJECT_MOBILEfc = 122, //! < fly-cannon - OBJECT_MOBILEic = 123, //! < insect-cannon - OBJECT_MOBILEwi = 130, //! < wheel-insect-cannon - OBJECT_MOBILEti = 131, //! < track-insect-cannon - OBJECT_MOBILEfi = 132, //! < fly-insect-cannon - OBJECT_MOBILEii = 133, //! < insect-insect-cannon - OBJECT_MOBILEws = 140, //! < wheel-search - OBJECT_MOBILEts = 141, //! < track-search - OBJECT_MOBILEfs = 142, //! < fly-search - OBJECT_MOBILEis = 143, //! < insect-search - OBJECT_MOBILErt = 200, //! < roller-terraform - OBJECT_MOBILErc = 201, //! < roller-canon - OBJECT_MOBILErr = 202, //! < roller-recover - OBJECT_MOBILErs = 203, //! < roller-shield - OBJECT_MOBILEsa = 210, //! < submarine - OBJECT_MOBILEtg = 211, //! < training target - OBJECT_MOBILEdr = 212, //! < robot drawing - OBJECT_CONTROLLER = 213, //! < mission controller + OBJECT_MOBILEwt = 100, //! < PracticeBot + OBJECT_MOBILEtt = 101, //! < track-trainer (unused) + OBJECT_MOBILEft = 102, //! < fly-trainer (unused) + OBJECT_MOBILEit = 103, //! < insect-trainer (unused) + OBJECT_MOBILEwa = 110, //! < WheeledGrabber + OBJECT_MOBILEta = 111, //! < TrackedGrabber + OBJECT_MOBILEfa = 112, //! < WingedGrabber + OBJECT_MOBILEia = 113, //! < LeggedGrabber + OBJECT_MOBILEwc = 120, //! < WheeledShooter + OBJECT_MOBILEtc = 121, //! < TrackedShooter + OBJECT_MOBILEfc = 122, //! < WingedShooter + OBJECT_MOBILEic = 123, //! < LeggedShooter + OBJECT_MOBILEwi = 130, //! < WheeledOrgaShooter + OBJECT_MOBILEti = 131, //! < TrackedOrgaShooter + OBJECT_MOBILEfi = 132, //! < WingedOrgaShooter + OBJECT_MOBILEii = 133, //! < LeggedOrgaShooter + OBJECT_MOBILEws = 140, //! < WheeledSniffer + OBJECT_MOBILEts = 141, //! < TrackedSniffer + OBJECT_MOBILEfs = 142, //! < WingedSniffer + OBJECT_MOBILEis = 143, //! < LeggedSniffer + OBJECT_MOBILErt = 200, //! < Thumper + OBJECT_MOBILErc = 201, //! < PhazerShooter + OBJECT_MOBILErr = 202, //! < Recycler + OBJECT_MOBILErs = 203, //! < Shielder + OBJECT_MOBILEsa = 210, //! < Subber + OBJECT_MOBILEtg = 211, //! < TargetBot + OBJECT_MOBILEdr = 212, //! < Scribbler + OBJECT_CONTROLLER = 213, //! < MissionController OBJECT_WAYPOINT = 250, //! < waypoint OBJECT_FLAGb = 260, //! < blue flag OBJECT_FLAGr = 261, //! < red flag @@ -311,6 +311,24 @@ enum ObjectMaterial OM_MINERAL = 5, // stone }; +enum DriveType +{ + DRIVE_OTHER = 0, + DRIVE_WHEELED, + DRIVE_TRACKED, + DRIVE_WINGED, + DRIVE_LEGGED, +}; + +enum ToolType +{ + TOOL_OTHER = 0, + TOOL_GRABBER, + TOOL_SNIFFER, + TOOL_SHOOTER, + TOOL_ORGASHOOTER, +}; + struct ObjectPart { char bUsed; @@ -659,6 +677,9 @@ public: void SetTraceWidth(float width); std::string GetModelDirName(); + + static DriveType GetDriveFromObject(ObjectType type); + static ToolType GetToolFromObject(ObjectType type); protected: bool EventFrame(const Event &event); diff --git a/src/object/robotmain.cpp b/src/object/robotmain.cpp index af463c7..0852df0 100644 --- a/src/object/robotmain.cpp +++ b/src/object/robotmain.cpp @@ -4131,6 +4131,8 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject) m_audioChange[i].max = OpInt(line, "max", 9999); m_audioChange[i].powermin = OpFloat(line, "powermin", -1); m_audioChange[i].powermax = OpFloat(line, "powermax", 100); + m_audioChange[i].tool = OpTool(line, "tool"); + m_audioChange[i].drive = OpDrive(line, "drive"); OpString(line, "filename", m_audioChange[i].music); m_audioChange[i].repeat = OpInt(line, "repeat", 1); m_audioChange[i].changed = false; @@ -4928,11 +4930,15 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject) { m_endTake[i].powermin = OpFloat(line, "powermin", -1); m_endTake[i].powermax = OpFloat(line, "powermax", 100); + m_endTake[i].tool = OpTool(line, "tool"); + m_endTake[i].drive = OpDrive(line, "drive"); } else { m_endTake[i].powermin = -1; m_endTake[i].powermax = 100; + m_endTake[i].tool = TOOL_OTHER; + m_endTake[i].drive = DRIVE_OTHER; } m_endTake[i].lost = OpInt(line, "lost", -1); m_endTake[i].immediat = OpInt(line, "immediat", 0); @@ -6594,8 +6600,13 @@ void CRobotMain::UpdateAudio(bool frame) { type = OBJECT_SCRAP1; } + + ToolType tool = CObject::GetToolFromObject(type); + DriveType drive = CObject::GetDriveFromObject(type); + if (m_audioChange[t].tool != TOOL_OTHER) if(tool != m_audioChange[t].tool) continue; + if (m_audioChange[t].drive != DRIVE_OTHER) if(drive != m_audioChange[t].drive) continue; - if (type != m_audioChange[t].type) continue; + if (m_audioChange[t].tool == TOOL_OTHER && m_audioChange[t].drive == DRIVE_OTHER) if (type != m_audioChange[t].type) continue; float energyLevel = -1; CObject* power = obj->GetPower(); @@ -6699,7 +6710,12 @@ Error CRobotMain::CheckEndMission(bool frame) type = OBJECT_SCRAP1; } - if (type != m_endTake[t].type) continue; + ToolType tool = CObject::GetToolFromObject(type); + DriveType drive = CObject::GetDriveFromObject(type); + if (m_endTake[t].tool != TOOL_OTHER) if(tool != m_endTake[t].tool) continue; + if (m_endTake[t].drive != DRIVE_OTHER) if(drive != m_endTake[t].drive) continue; + + if (m_endTake[t].tool == TOOL_OTHER && m_endTake[t].drive == DRIVE_OTHER) if (type != m_endTake[t].type) continue; float energyLevel = -1; CObject* power = obj->GetPower(); diff --git a/src/object/robotmain.h b/src/object/robotmain.h index c300b5a..8d58adb 100644 --- a/src/object/robotmain.h +++ b/src/object/robotmain.h @@ -103,6 +103,8 @@ struct EndTake int lost; // lost if <= float powermin; // wins if energy cell >= float powermax; // wins if energy cell <= + ToolType tool; + DriveType drive; bool immediat; char message[100]; }; @@ -116,6 +118,8 @@ struct AudioChange int max; // change if < float powermin; // change if energy cell >= float powermax; // change if energy cell <= + ToolType tool; + DriveType drive; char music[100]; bool repeat; bool changed; -- cgit v1.2.3-1-g7c22 From 3536f1c7cc52792a7d833b4f823aa515dc00d933 Mon Sep 17 00:00:00 2001 From: krzys-h Date: Mon, 30 Dec 2013 10:51:29 +0100 Subject: Added CObjectManager::Flush() Possible fix for #275 --- src/object/objman.cpp | 16 ++++++++++++---- src/object/objman.h | 4 +++- src/object/robotmain.cpp | 6 ++++++ 3 files changed, 21 insertions(+), 5 deletions(-) (limited to 'src/object') diff --git a/src/object/objman.cpp b/src/object/objman.cpp index 0471ebf..131d007 100644 --- a/src/object/objman.cpp +++ b/src/object/objman.cpp @@ -30,7 +30,7 @@ CObjectManager::CObjectManager() { m_table[i] = nullptr; } - usedCount = 0; + m_usedCount = 0; } CObjectManager::~CObjectManager() @@ -39,16 +39,16 @@ CObjectManager::~CObjectManager() bool CObjectManager::AddInstance(CObject* instance) { - if (usedCount >= MAX_OBJECTS) return false; + if (m_usedCount >= MAX_OBJECTS) return false; m_table[instance->GetID()] = instance; - usedCount++; + m_usedCount++; return true; } bool CObjectManager::DeleteInstance(CObject* instance) { - for (int i = 0; i < usedCount; i++) + for (int i = 0; i < m_usedCount; i++) { if (m_table[i] == instance) m_table[i] = nullptr; @@ -386,3 +386,11 @@ CObject* CObjectManager::CreateObject(Math::Vector pos, float angle, ObjectType return object; } +void CObjectManager::Flush() +{ + for (int i = 0; i < MAX_OBJECTS; i++) + { + m_table[i] = nullptr; + } + m_usedCount = 0; +} diff --git a/src/object/objman.h b/src/object/objman.h index 1d67468..390587b 100644 --- a/src/object/objman.h +++ b/src/object/objman.h @@ -45,9 +45,11 @@ public: CObject* SearchInstance(int id); //! Creates an object CObject* CreateObject(Math::Vector pos, float angle, ObjectType type, float power = -1.f, float zoom = 1.f, float height = 0.f, bool trainer = false, bool toy = false, int option = 0); + //! Removes all objects + void Flush(); protected: CObject* m_table[MAX_OBJECTS]; - int usedCount; + int m_usedCount; }; diff --git a/src/object/robotmain.cpp b/src/object/robotmain.cpp index 0852df0..308b172 100644 --- a/src/object/robotmain.cpp +++ b/src/object/robotmain.cpp @@ -1148,6 +1148,8 @@ void CRobotMain::ChangePhase(Phase phase) iMan->Flush(CLASS_PHYSICS); iMan->Flush(CLASS_BRAIN); iMan->Flush(CLASS_PYRO); + + CObjectManager::GetInstancePointer()->Flush(); Math::Point dim, pos; @@ -3869,6 +3871,8 @@ void CRobotMain::ScenePerso() iMan->Flush(CLASS_PHYSICS); iMan->Flush(CLASS_BRAIN); iMan->Flush(CLASS_PYRO); + + CObjectManager::GetInstancePointer()->Flush(); m_dialog->SetSceneName("perso"); m_dialog->SetSceneRank(0); @@ -6546,6 +6550,8 @@ void CRobotMain::ResetCreate() iMan->Flush(CLASS_PHYSICS); iMan->Flush(CLASS_BRAIN); iMan->Flush(CLASS_PYRO); + + CObjectManager::GetInstancePointer()->Flush(); m_camera->SetType(Gfx::CAM_TYPE_DIALOG); -- 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/object/robotmain.cpp | 44 +++++++++++++++++++++++--------------------- src/object/robotmain.h | 6 ++++-- 2 files changed, 27 insertions(+), 23 deletions(-) (limited to 'src/object') diff --git a/src/object/robotmain.cpp b/src/object/robotmain.cpp index 308b172..f1923a5 100644 --- a/src/object/robotmain.cpp +++ b/src/object/robotmain.cpp @@ -618,6 +618,7 @@ CRobotMain::CRobotMain(CApplication* app, bool loadProfile) m_cloud = m_engine->GetCloud(); m_lightning = m_engine->GetLightning(); m_planet = m_engine->GetPlanet(); + m_pause = CPauseManager::GetInstancePointer(); m_interface = new Ui::CInterface(); m_terrain = new Gfx::CTerrain(); @@ -663,7 +664,6 @@ CRobotMain::CRobotMain(CApplication* app, bool loadProfile) m_satComLock = false; m_editLock = false; m_editFull = false; - m_pause = false; m_hilite = false; m_freePhoto = false; m_showPos = false; @@ -1110,7 +1110,7 @@ void CRobotMain::ChangePhase(Phase phase) m_resetCreate = false; m_engine->SetMovieLock(m_movieLock); - ChangePause(false); + ChangePause(PAUSE_NONE); FlushDisplayInfo(); m_engine->SetRankView(0); m_terrain->FlushRelief(); @@ -1387,7 +1387,7 @@ bool CRobotMain::ProcessEvent(Event &event) MainMovieType type = m_movie->GetStopType(); if (type == MM_SATCOMopen) { - ChangePause(false); + ChangePause(PAUSE_NONE); SelectObject(m_infoObject, false); // hands over the command buttons m_map->ShowMap(m_mapShow); m_displayText->HideText(false); @@ -1419,7 +1419,7 @@ bool CRobotMain::ProcessEvent(Event &event) if (pe == nullptr) return false; pe->SetState(Ui::STATE_VISIBLE); pe->SetFocus(true); - if (m_phase == PHASE_SIMUL) ChangePause(true); + if (m_phase == PHASE_SIMUL) ChangePause(PAUSE_CHEAT); m_cmdEdit = true; return false; } @@ -1432,7 +1432,7 @@ bool CRobotMain::ProcessEvent(Event &event) pe->GetText(cmd, 50); pe->SetText(""); pe->ClearState(Ui::STATE_VISIBLE); - if (m_phase == PHASE_SIMUL) ChangePause(false); + if (m_phase == PHASE_SIMUL) ChangePause(PAUSE_NONE); ExecuteCmd(cmd); m_cmdEdit = false; return false; @@ -1562,7 +1562,7 @@ bool CRobotMain::ProcessEvent(Event &event) m_camera->GetType() != Gfx::CAM_TYPE_VISIT && !m_movie->IsExist()) { - ChangePause(!m_engine->GetPause()); + ChangePause(m_pause->GetPause(PAUSE_USER) ? PAUSE_NONE : PAUSE_USER); } } if (event.key.key == GetInputBinding(INPUT_SLOT_CAMERA).primary || @@ -1891,12 +1891,12 @@ void CRobotMain::ExecuteCmd(char *cmd) if (m_freePhoto) { m_camera->SetType(Gfx::CAM_TYPE_FREE); - ChangePause(true); + ChangePause(PAUSE_PHOTO); } else { m_camera->SetType(Gfx::CAM_TYPE_BACK); - ChangePause(false); + ChangePause(PAUSE_NONE); } return; } @@ -1907,7 +1907,7 @@ void CRobotMain::ExecuteCmd(char *cmd) if (m_freePhoto) { m_camera->SetType(Gfx::CAM_TYPE_FREE); - ChangePause(true); + ChangePause(PAUSE_PHOTO); DeselectAll(); // removes the control buttons m_map->ShowMap(false); m_displayText->HideText(true); @@ -1915,7 +1915,7 @@ void CRobotMain::ExecuteCmd(char *cmd) else { m_camera->SetType(Gfx::CAM_TYPE_BACK); - ChangePause(false); + ChangePause(PAUSE_NONE); m_map->ShowMap(m_mapShow); m_displayText->HideText(false); } @@ -2174,7 +2174,7 @@ void CRobotMain::StartDisplayInfo(int index, bool movie) { m_movieInfoIndex = index; m_movie->Start(MM_SATCOMopen, 2.5f); - ChangePause(true); + ChangePause(PAUSE_SATCOM); m_infoObject = DeselectAll(); // removes the control buttons m_displayText->HideText(true); return; @@ -2184,7 +2184,7 @@ void CRobotMain::StartDisplayInfo(int index, bool movie) if (m_movie->IsExist()) { m_movie->Stop(); - ChangePause(false); + ChangePause(PAUSE_NONE); SelectObject(m_infoObject, false); // hands over the command buttons m_displayText->HideText(false); } @@ -2476,7 +2476,7 @@ void CRobotMain::StartDisplayVisit(EventType event) m_camera->StartVisit(m_displayText->GetVisitGoal(event), m_displayText->GetVisitDist(event)); m_displayText->SetVisit(event); - ChangePause(true); + ChangePause(PAUSE_VISIT); } //! Move the arrow to visit @@ -2530,7 +2530,7 @@ void CRobotMain::StopDisplayVisit() m_camera->StopVisit(); m_displayText->ClearVisit(); - ChangePause(false); + ChangePause(PAUSE_NONE); if (m_visitObject != 0) { SelectObject(m_visitObject, false); // gives the command buttons @@ -2628,7 +2628,7 @@ bool CRobotMain::SelectObject(CObject* obj, bool displayError) if (m_camera->GetType() == Gfx::CAM_TYPE_VISIT) StopDisplayVisit(); - if (m_movieLock || m_editLock || m_pause) return false; + if (m_movieLock || m_editLock || m_pause->GetPause()) return false; if (m_movie->IsExist()) return false; if (obj == nullptr || !IsSelectable(obj)) return false; @@ -3530,7 +3530,7 @@ bool CRobotMain::EventFrame(const Event &event) } // Moves edition indicator. - if (m_editLock || m_pause) // edition in progress? + if (m_editLock || m_pause->GetPause()) // edition in progress? { Ui::CControl* pc = m_interface->SearchControl(EVENT_OBJECT_EDITLOCK); if (pc != nullptr) @@ -7022,14 +7022,16 @@ float CRobotMain::GetPersoAngle() //! Changes on the pause mode -void CRobotMain::ChangePause(bool pause) +void CRobotMain::ChangePause(PauseType pause) { - m_pause = pause; - m_engine->SetPause(m_pause); + if(pause != PAUSE_NONE) + m_pause->SetPause(pause); + else + m_pause->ClearPause(); - m_sound->MuteAll(m_pause); + m_sound->MuteAll(m_pause->GetPause()); CreateShortcuts(); - if (m_pause) HiliteClear(); + if (m_pause->GetPause()) HiliteClear(); } diff --git a/src/object/robotmain.h b/src/object/robotmain.h index 8d58adb..4fa842a 100644 --- a/src/object/robotmain.h +++ b/src/object/robotmain.h @@ -30,6 +30,8 @@ #include "object/object.h" #include "object/mainmovie.h" +#include "app/pausemanager.h" + #include enum Phase @@ -253,7 +255,7 @@ public: void SetTracePrecision(float factor); float GetTracePrecision(); - void ChangePause(bool pause); + void ChangePause(PauseType pause); void SetSpeed(float speed); float GetSpeed(); @@ -440,6 +442,7 @@ protected: Ui::CDisplayText* m_displayText; Ui::CDisplayInfo* m_displayInfo; CSoundInterface* m_sound; + CPauseManager* m_pause; //! Bindings for user inputs InputBinding m_inputBindings[INPUT_SLOT_MAX]; @@ -495,7 +498,6 @@ protected: bool m_satComLock; // call of SatCom is possible? bool m_editLock; // edition in progress? bool m_editFull; // edition in full screen? - bool m_pause; // simulation paused bool m_hilite; bool m_trainerPilot; // remote trainer? bool m_suspend; -- cgit v1.2.3-1-g7c22 From 999490e88bc699b671b94b88c9a4327d963db378 Mon Sep 17 00:00:00 2001 From: krzys-h Date: Tue, 31 Dec 2013 16:58:21 +0100 Subject: Code for changing music in pause mode As requested by @Emxx52. Only code for now, we don't have the music yet. Temporairly in developements builds music will change to Prototype (in CBot editor) and Constructive Destruction (in SatCom) --- src/object/robotmain.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/object') diff --git a/src/object/robotmain.cpp b/src/object/robotmain.cpp index f1923a5..f8db286 100644 --- a/src/object/robotmain.cpp +++ b/src/object/robotmain.cpp @@ -2174,7 +2174,7 @@ void CRobotMain::StartDisplayInfo(int index, bool movie) { m_movieInfoIndex = index; m_movie->Start(MM_SATCOMopen, 2.5f); - ChangePause(PAUSE_SATCOM); + ChangePause(PAUSE_SATCOMMOVIE); m_infoObject = DeselectAll(); // removes the control buttons m_displayText->HideText(true); return; -- cgit v1.2.3-1-g7c22 From 90437d1765eaf8b17cb9575632cb95739cfe80c2 Mon Sep 17 00:00:00 2001 From: krzys-h Date: Wed, 1 Jan 2014 16:45:08 +0100 Subject: Fixed two bugs in dc81cda4b1f27af6fe8abcd566ffac03255f2642 * win/end scene animations * produce() was producing empty cells --- src/object/robotmain.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/object') diff --git a/src/object/robotmain.cpp b/src/object/robotmain.cpp index f8db286..0d95907 100644 --- a/src/object/robotmain.cpp +++ b/src/object/robotmain.cpp @@ -4630,6 +4630,13 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject) trainer = OpInt(line, "trainer", 0), OpInt(line, "toy", 0), OpInt(line, "option", 0)); + + if (m_fixScene && type == OBJECT_HUMAN) + { + CMotion* motion = obj->GetMotion(); + if (m_phase == PHASE_WIN ) motion->SetAction(MHS_WIN, 0.4f); + if (m_phase == PHASE_LOST) motion->SetAction(MHS_LOST, 0.5f); + } if (obj != nullptr) { -- cgit v1.2.3-1-g7c22 From 59935b470674ae26342fd4145f9cba85a1cd9443 Mon Sep 17 00:00:00 2001 From: krzys-h Date: Wed, 1 Jan 2014 17:33:19 +0100 Subject: Changed comments in ObjectType to be object categories; removed unused SEAWEED --- src/object/object.h | 412 +++++++++++++++++++++++++--------------------------- 1 file changed, 201 insertions(+), 211 deletions(-) (limited to 'src/object') diff --git a/src/object/object.h b/src/object/object.h index 64689eb..d5a073c 100644 --- a/src/object/object.h +++ b/src/object/object.h @@ -47,84 +47,84 @@ enum ObjectType { OBJECT_NULL = 0, //! < object destroyed OBJECT_FIX = 1, //! < stationary scenery - OBJECT_PORTICO = 2, //! < gantry - OBJECT_BASE = 3, //! < great main base - OBJECT_DERRICK = 4, //! < derrick set - OBJECT_FACTORY = 5, //! < factory set - OBJECT_STATION = 6, //! < recharging station - OBJECT_CONVERT = 7, //! < converter station - OBJECT_REPAIR = 8, //! < reparation - OBJECT_TOWER = 9, //! < defense tower - OBJECT_NEST = 10, //! < nest - OBJECT_RESEARCH = 11, //! < research center - OBJECT_RADAR = 12, //! < radar - OBJECT_ENERGY = 13, //! < energy factory - OBJECT_LABO = 14, //! < analytical laboratory for insect - OBJECT_NUCLEAR = 15, //! < nuclear power plant - OBJECT_START = 16, //! < starting - OBJECT_END = 17, //! < finish - OBJECT_INFO = 18, //! < information terminal - OBJECT_PARA = 19, //! < lightning conductor - OBJECT_TARGET1 = 20, //! < gate target - OBJECT_TARGET2 = 21, //! < center target - OBJECT_SAFE = 22, //! < safe - OBJECT_HUSTON = 23, //! < control centre - OBJECT_DESTROYER = 24, //! < destroyer - OBJECT_FRET = 30, //! < transportable - OBJECT_STONE = 31, //! < stone - OBJECT_URANIUM = 32, //! < uranium - OBJECT_METAL = 33, //! < metal - OBJECT_POWER = 34, //! < normal battery - OBJECT_ATOMIC = 35, //! < atomic battery - OBJECT_BULLET = 36, //! < bullet - OBJECT_BBOX = 37, //! < black-box - OBJECT_TNT = 38, //! < box of TNT - OBJECT_SCRAP1 = 40, //! < metal waste - OBJECT_SCRAP2 = 41, //! < metal waste - OBJECT_SCRAP3 = 42, //! < metal waste - OBJECT_SCRAP4 = 43, //! < plastic waste - OBJECT_SCRAP5 = 44, //! < plastic waste - OBJECT_MARKPOWER = 50, //! < mark underground energy source - OBJECT_MARKSTONE = 51, //! < mark underground ore - OBJECT_MARKURANIUM = 52, //! < mark underground uranium - OBJECT_MARKKEYa = 53, //! < mark underground key - OBJECT_MARKKEYb = 54, //! < mark underground key - OBJECT_MARKKEYc = 55, //! < mark underground key - OBJECT_MARKKEYd = 56, //! < mark underground key - OBJECT_BOMB = 60, //! < bomb - OBJECT_WINFIRE = 61, //! < fireworks - OBJECT_SHOW = 62, //! < shows a place - OBJECT_BAG = 63, //! < survival bag - OBJECT_PLANT0 = 70, //! < plant 0 - OBJECT_PLANT1 = 71, //! < plant 1 - OBJECT_PLANT2 = 72, //! < plant 2 - OBJECT_PLANT3 = 73, //! < plant 3 - OBJECT_PLANT4 = 74, //! < plant 4 - OBJECT_PLANT5 = 75, //! < plant 5 - OBJECT_PLANT6 = 76, //! < plant 6 - OBJECT_PLANT7 = 77, //! < plant 7 - OBJECT_PLANT8 = 78, //! < plant 8 - OBJECT_PLANT9 = 79, //! < plant 9 - OBJECT_PLANT10 = 80, //! < plant 10 - OBJECT_PLANT11 = 81, //! < plant 11 - OBJECT_PLANT12 = 82, //! < plant 12 - OBJECT_PLANT13 = 83, //! < plant 13 - OBJECT_PLANT14 = 84, //! < plant 14 - OBJECT_PLANT15 = 85, //! < plant 15 - OBJECT_PLANT16 = 86, //! < plant 16 - OBJECT_PLANT17 = 87, //! < plant 17 - OBJECT_PLANT18 = 88, //! < plant 18 - OBJECT_PLANT19 = 89, //! < plant 19 - OBJECT_TREE0 = 90, //! < tree 0 - OBJECT_TREE1 = 91, //! < tree 1 - OBJECT_TREE2 = 92, //! < tree 2 - OBJECT_TREE3 = 93, //! < tree 3 - OBJECT_TREE4 = 94, //! < tree 4 - OBJECT_TREE5 = 95, //! < tree 5 - OBJECT_TREE6 = 96, //! < tree 6 - OBJECT_TREE7 = 97, //! < tree 7 - OBJECT_TREE8 = 98, //! < tree 8 - OBJECT_TREE9 = 99, //! < tree 9 + OBJECT_PORTICO = 2, //! < Portico + OBJECT_BASE = 3, //! < SpaceShip + OBJECT_DERRICK = 4, //! < Derrick + OBJECT_FACTORY = 5, //! < BotFactory + OBJECT_STATION = 6, //! < PowerStation + OBJECT_CONVERT = 7, //! < Converter + OBJECT_REPAIR = 8, //! < RepairStation + OBJECT_TOWER = 9, //! < DefenseTower + OBJECT_NEST = 10, //! < AlienNest + OBJECT_RESEARCH = 11, //! < ResearchCenter + OBJECT_RADAR = 12, //! < RadarStation + OBJECT_ENERGY = 13, //! < PowerPlant + OBJECT_LABO = 14, //! < AutoLab + OBJECT_NUCLEAR = 15, //! < NuclearPlant + OBJECT_START = 16, //! < StartArea + OBJECT_END = 17, //! < EndArea + OBJECT_INFO = 18, //! < ExchangePost + OBJECT_PARA = 19, //! < PowerCaptor + OBJECT_TARGET1 = 20, //! < Target1 (gate) + OBJECT_TARGET2 = 21, //! < Target2 (center) + OBJECT_SAFE = 22, //! < Vault + OBJECT_HUSTON = 23, //! < Houston + OBJECT_DESTROYER = 24, //! < Destroyer + OBJECT_FRET = 30, //! < transportable (unused) + OBJECT_STONE = 31, //! < TitaniumOre + OBJECT_URANIUM = 32, //! < UraniumOre + OBJECT_METAL = 33, //! < Titanium + OBJECT_POWER = 34, //! < PowerCell + OBJECT_ATOMIC = 35, //! < NuclearCell + OBJECT_BULLET = 36, //! < OrgaMatter + OBJECT_BBOX = 37, //! < BlackBox + OBJECT_TNT = 38, //! < TNT + OBJECT_SCRAP1 = 40, //! < Scrap1 (metal) + OBJECT_SCRAP2 = 41, //! < Scrap2 (metal) + OBJECT_SCRAP3 = 42, //! < Scrap3 (metal) + OBJECT_SCRAP4 = 43, //! < Scrap4 (plastic) + OBJECT_SCRAP5 = 44, //! < Scrap5 (plastic) + OBJECT_MARKPOWER = 50, //! < PowerSpot + OBJECT_MARKSTONE = 51, //! < TitaniumSpot + OBJECT_MARKURANIUM = 52, //! < UraniumSpot + OBJECT_MARKKEYa = 53, //! < KeyASpot + OBJECT_MARKKEYb = 54, //! < KeyBSpot + OBJECT_MARKKEYc = 55, //! < KeyCSpot + OBJECT_MARKKEYd = 56, //! < KeyDSpot + OBJECT_BOMB = 60, //! < Mine + OBJECT_WINFIRE = 61, //! < Firework + OBJECT_SHOW = 62, //! < arrow above object (Visit) + OBJECT_BAG = 63, //! < Bag + OBJECT_PLANT0 = 70, //! < Greenery0 + OBJECT_PLANT1 = 71, //! < Greenery1 + OBJECT_PLANT2 = 72, //! < Greenery2 + OBJECT_PLANT3 = 73, //! < Greenery3 + OBJECT_PLANT4 = 74, //! < Greenery4 + OBJECT_PLANT5 = 75, //! < Greenery5 + OBJECT_PLANT6 = 76, //! < Greenery6 + OBJECT_PLANT7 = 77, //! < Greenery7 + OBJECT_PLANT8 = 78, //! < Greenery8 + OBJECT_PLANT9 = 79, //! < Greenery9 + OBJECT_PLANT10 = 80, //! < Greenery10 + OBJECT_PLANT11 = 81, //! < Greenery11 + OBJECT_PLANT12 = 82, //! < Greenery12 + OBJECT_PLANT13 = 83, //! < Greenery13 + OBJECT_PLANT14 = 84, //! < Greenery14 + OBJECT_PLANT15 = 85, //! < Greenery15 + OBJECT_PLANT16 = 86, //! < Greenery16 + OBJECT_PLANT17 = 87, //! < Greenery17 + OBJECT_PLANT18 = 88, //! < Greenery18 + OBJECT_PLANT19 = 89, //! < Greenery19 + OBJECT_TREE0 = 90, //! < Tree0 + OBJECT_TREE1 = 91, //! < Tree1 + OBJECT_TREE2 = 92, //! < Tree2 + OBJECT_TREE3 = 93, //! < Tree3 + OBJECT_TREE4 = 94, //! < Tree4 + OBJECT_TREE5 = 95, //! < Tree5 + OBJECT_TREE6 = 96, //! < Tree6 + OBJECT_TREE7 = 97, //! < Tree7 + OBJECT_TREE8 = 98, //! < Tree8 + OBJECT_TREE9 = 99, //! < Tree9 OBJECT_MOBILEwt = 100, //! < PracticeBot OBJECT_MOBILEtt = 101, //! < track-trainer (unused) OBJECT_MOBILEft = 102, //! < fly-trainer (unused) @@ -153,139 +153,129 @@ enum ObjectType OBJECT_MOBILEtg = 211, //! < TargetBot OBJECT_MOBILEdr = 212, //! < Scribbler OBJECT_CONTROLLER = 213, //! < MissionController - OBJECT_WAYPOINT = 250, //! < waypoint - OBJECT_FLAGb = 260, //! < blue flag - OBJECT_FLAGr = 261, //! < red flag - OBJECT_FLAGg = 262, //! < green flag - OBJECT_FLAGy = 263, //! < yellow flag - OBJECT_FLAGv = 264, //! < violet flag - OBJECT_KEYa = 270, //! < key a - OBJECT_KEYb = 271, //! < key b - OBJECT_KEYc = 272, //! < key c - OBJECT_KEYd = 273, //! < key d - OBJECT_HUMAN = 300, //! < human - OBJECT_TOTO = 301, //! < toto - OBJECT_TECH = 302, //! < technician - OBJECT_BARRIER0 = 400, //! < barrier - OBJECT_BARRIER1 = 401, //! < barrier - OBJECT_BARRIER2 = 402, //! < barrier - OBJECT_BARRIER3 = 403, //! < barrier - OBJECT_BARRIER4 = 404, //! < barrier - OBJECT_MOTHER = 500, //! < insect queen - OBJECT_EGG = 501, //! < egg - OBJECT_ANT = 502, //! < ant - OBJECT_SPIDER = 503, //! < spider - OBJECT_BEE = 504, //! < bee - OBJECT_WORM = 505, //! < worm - OBJECT_RUINmobilew1 = 600, //! < ruin 1 - OBJECT_RUINmobilew2 = 601, //! < ruin 1 - OBJECT_RUINmobilet1 = 602, //! < ruin 2 - OBJECT_RUINmobilet2 = 603, //! < ruin 2 - OBJECT_RUINmobiler1 = 604, //! < ruin 3 - OBJECT_RUINmobiler2 = 605, //! < ruin 3 - OBJECT_RUINfactory = 606, //! < ruin 4 - OBJECT_RUINdoor = 607, //! < ruin 5 - OBJECT_RUINsupport = 608, //! < ruin 6 - OBJECT_RUINradar = 609, //! < ruin 7 - OBJECT_RUINconvert = 610, //! < ruin 8 - OBJECT_RUINbase = 611, //! < ruin 9 - OBJECT_RUINhead = 612, //! < ruin 10 - OBJECT_TEEN0 = 620, //! < toy - OBJECT_TEEN1 = 621, //! < toy - OBJECT_TEEN2 = 622, //! < toy - OBJECT_TEEN3 = 623, //! < toy - OBJECT_TEEN4 = 624, //! < toy - OBJECT_TEEN5 = 625, //! < toy - OBJECT_TEEN6 = 626, //! < toy - OBJECT_TEEN7 = 627, //! < toy - OBJECT_TEEN8 = 628, //! < toy - OBJECT_TEEN9 = 629, //! < toy - OBJECT_TEEN10 = 630, //! < toy - OBJECT_TEEN11 = 631, //! < toy - OBJECT_TEEN12 = 632, //! < toy - OBJECT_TEEN13 = 633, //! < toy - OBJECT_TEEN14 = 634, //! < toy - OBJECT_TEEN15 = 635, //! < toy - OBJECT_TEEN16 = 636, //! < toy - OBJECT_TEEN17 = 637, //! < toy - OBJECT_TEEN18 = 638, //! < toy - OBJECT_TEEN19 = 639, //! < toy - OBJECT_TEEN20 = 640, //! < toy - OBJECT_TEEN21 = 641, //! < toy - OBJECT_TEEN22 = 642, //! < toy - OBJECT_TEEN23 = 643, //! < toy - OBJECT_TEEN24 = 644, //! < toy - OBJECT_TEEN25 = 645, //! < toy - OBJECT_TEEN26 = 646, //! < toy - OBJECT_TEEN27 = 647, //! < toy - OBJECT_TEEN28 = 648, //! < toy - OBJECT_TEEN29 = 649, //! < toy - OBJECT_TEEN30 = 650, //! < toy - OBJECT_TEEN31 = 651, //! < toy - OBJECT_TEEN32 = 652, //! < toy - OBJECT_TEEN33 = 653, //! < toy - OBJECT_TEEN34 = 654, //! < toy - OBJECT_TEEN35 = 655, //! < toy - OBJECT_TEEN36 = 656, //! < toy - OBJECT_TEEN37 = 657, //! < toy - OBJECT_TEEN38 = 658, //! < toy - OBJECT_TEEN39 = 659, //! < toy - OBJECT_TEEN40 = 660, //! < toy - OBJECT_TEEN41 = 661, //! < toy - OBJECT_TEEN42 = 662, //! < toy - OBJECT_TEEN43 = 663, //! < toy - OBJECT_TEEN44 = 664, //! < toy - OBJECT_TEEN45 = 665, //! < toy - OBJECT_TEEN46 = 666, //! < toy - OBJECT_TEEN47 = 667, //! < toy - OBJECT_TEEN48 = 668, //! < toy - OBJECT_TEEN49 = 669, //! < toy - OBJECT_QUARTZ0 = 700, //! < crystal 0 - OBJECT_QUARTZ1 = 701, //! < crystal 1 - OBJECT_QUARTZ2 = 702, //! < crystal 2 - OBJECT_QUARTZ3 = 703, //! < crystal 3 - OBJECT_QUARTZ4 = 704, //! < crystal 4 - OBJECT_QUARTZ5 = 705, //! < crystal 5 - OBJECT_QUARTZ6 = 706, //! < crystal 6 - OBJECT_QUARTZ7 = 707, //! < crystal 7 - OBJECT_QUARTZ8 = 708, //! < crystal 8 - OBJECT_QUARTZ9 = 709, //! < crystal 9 - OBJECT_ROOT0 = 710, //! < root 0 - OBJECT_ROOT1 = 711, //! < root 1 - OBJECT_ROOT2 = 712, //! < root 2 - OBJECT_ROOT3 = 713, //! < root 3 - OBJECT_ROOT4 = 714, //! < root 4 - OBJECT_ROOT5 = 715, //! < root 5 - OBJECT_ROOT6 = 716, //! < root 6 - OBJECT_ROOT7 = 717, //! < root 7 - OBJECT_ROOT8 = 718, //! < root 8 - OBJECT_ROOT9 = 719, //! < root 9 - OBJECT_SEAWEED0 = 720, //! < seaweed 0 - OBJECT_SEAWEED1 = 721, //! < seaweed 1 - OBJECT_SEAWEED2 = 722, //! < seaweed 2 - OBJECT_SEAWEED3 = 723, //! < seaweed 3 - OBJECT_SEAWEED4 = 724, //! < seaweed 4 - OBJECT_SEAWEED5 = 725, //! < seaweed 5 - OBJECT_SEAWEED6 = 726, //! < seaweed 6 - OBJECT_SEAWEED7 = 727, //! < seaweed 7 - OBJECT_SEAWEED8 = 728, //! < seaweed 8 - OBJECT_SEAWEED9 = 729, //! < seaweed 9 - OBJECT_MUSHROOM0 = 730, //! < mushroom 0 - OBJECT_MUSHROOM1 = 731, //! < mushroom 1 - OBJECT_MUSHROOM2 = 732, //! < mushroom 2 - OBJECT_MUSHROOM3 = 733, //! < mushroom 3 - OBJECT_MUSHROOM4 = 734, //! < mushroom 4 - OBJECT_MUSHROOM5 = 735, //! < mushroom 5 - OBJECT_MUSHROOM6 = 736, //! < mushroom 6 - OBJECT_MUSHROOM7 = 737, //! < mushroom 7 - OBJECT_MUSHROOM8 = 738, //! < mushroom 8 - OBJECT_MUSHROOM9 = 739, //! < mushroom 9 - OBJECT_APOLLO1 = 900, //! < apollo lem - OBJECT_APOLLO2 = 901, //! < apollo jeep - OBJECT_APOLLO3 = 902, //! < apollo flag - OBJECT_APOLLO4 = 903, //! < apollo module - OBJECT_APOLLO5 = 904, //! < apollo antenna - OBJECT_HOME1 = 910, //! < home 1 + OBJECT_WAYPOINT = 250, //! < WayPoint + OBJECT_FLAGb = 260, //! < BlueFlag + OBJECT_FLAGr = 261, //! < RedFlag + OBJECT_FLAGg = 262, //! < GreenFlag + OBJECT_FLAGy = 263, //! < YellowFlag + OBJECT_FLAGv = 264, //! < VioletFlag + OBJECT_KEYa = 270, //! < KeyA + OBJECT_KEYb = 271, //! < KeyB + OBJECT_KEYc = 272, //! < KeyC + OBJECT_KEYd = 273, //! < KeyD + OBJECT_HUMAN = 300, //! < Me + OBJECT_TOTO = 301, //! < Robby (toto) + OBJECT_TECH = 302, //! < Tech + OBJECT_BARRIER0 = 400, //! < Barrier0 + OBJECT_BARRIER1 = 401, //! < Barrier1 + OBJECT_BARRIER2 = 402, //! < Barrier2 + OBJECT_BARRIER3 = 403, //! < Barrier3 + OBJECT_BARRIER4 = 404, //! < Barrier4 + OBJECT_MOTHER = 500, //! < AlienQueen + OBJECT_EGG = 501, //! < AlienEgg + OBJECT_ANT = 502, //! < AlienAnt + OBJECT_SPIDER = 503, //! < AlienSpider + OBJECT_BEE = 504, //! < AlienWasp + OBJECT_WORM = 505, //! < AlienWorm + OBJECT_RUINmobilew1 = 600, //! < WreckBotw1 + OBJECT_RUINmobilew2 = 601, //! < WreckBotw2 + OBJECT_RUINmobilet1 = 602, //! < WreckBott1 + OBJECT_RUINmobilet2 = 603, //! < WreckBott2 + OBJECT_RUINmobiler1 = 604, //! < WreckBotr1 + OBJECT_RUINmobiler2 = 605, //! < WreckBotr2 + OBJECT_RUINfactory = 606, //! < RuinBotFactory + OBJECT_RUINdoor = 607, //! < RuinDoor + OBJECT_RUINsupport = 608, //! < RuinSupport + OBJECT_RUINradar = 609, //! < RuinRadar + OBJECT_RUINconvert = 610, //! < RuinConvert + OBJECT_RUINbase = 611, //! < RuinBaseCamp + OBJECT_RUINhead = 612, //! < RuinHeadCamp + OBJECT_TEEN0 = 620, //! < Teen0 + OBJECT_TEEN1 = 621, //! < Teen1 + OBJECT_TEEN2 = 622, //! < Teen2 + OBJECT_TEEN3 = 623, //! < Teen3 + OBJECT_TEEN4 = 624, //! < Teen4 + OBJECT_TEEN5 = 625, //! < Teen5 + OBJECT_TEEN6 = 626, //! < Teen6 + OBJECT_TEEN7 = 627, //! < Teen7 + OBJECT_TEEN8 = 628, //! < Teen8 + OBJECT_TEEN9 = 629, //! < Teen9 + OBJECT_TEEN10 = 630, //! < Teen10 + OBJECT_TEEN11 = 631, //! < Teen11 + OBJECT_TEEN12 = 632, //! < Teen12 + OBJECT_TEEN13 = 633, //! < Teen13 + OBJECT_TEEN14 = 634, //! < Teen14 + OBJECT_TEEN15 = 635, //! < Teen15 + OBJECT_TEEN16 = 636, //! < Teen16 + OBJECT_TEEN17 = 637, //! < Teen17 + OBJECT_TEEN18 = 638, //! < Teen18 + OBJECT_TEEN19 = 639, //! < Teen19 + OBJECT_TEEN20 = 640, //! < Teen20 + OBJECT_TEEN21 = 641, //! < Teen21 + OBJECT_TEEN22 = 642, //! < Teen22 + OBJECT_TEEN23 = 643, //! < Teen23 + OBJECT_TEEN24 = 644, //! < Teen24 + OBJECT_TEEN25 = 645, //! < Teen25 + OBJECT_TEEN26 = 646, //! < Teen26 + OBJECT_TEEN27 = 647, //! < Teen27 + OBJECT_TEEN28 = 648, //! < Teen28 + OBJECT_TEEN29 = 649, //! < Teen29 + OBJECT_TEEN30 = 650, //! < Teen30 + OBJECT_TEEN31 = 651, //! < Teen31 + OBJECT_TEEN32 = 652, //! < Teen32 + OBJECT_TEEN33 = 653, //! < Teen33 + OBJECT_TEEN34 = 654, //! < Stone (Teen34) + OBJECT_TEEN35 = 655, //! < Teen35 + OBJECT_TEEN36 = 656, //! < Teen36 + OBJECT_TEEN37 = 657, //! < Teen37 + OBJECT_TEEN38 = 658, //! < Teen38 + OBJECT_TEEN39 = 659, //! < Teen39 + OBJECT_TEEN40 = 660, //! < Teen40 + OBJECT_TEEN41 = 661, //! < Teen41 + OBJECT_TEEN42 = 662, //! < Teen42 + OBJECT_TEEN43 = 663, //! < Teen43 + OBJECT_TEEN44 = 664, //! < Teen44 + OBJECT_TEEN45 = 665, //! < Teen45 + OBJECT_TEEN46 = 666, //! < Teen46 + OBJECT_TEEN47 = 667, //! < Teen47 + OBJECT_TEEN48 = 668, //! < Teen48 + OBJECT_TEEN49 = 669, //! < Teen49 + OBJECT_QUARTZ0 = 700, //! < Quartz0 + OBJECT_QUARTZ1 = 701, //! < Quartz1 + OBJECT_QUARTZ2 = 702, //! < Quartz2 + OBJECT_QUARTZ3 = 703, //! < Quartz3 + OBJECT_QUARTZ4 = 704, //! < Quartz4 + OBJECT_QUARTZ5 = 705, //! < Quartz5 + OBJECT_QUARTZ6 = 706, //! < Quartz6 + OBJECT_QUARTZ7 = 707, //! < Quartz7 + OBJECT_QUARTZ8 = 708, //! < Quartz8 + OBJECT_QUARTZ9 = 709, //! < Quartz9 + OBJECT_ROOT0 = 710, //! < MegaStalk0 + OBJECT_ROOT1 = 711, //! < MegaStalk1 + OBJECT_ROOT2 = 712, //! < MegaStalk2 + OBJECT_ROOT3 = 713, //! < MegaStalk3 + OBJECT_ROOT4 = 714, //! < MegaStalk4 + OBJECT_ROOT5 = 715, //! < MegaStalk5 + OBJECT_ROOT6 = 716, //! < MegaStalk6 + OBJECT_ROOT7 = 717, //! < MegaStalk7 + OBJECT_ROOT8 = 718, //! < MegaStalk8 + OBJECT_ROOT9 = 719, //! < MegaStalk9 + OBJECT_MUSHROOM0 = 730, //! < Mushroom0 + OBJECT_MUSHROOM1 = 731, //! < Mushroom1 + OBJECT_MUSHROOM2 = 732, //! < Mushroom2 + OBJECT_MUSHROOM3 = 733, //! < Mushroom3 + OBJECT_MUSHROOM4 = 734, //! < Mushroom4 + OBJECT_MUSHROOM5 = 735, //! < Mushroom5 + OBJECT_MUSHROOM6 = 736, //! < Mushroom6 + OBJECT_MUSHROOM7 = 737, //! < Mushroom7 + OBJECT_MUSHROOM8 = 738, //! < Mushroom8 + OBJECT_MUSHROOM9 = 739, //! < Mushroom9 + OBJECT_APOLLO1 = 900, //! < ApolloLEM + OBJECT_APOLLO2 = 901, //! < ApolloJeep + OBJECT_APOLLO3 = 902, //! < ApolloFlag + OBJECT_APOLLO4 = 903, //! < ApolloModule + OBJECT_APOLLO5 = 904, //! < ApolloAntenna + OBJECT_HOME1 = 910, //! < Home OBJECT_MAX = 1000 //! < number of values }; -- cgit v1.2.3-1-g7c22 From 652dc6081df8dc73bc9f57c031420e498be71451 Mon Sep 17 00:00:00 2001 From: krzys-h Date: Sat, 11 Jan 2014 23:42:45 +0100 Subject: Removed some unused objects --- src/object/object.h | 28 ---------------------------- src/object/objman.cpp | 42 +++++++----------------------------------- src/object/robotmain.cpp | 6 +++--- src/object/task/taskgoto.cpp | 4 ++-- 4 files changed, 12 insertions(+), 68 deletions(-) (limited to 'src/object') diff --git a/src/object/object.h b/src/object/object.h index d5a073c..5d9e681 100644 --- a/src/object/object.h +++ b/src/object/object.h @@ -121,10 +121,6 @@ enum ObjectType OBJECT_TREE3 = 93, //! < Tree3 OBJECT_TREE4 = 94, //! < Tree4 OBJECT_TREE5 = 95, //! < Tree5 - OBJECT_TREE6 = 96, //! < Tree6 - OBJECT_TREE7 = 97, //! < Tree7 - OBJECT_TREE8 = 98, //! < Tree8 - OBJECT_TREE9 = 99, //! < Tree9 OBJECT_MOBILEwt = 100, //! < PracticeBot OBJECT_MOBILEtt = 101, //! < track-trainer (unused) OBJECT_MOBILEft = 102, //! < fly-trainer (unused) @@ -170,7 +166,6 @@ enum ObjectType OBJECT_BARRIER1 = 401, //! < Barrier1 OBJECT_BARRIER2 = 402, //! < Barrier2 OBJECT_BARRIER3 = 403, //! < Barrier3 - OBJECT_BARRIER4 = 404, //! < Barrier4 OBJECT_MOTHER = 500, //! < AlienQueen OBJECT_EGG = 501, //! < AlienEgg OBJECT_ANT = 502, //! < AlienAnt @@ -235,41 +230,18 @@ enum ObjectType OBJECT_TEEN42 = 662, //! < Teen42 OBJECT_TEEN43 = 663, //! < Teen43 OBJECT_TEEN44 = 664, //! < Teen44 - OBJECT_TEEN45 = 665, //! < Teen45 - OBJECT_TEEN46 = 666, //! < Teen46 - OBJECT_TEEN47 = 667, //! < Teen47 - OBJECT_TEEN48 = 668, //! < Teen48 - OBJECT_TEEN49 = 669, //! < Teen49 OBJECT_QUARTZ0 = 700, //! < Quartz0 OBJECT_QUARTZ1 = 701, //! < Quartz1 OBJECT_QUARTZ2 = 702, //! < Quartz2 OBJECT_QUARTZ3 = 703, //! < Quartz3 - OBJECT_QUARTZ4 = 704, //! < Quartz4 - OBJECT_QUARTZ5 = 705, //! < Quartz5 - OBJECT_QUARTZ6 = 706, //! < Quartz6 - OBJECT_QUARTZ7 = 707, //! < Quartz7 - OBJECT_QUARTZ8 = 708, //! < Quartz8 - OBJECT_QUARTZ9 = 709, //! < Quartz9 OBJECT_ROOT0 = 710, //! < MegaStalk0 OBJECT_ROOT1 = 711, //! < MegaStalk1 OBJECT_ROOT2 = 712, //! < MegaStalk2 OBJECT_ROOT3 = 713, //! < MegaStalk3 OBJECT_ROOT4 = 714, //! < MegaStalk4 OBJECT_ROOT5 = 715, //! < MegaStalk5 - OBJECT_ROOT6 = 716, //! < MegaStalk6 - OBJECT_ROOT7 = 717, //! < MegaStalk7 - OBJECT_ROOT8 = 718, //! < MegaStalk8 - OBJECT_ROOT9 = 719, //! < MegaStalk9 - OBJECT_MUSHROOM0 = 730, //! < Mushroom0 OBJECT_MUSHROOM1 = 731, //! < Mushroom1 OBJECT_MUSHROOM2 = 732, //! < Mushroom2 - OBJECT_MUSHROOM3 = 733, //! < Mushroom3 - OBJECT_MUSHROOM4 = 734, //! < Mushroom4 - OBJECT_MUSHROOM5 = 735, //! < Mushroom5 - OBJECT_MUSHROOM6 = 736, //! < Mushroom6 - OBJECT_MUSHROOM7 = 737, //! < Mushroom7 - OBJECT_MUSHROOM8 = 738, //! < Mushroom8 - OBJECT_MUSHROOM9 = 739, //! < Mushroom9 OBJECT_APOLLO1 = 900, //! < ApolloLEM OBJECT_APOLLO2 = 901, //! < ApolloJeep OBJECT_APOLLO3 = 902, //! < ApolloFlag diff --git a/src/object/objman.cpp b/src/object/objman.cpp index 131d007..b0bac1a 100644 --- a/src/object/objman.cpp +++ b/src/object/objman.cpp @@ -160,8 +160,7 @@ CObject* CObjectManager::CreateObject(Math::Vector pos, float angle, ObjectType if ( type == OBJECT_BARRIER0 || type == OBJECT_BARRIER1 || type == OBJECT_BARRIER2 || - type == OBJECT_BARRIER3 || - type == OBJECT_BARRIER4 ) + type == OBJECT_BARRIER3 ) { object = new CObject(); object->CreateBarrier(pos, angle, height, type); @@ -192,26 +191,14 @@ CObject* CObjectManager::CreateObject(Math::Vector pos, float angle, ObjectType type == OBJECT_TREE2 || type == OBJECT_TREE3 || type == OBJECT_TREE4 || - type == OBJECT_TREE5 || - type == OBJECT_TREE6 || - type == OBJECT_TREE7 || - type == OBJECT_TREE8 || - type == OBJECT_TREE9 ) + type == OBJECT_TREE5 ) { object = new CObject(); object->CreatePlant(pos, angle, height, type); } else - if ( type == OBJECT_MUSHROOM0 || - type == OBJECT_MUSHROOM1 || - type == OBJECT_MUSHROOM2 || - type == OBJECT_MUSHROOM3 || - type == OBJECT_MUSHROOM4 || - type == OBJECT_MUSHROOM5 || - type == OBJECT_MUSHROOM6 || - type == OBJECT_MUSHROOM7 || - type == OBJECT_MUSHROOM8 || - type == OBJECT_MUSHROOM9 ) + if ( type == OBJECT_MUSHROOM1 || + type == OBJECT_MUSHROOM2 ) { object = new CObject(); object->CreateMushroom(pos, angle, height, type); @@ -261,12 +248,7 @@ CObject* CObjectManager::CreateObject(Math::Vector pos, float angle, ObjectType type == OBJECT_TEEN41 || type == OBJECT_TEEN42 || type == OBJECT_TEEN43 || - type == OBJECT_TEEN44 || - type == OBJECT_TEEN45 || - type == OBJECT_TEEN46 || - type == OBJECT_TEEN47 || - type == OBJECT_TEEN48 || - type == OBJECT_TEEN49 ) + type == OBJECT_TEEN44 ) { object = new CObject(); object->SetOption(option); @@ -276,13 +258,7 @@ CObject* CObjectManager::CreateObject(Math::Vector pos, float angle, ObjectType if ( type == OBJECT_QUARTZ0 || type == OBJECT_QUARTZ1 || type == OBJECT_QUARTZ2 || - type == OBJECT_QUARTZ3 || - type == OBJECT_QUARTZ4 || - type == OBJECT_QUARTZ5 || - type == OBJECT_QUARTZ6 || - type == OBJECT_QUARTZ7 || - type == OBJECT_QUARTZ8 || - type == OBJECT_QUARTZ9 ) + type == OBJECT_QUARTZ3 ) { object = new CObject(); object->CreateQuartz(pos, angle, height, type); @@ -293,11 +269,7 @@ CObject* CObjectManager::CreateObject(Math::Vector pos, float angle, ObjectType type == OBJECT_ROOT2 || type == OBJECT_ROOT3 || type == OBJECT_ROOT4 || - type == OBJECT_ROOT5 || - type == OBJECT_ROOT6 || - type == OBJECT_ROOT7 || - type == OBJECT_ROOT8 || - type == OBJECT_ROOT9 ) + type == OBJECT_ROOT5 ) { object = new CObject(); object->CreateRoot(pos, angle, height, type); diff --git a/src/object/robotmain.cpp b/src/object/robotmain.cpp index 0d95907..ced1127 100644 --- a/src/object/robotmain.cpp +++ b/src/object/robotmain.cpp @@ -4592,11 +4592,11 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject) (type >= OBJECT_PLANT0 && type <= OBJECT_PLANT19 ) || (type >= OBJECT_TREE0 && - type <= OBJECT_TREE9 ) || + type <= OBJECT_TREE5 ) || (type >= OBJECT_TEEN0 && - type <= OBJECT_TEEN49 ) || + type <= OBJECT_TEEN44 ) || (type >= OBJECT_QUARTZ0 && - type <= OBJECT_QUARTZ9 ) || + type <= OBJECT_QUARTZ3 ) || (type >= OBJECT_ROOT0 && type <= OBJECT_ROOT4 ) ) // not ROOT5! { diff --git a/src/object/task/taskgoto.cpp b/src/object/task/taskgoto.cpp index 01ff38b..8070d13 100644 --- a/src/object/task/taskgoto.cpp +++ b/src/object/task/taskgoto.cpp @@ -1559,8 +1559,8 @@ void CTaskGoto::ComputeRepulse(Math::Point &dir) oType == OBJECT_BOMB || (oType >= OBJECT_PLANT0 && oType <= OBJECT_PLANT19 ) || - (oType >= OBJECT_MUSHROOM0 && - oType <= OBJECT_MUSHROOM9 ) ) continue; + (oType >= OBJECT_MUSHROOM1 && + oType <= OBJECT_MUSHROOM2 ) ) continue; } addi = add; -- cgit v1.2.3-1-g7c22 From 181a4049309600ef31c2d22b3823429c6ee331df Mon Sep 17 00:00:00 2001 From: Piotr Dziwinski Date: Sat, 18 Jan 2014 19:20:40 +0100 Subject: Fixed warnings about unknown commands in scene files --- src/object/robotmain.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'src/object') diff --git a/src/object/robotmain.cpp b/src/object/robotmain.cpp index ced1127..b1cbe52 100644 --- a/src/object/robotmain.cpp +++ b/src/object/robotmain.cpp @@ -81,6 +81,9 @@ #include +#include + + template<> CRobotMain* CSingleton::m_instance = nullptr; @@ -4050,9 +4053,14 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject) continue; } - if (Cmd(line, "Title")) continue; // Ignore - if (Cmd(line, "Resume")) continue; // Ignore - if (Cmd(line, "ScriptName")) continue; // Ignore + static const boost::regex titleCmdRe("Title\\.[A-Z]"); + static const boost::regex resumeCmdRe("Resume\\.[A-Z]"); + static const boost::regex scriptNameCmdRe("ScriptName\.[A-Z]"); + + if (boost::regex_match(GetCmd(line), titleCmdRe)) continue; // Ignore + if (boost::regex_match(GetCmd(line), resumeCmdRe)) continue; // Ignore + if (boost::regex_match(GetCmd(line), scriptNameCmdRe)) continue; // Ignore + if (Cmd(line, "ScriptFile") && !resetObject) { -- cgit v1.2.3-1-g7c22 From bb2a9bcfd3f63434c4bfb01a31f2ab0d64d6260b Mon Sep 17 00:00:00 2001 From: krzys-h Date: Fri, 21 Feb 2014 14:19:58 +0100 Subject: Added option to set pause audio in Scene --- src/object/robotmain.cpp | 46 +++++++++++++++++++++++++++++++++++++++++++--- src/object/robotmain.h | 9 +++++++-- 2 files changed, 50 insertions(+), 5 deletions(-) (limited to 'src/object') diff --git a/src/object/robotmain.cpp b/src/object/robotmain.cpp index b1cbe52..e66e2c6 100644 --- a/src/object/robotmain.cpp +++ b/src/object/robotmain.cpp @@ -647,6 +647,10 @@ CRobotMain::CRobotMain(CApplication* app, bool loadProfile) m_visitArrow = 0; m_audioTrack = ""; m_audioRepeat = true; + m_satcomTrack = ""; + m_satcomRepeat = true; + m_editorTrack = ""; + m_editorRepeat = true; m_delayWriteMessage = 0; m_selectObject = 0; m_infoUsed = 0; @@ -3923,6 +3927,10 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject) m_terrain->FlushMaterials(); m_audioTrack = ""; m_audioRepeat = true; + m_satcomTrack = ""; + m_satcomRepeat = true; + m_editorTrack = ""; + m_editorRepeat = true; m_displayText->SetDelay(1.0f); m_displayText->SetEnable(true); m_immediatSatCom = false; @@ -4028,8 +4036,10 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject) } } - if (Cmd(line, "MissionFile") && !resetObject) + if (Cmd(line, "MissionFile") && !resetObject) { m_version = OpInt(line, "version", 1); + continue; + } // TODO: Fallback to an non-localized entry sprintf(op, "Title.%c", m_app->GetLanguageChar()); @@ -4165,15 +4175,27 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject) filenameStr << "music" << std::setfill('0') << std::setw(3) << trackid << ".ogg"; m_audioTrack = filenameStr.str(); } + m_audioRepeat = OpInt(line, "repeat", 1); } else { char trackname[100]; - OpString(line, "filename", trackname); + + OpString(line, "main", trackname); m_audioTrack = trackname; + m_audioRepeat = OpInt(line, "mainRepeat", 1); + + OpString(line, "satcom", trackname); + m_satcomTrack = trackname; + m_satcomRepeat = OpInt(line, "satcomRepeat", 1); + + OpString(line, "editor", trackname); + m_editorTrack = trackname; + m_editorRepeat = OpInt(line, "editorRepeat", 1); } - m_audioRepeat = OpInt(line, "repeat", 1); if (m_audioTrack != "") m_sound->CacheMusic(m_audioTrack); + if (m_satcomTrack != "") m_sound->CacheMusic(m_satcomTrack); + if (m_editorTrack != "") m_sound->CacheMusic(m_editorTrack); continue; } @@ -7220,6 +7242,24 @@ void CRobotMain::StartMusic() } } +//! Starts pause music +void CRobotMain::StartPauseMusic(PauseType pause) +{ + switch(pause) { + case PAUSE_EDITOR: + m_sound->PlayPauseMusic(m_editorTrack, m_editorRepeat); + break; + + case PAUSE_SATCOM: + m_sound->PlayPauseMusic(m_satcomTrack, m_satcomRepeat); + break; + + default: + // Don't change music + break; + } +} + //! Removes hilite and tooltip void CRobotMain::ClearInterface() { diff --git a/src/object/robotmain.h b/src/object/robotmain.h index 4fa842a..71ad455 100644 --- a/src/object/robotmain.h +++ b/src/object/robotmain.h @@ -340,6 +340,7 @@ public: float GetPersoAngle(); void StartMusic(); + void StartPauseMusic(PauseType pause); void ClearInterface(); void ChangeColor(); @@ -474,15 +475,19 @@ protected: bool m_showSoluce; bool m_showAll; bool m_cheatRadar; - bool m_audioRepeat; bool m_shortCut; std::string m_audioTrack; + bool m_audioRepeat; + std::string m_satcomTrack; + bool m_satcomRepeat; + std::string m_editorTrack; + bool m_editorRepeat; int m_delayWriteMessage; int m_movieInfoIndex; CObject* m_controller; - //Level Checker flags + // Level Checker flags bool m_beginObject; bool m_terrainGenerate; bool m_terrainInitTextures; -- cgit v1.2.3-1-g7c22 From 14709427c46897a37991a35beecb351428265a7f Mon Sep 17 00:00:00 2001 From: krzys-h Date: Fri, 21 Feb 2014 14:33:56 +0100 Subject: Fixed compile warning --- src/object/robotmain.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/object') diff --git a/src/object/robotmain.cpp b/src/object/robotmain.cpp index e66e2c6..80f605c 100644 --- a/src/object/robotmain.cpp +++ b/src/object/robotmain.cpp @@ -4065,7 +4065,7 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject) static const boost::regex titleCmdRe("Title\\.[A-Z]"); static const boost::regex resumeCmdRe("Resume\\.[A-Z]"); - static const boost::regex scriptNameCmdRe("ScriptName\.[A-Z]"); + static const boost::regex scriptNameCmdRe("ScriptName\\.[A-Z]"); if (boost::regex_match(GetCmd(line), titleCmdRe)) continue; // Ignore if (boost::regex_match(GetCmd(line), resumeCmdRe)) continue; // Ignore -- cgit v1.2.3-1-g7c22 From a806d4257ce3f10a23441cfa962b9caf5deebb85 Mon Sep 17 00:00:00 2001 From: krzys-h Date: Sun, 2 Mar 2014 14:39:29 +0100 Subject: Check if pause music is defined in scene before trying to play it --- src/object/robotmain.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/object') diff --git a/src/object/robotmain.cpp b/src/object/robotmain.cpp index 80f605c..c71c437 100644 --- a/src/object/robotmain.cpp +++ b/src/object/robotmain.cpp @@ -7247,11 +7247,13 @@ void CRobotMain::StartPauseMusic(PauseType pause) { switch(pause) { case PAUSE_EDITOR: - m_sound->PlayPauseMusic(m_editorTrack, m_editorRepeat); + if(m_editorTrack != "") + m_sound->PlayPauseMusic(m_editorTrack, m_editorRepeat); break; case PAUSE_SATCOM: - m_sound->PlayPauseMusic(m_satcomTrack, m_satcomRepeat); + if(m_satcomTrack != "") + m_sound->PlayPauseMusic(m_satcomTrack, m_satcomRepeat); break; default: -- cgit v1.2.3-1-g7c22 From fbe2bf8bc7d61a7a13759f56e65181e16e25806b Mon Sep 17 00:00:00 2001 From: krzys-h Date: Mon, 3 Mar 2014 21:55:28 +0100 Subject: Added special mode in scene for bots to build more buildings than they usualy can Will be used in "Leaving Earth" missions for making decorative bots building base --- src/object/object.cpp | 15 ++++++++++++++- src/object/object.h | 4 ++++ src/object/robotmain.cpp | 6 ++++++ src/object/task/taskbuild.cpp | 3 ++- 4 files changed, 26 insertions(+), 2 deletions(-) (limited to 'src/object') diff --git a/src/object/object.cpp b/src/object/object.cpp index 2c32da0..3c225d0 100644 --- a/src/object/object.cpp +++ b/src/object/object.cpp @@ -276,6 +276,7 @@ CObject::CObject() m_lastVirusParticle = 0.0f; m_totalDesectList = 0; m_bLock = false; + m_bIgnoreBuildCheck = false; m_bExplo = false; m_bCargo = false; m_bBurn = false; @@ -6781,7 +6782,7 @@ float CObject::GetParam() // Management of the mode "blocked" of an object. // For example, a cube of titanium is blocked while it is used to make something, -//or a vehicle is blocked as its construction is not finished. +// or a vehicle is blocked as its construction is not finished. void CObject::SetLock(bool bLock) { @@ -6793,6 +6794,18 @@ bool CObject::GetLock() return m_bLock; } +// Ignore checks in build() function + +void CObject::SetIgnoreBuildCheck(bool bIgnoreBuildCheck) +{ + m_bIgnoreBuildCheck = bIgnoreBuildCheck; +} + +bool CObject::GetIgnoreBuildCheck() +{ + return m_bIgnoreBuildCheck; +} + // Management of the mode "current explosion" of an object. // An object in this mode is not saving. diff --git a/src/object/object.h b/src/object/object.h index 5d9e681..0e469f2 100644 --- a/src/object/object.h +++ b/src/object/object.h @@ -582,6 +582,9 @@ public: void SetParam(float value); float GetParam(); + + void SetIgnoreBuildCheck(bool bIgnoreBuildCheck); + bool GetIgnoreBuildCheck(); void SetExplo(bool bExplo); bool GetExplo(); @@ -720,6 +723,7 @@ protected: bool m_bTrainer; // drive vehicle (without remote) bool m_bToy; // toy key bool m_bManual; // manual control (Scribbler) + bool m_bIgnoreBuildCheck; bool m_bFixed; bool m_bClip; bool m_bShowLimit; diff --git a/src/object/robotmain.cpp b/src/object/robotmain.cpp index c71c437..011cab8 100644 --- a/src/object/robotmain.cpp +++ b/src/object/robotmain.cpp @@ -4593,6 +4593,7 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject) { m_controller = CObjectManager::GetInstancePointer()->CreateObject(Math::Vector(0.0f, 0.0f, 0.0f), 0.0f, OBJECT_CONTROLLER, 100.0f); m_controller->SetMagnifyDamage(100.0f); + m_controller->SetIgnoreBuildCheck(true); CBrain* brain = m_controller->GetBrain(); if (brain != nullptr) { @@ -4720,6 +4721,7 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject) bool selectable = OpInt(line, "selectable", 1); obj->SetSelectable(selectable); + obj->SetIgnoreBuildCheck(OpInt(line, "ignoreBuildCheck", 0)); obj->SetEnable(OpInt(line, "enable", 1)); obj->SetProxyActivate(OpInt(line, "proxyActivate", 0)); obj->SetProxyDistance(OpFloat(line, "proxyDistance", 15.0f)*g_unit); @@ -6068,6 +6070,9 @@ void CRobotMain::IOWriteObject(FILE *file, CObject* obj, const char *cmd) sprintf(name, " trainer=%d", obj->GetTrainer()); strcat(line, name); + + sprintf(name, " ignoreBuildCheck=%d", obj->GetIgnoreBuildCheck()); + strcat(line, name); sprintf(name, " option=%d", obj->GetOption()); strcat(line, name); @@ -6229,6 +6234,7 @@ CObject* CRobotMain::IOReadObject(char *line, const char* filename, int objRank) obj->SetDefRank(objRank); obj->SetPosition(0, pos); obj->SetAngle(0, dir); + obj->SetIgnoreBuildCheck(OpInt(line, "ignoreBuildCheck", 0)); obj->SetID(id); if (g_id < id) g_id = id; diff --git a/src/object/task/taskbuild.cpp b/src/object/task/taskbuild.cpp index 4a62a4a..4dfd6fb 100644 --- a/src/object/task/taskbuild.cpp +++ b/src/object/task/taskbuild.cpp @@ -100,6 +100,7 @@ bool CTaskBuild::CreateBuilding(Math::Vector pos, float angle) if ( m_type == OBJECT_PARA ) m_buildingHeight = 68.0f; if ( m_type == OBJECT_INFO ) m_buildingHeight = 19.0f; if ( m_type == OBJECT_DESTROYER) m_buildingHeight = 35.0f; + if ( m_type == OBJECT_HUSTON ) m_buildingHeight = 45.0f; m_buildingHeight *= 0.25f; m_buildingPos = m_building->GetPosition(0); @@ -574,7 +575,7 @@ Error CTaskBuild::FlatFloor() if ( m_type == OBJECT_PARA ) radius = 20.0f; if ( m_type == OBJECT_INFO ) radius = 5.0f; if ( m_type == OBJECT_DESTROYER) radius = 20.0f; - if ( radius == 0.0f ) return ERR_GENERIC; + //if ( radius == 0.0f ) return ERR_GENERIC; center = m_metal->GetPosition(0); angle = m_terrain->GetFineSlope(center); -- cgit v1.2.3-1-g7c22 From e569fd6c3938ca885bfca0978d143def154abd73 Mon Sep 17 00:00:00 2001 From: MrSimbax Date: Sun, 16 Mar 2014 15:25:49 +0100 Subject: Fix for #294 --- src/object/task/taskrecover.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/object') diff --git a/src/object/task/taskrecover.cpp b/src/object/task/taskrecover.cpp index af84099..d8bbafd 100644 --- a/src/object/task/taskrecover.cpp +++ b/src/object/task/taskrecover.cpp @@ -105,9 +105,11 @@ bool CTaskRecover::EventProcess(const Event &event) if ( power != 0 ) { energy = power->GetEnergy(); - power->SetEnergy(energy-ENERGY_RECOVER*event.rTime*m_speed); + energy -= event.rTime * ENERGY_RECOVER / power->GetCapacity() * m_speed; + power->SetEnergy(energy); } + speed.x = (Math::Rand()-0.5f)*0.1f*m_progress; speed.y = (Math::Rand()-0.5f)*0.1f*m_progress; speed.z = (Math::Rand()-0.5f)*0.1f*m_progress; -- cgit v1.2.3-1-g7c22 From 7485ed790caeaa76efab0e9df48224cf1943ec27 Mon Sep 17 00:00:00 2001 From: Oleg Kosmakov Date: Fri, 21 Mar 2014 13:08:36 +0200 Subject: Fixes #295 When cannon cannot turn at specified angle, it will still reach the edge angle, but return the error code --- src/object/task/taskgungoal.cpp | 24 ++++++++++++++++++++++-- src/object/task/taskgungoal.h | 2 ++ 2 files changed, 24 insertions(+), 2 deletions(-) (limited to 'src/object') diff --git a/src/object/task/taskgungoal.cpp b/src/object/task/taskgungoal.cpp index 3373610..c9c8d30 100644 --- a/src/object/task/taskgungoal.cpp +++ b/src/object/task/taskgungoal.cpp @@ -26,6 +26,7 @@ CTaskGunGoal::CTaskGunGoal(CObject* object) : CTask(object) { + m_aimImpossible = false; } // Object's destructor. @@ -116,6 +117,12 @@ Error CTaskGunGoal::Start(float dirV, float dirH) m_progress = 0.0f; + // direction was constrainted, hence resulting in impossible move + if (dirV != m_finalDirV || dirH != m_finalDirH) + { + m_aimImpossible = true; + } + return ERR_OK; } @@ -126,12 +133,25 @@ Error CTaskGunGoal::IsEnded() if ( m_engine->GetPause() ) return ERR_CONTINUE; if ( m_initialDirV == m_finalDirV && - m_initialDirH == m_finalDirH ) return ERR_STOP; - if ( m_progress < 1.0f ) return ERR_CONTINUE; + m_initialDirH == m_finalDirH ) + { + if ( m_aimImpossible ) + return ERR_AIM_IMPOSSIBLE; + else + return ERR_STOP; + } + + if ( m_progress < 1.0f ) return ERR_CONTINUE; m_object->SetGunGoalV(m_finalDirV); m_object->SetGunGoalH(m_finalDirH); Abort(); + + if ( m_aimImpossible ) + { + return ERR_AIM_IMPOSSIBLE; + } + return ERR_STOP; } diff --git a/src/object/task/taskgungoal.h b/src/object/task/taskgungoal.h index c6f010b..9fc509d 100644 --- a/src/object/task/taskgungoal.h +++ b/src/object/task/taskgungoal.h @@ -44,5 +44,7 @@ protected: float m_finalDirV; // direction to reach float m_initialDirH; // initial direction float m_finalDirH; // direction to reach + + bool m_aimImpossible; // set to true if impossible aim was set }; -- cgit v1.2.3-1-g7c22 From f71658e38dbcfc5635a6b2a9c6c4168582728bb5 Mon Sep 17 00:00:00 2001 From: krzys-h Date: Thu, 10 Apr 2014 21:50:26 +0200 Subject: Random relief generator --- src/object/robotmain.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/object') diff --git a/src/object/robotmain.cpp b/src/object/robotmain.cpp index 011cab8..256c362 100644 --- a/src/object/robotmain.cpp +++ b/src/object/robotmain.cpp @@ -4377,6 +4377,12 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject) m_terrain->LoadRelief(name, OpFloat(line, "factor", 1.0f), OpInt(line, "border", 1)); continue; } + + if (Cmd(line, "TerrainRandomRelief") && !resetObject) + { + m_terrain->RandomizeRelief(); + continue; + } if (Cmd(line, "TerrainResource") && !resetObject) { -- 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/object/robotmain.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/object') diff --git a/src/object/robotmain.cpp b/src/object/robotmain.cpp index 256c362..2424938 100644 --- a/src/object/robotmain.cpp +++ b/src/object/robotmain.cpp @@ -20,6 +20,7 @@ #include "CBot/CBotDll.h" #include "app/app.h" +#include "app/gamedata.h" #include "common/event.h" #include "common/global.h" @@ -4081,7 +4082,7 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject) if (Cmd(line, "Instructions") && !resetObject) { OpString(line, "name", name); - std::string path = m_app->GetDataFilePath(DIR_HELP, name); + std::string path = CGameData::GetInstancePointer()->GetFilePath(DIR_HELP, name); strcpy(m_infoFilename[SATCOM_HUSTON], path.c_str()); m_immediatSatCom = OpInt(line, "immediat", 0); @@ -4093,7 +4094,7 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject) if (Cmd(line, "Satellite") && !resetObject) { OpString(line, "name", name); - std::string path = m_app->GetDataFilePath(DIR_HELP, name); + std::string path = CGameData::GetInstancePointer()->GetFilePath(DIR_HELP, name); strcpy(m_infoFilename[SATCOM_SAT], path.c_str()); continue; } @@ -4101,7 +4102,7 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject) if (Cmd(line, "Loading") && !resetObject) { OpString(line, "name", name); - std::string path = m_app->GetDataFilePath(DIR_HELP, name); + std::string path = CGameData::GetInstancePointer()->GetFilePath(DIR_HELP, name); strcpy(m_infoFilename[SATCOM_LOADING], path.c_str()); continue; } @@ -4109,14 +4110,14 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject) if (Cmd(line, "HelpFile") && !resetObject) { OpString(line, "name", name); - std::string path = m_app->GetDataFilePath(DIR_HELP, name); + std::string path = CGameData::GetInstancePointer()->GetFilePath(DIR_HELP, name); strcpy(m_infoFilename[SATCOM_PROG], path.c_str()); continue; } if (Cmd(line, "SoluceFile") && !resetObject) { OpString(line, "name", name); - std::string path = m_app->GetDataFilePath(DIR_HELP, name); + std::string path = CGameData::GetInstancePointer()->GetFilePath(DIR_HELP, name); strcpy(m_infoFilename[SATCOM_SOLUCE], path.c_str()); continue; } -- 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/object/auto/autobase.cpp | 4 ---- src/object/brain.cpp | 20 -------------------- src/object/robotmain.cpp | 29 ----------------------------- src/object/task/taskterraform.cpp | 23 ----------------------- 4 files changed, 76 deletions(-) (limited to 'src/object') diff --git a/src/object/auto/autobase.cpp b/src/object/auto/autobase.cpp index 25320d3..af6c6e0 100644 --- a/src/object/auto/autobase.cpp +++ b/src/object/auto/autobase.cpp @@ -1356,11 +1356,7 @@ void CAutoBase::BeginTransit() } else { -#if _DEMO - m_bgBack = "back46b.png"; // paintings -#else m_bgBack = "back46.png"; // paintings -#endif } m_engine->SetFogStart(0.9f); // hardly any fog diff --git a/src/object/brain.cpp b/src/object/brain.cpp index b27acd1..4bd8742 100644 --- a/src/object/brain.cpp +++ b/src/object/brain.cpp @@ -1789,9 +1789,6 @@ bool CBrain::CreateInterface(bool bSelect) pos.x = ox+sx*13.4f; pos.y = oy+sy*0; -#if _TEEN - pw->CreateButton(pos, dim, 9, EVENT_OBJECT_RESET); -#else if ( m_object->GetTrainer() ) // Training? { pw->CreateButton(pos, dim, 9, EVENT_OBJECT_RESET); @@ -1800,7 +1797,6 @@ bool CBrain::CreateInterface(bool bSelect) { pw->CreateButton(pos, dim, 10, EVENT_OBJECT_DESELECT); } -#endif if ( type == OBJECT_MOBILEfa || type == OBJECT_MOBILEta || @@ -2459,17 +2455,10 @@ void CBrain::UpdateScript(Ui::CWindow *pw) char name[100]; char title[100]; int i; - bool bSoluce; pl = static_cast< Ui::CList* >(pw->SearchControl(EVENT_OBJECT_PROGLIST)); if ( pl == 0 ) return; -#if _SCHOOL - bSoluce = m_main->GetSoluce4(); -#else - bSoluce = true; -#endif - for ( i=0 ; iGetTitle(title); - if ( !bSoluce && i == 3 ) - { - title[0] = 0; - } if ( title[0] != 0 ) { sprintf(name, "%d: %s", i+1, title); @@ -2490,11 +2475,6 @@ void CBrain::UpdateScript(Ui::CWindow *pw) pl->SetItemName(i, name); } - if ( !bSoluce ) - { - pl->SetEnable(3, false); - } - pl->SetSelect(m_selScript); pl->ShowSelect(true); } diff --git a/src/object/robotmain.cpp b/src/object/robotmain.cpp index 2424938..76c234d 100644 --- a/src/object/robotmain.cpp +++ b/src/object/robotmain.cpp @@ -1083,9 +1083,6 @@ void CRobotMain::ChangePhase(Phase phase) m_sound->StopMusic(0.0f); m_camera->SetControllingObject(0); -/* TODO: #if _SCHOOL - if ( true ) -#else*/ if (m_gameTime > 10.0f) // did you play at least 10 seconds? { int rank = m_dialog->GetSceneRank(); @@ -1172,12 +1169,6 @@ void CRobotMain::ChangePhase(Phase phase) m_cmdEdit = false; // hidden for now // Creates the speedometer. -/* TODO: #if _TEEN - dim.x = 30.0f/640.0f; - dim.y = 20.0f/480.0f; - pos.x = 4.0f/640.0f; - pos.y = 454.0f/480.0f; -#else*/ dim.x = 30.0f/640.0f; dim.y = 20.0f/480.0f; pos.x = 4.0f/640.0f; @@ -1249,10 +1240,6 @@ void CRobotMain::ChangePhase(Phase phase) } else { -/* TODO: #if _TEEN - m_winTerminate = (m_endingWinRank == 900); - m_dialog->SetSceneName("teenw"); -#else*/ m_winTerminate = (m_endingWinRank == 904); m_dialog->SetSceneName("win"); @@ -1266,16 +1253,6 @@ void CRobotMain::ChangePhase(Phase phase) if (m_winTerminate) { -/* TODO: #if _TEEN - pos.x = ox+sx*3; pos.y = oy+sy*1; - ddim.x = dim.x*15; ddim.y = dim.y*2; - pe = m_interface->CreateEdit(pos, ddim, 0, EVENT_EDIT0); - pe->SetFontType(FONT_COLOBOT); - pe->SetEditCap(false); - pe->SetHiliteCap(false); - pe->ReadText("help/teenw.txt"); -#else*/ - pos.x = ox+sx*3; pos.y = oy+sy*0.2f; ddim.x = dim.x*15; ddim.y = dim.y*3.0f; pe = m_interface->CreateEdit(pos, ddim, 0, EVENT_EDIT0); @@ -2106,9 +2083,6 @@ void CRobotMain::ExecuteCmd(char *cmd) return; } -/* TODO: #if _TEEN - if (strcmp(cmd, "allteens") == 0) -#else*/ if (strcmp(cmd, "allmission") == 0) { m_showAll = !m_showAll; @@ -4771,9 +4745,6 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject) { sprintf(op, "script%d", i+1); // script1..script10 OpString(line, op, name); -/* TODO: #if _SCHOOL - if ( !m_dialog->GetSoluce4() && i == 3 ) continue; -#endif*/ if (name[0] != 0) brain->SetScriptName(i, name); diff --git a/src/object/task/taskterraform.cpp b/src/object/task/taskterraform.cpp index 096e5de..61ff045 100644 --- a/src/object/task/taskterraform.cpp +++ b/src/object/task/taskterraform.cpp @@ -76,15 +76,9 @@ bool CTaskTerraform::EventProcess(const Event &event) { if ( m_soundChannel == -1 ) { -#if _TEEN - m_soundChannel = m_sound->Play(SOUND_GGG, m_object->GetPosition(0), 1.0f, 0.5f, true); - m_sound->AddEnvelope(m_soundChannel, 1.0f, 2.0f, 1.5f, SOPER_CONTINUE); - m_sound->AddEnvelope(m_soundChannel, 0.0f, 0.5f, 0.5f, SOPER_STOP); -#else m_soundChannel = m_sound->Play(SOUND_GGG, m_object->GetPosition(0), 1.0f, 0.5f, true); m_sound->AddEnvelope(m_soundChannel, 1.0f, 2.0f, 4.0f, SOPER_CONTINUE); m_sound->AddEnvelope(m_soundChannel, 0.0f, 0.5f, 0.5f, SOPER_STOP); -#endif } dir.x = 0.0f; @@ -109,11 +103,7 @@ bool CTaskTerraform::EventProcess(const Event &event) if ( m_phase == TTP_DOWN ) { pos.x = 9.0f; -#if _TEEN - pos.y = 4.0f-m_progress*4.0f; -#else pos.y = 4.0f-m_progress*5.8f; -#endif pos.z = 0.0f; m_object->SetPosition(2, pos); } @@ -121,11 +111,7 @@ bool CTaskTerraform::EventProcess(const Event &event) if ( m_phase == TTP_UP ) { pos.x = 9.0f; -#if _TEEN - pos.y = 4.0f-(1.0f-m_progress)*4.0f; -#else pos.y = 4.0f-(1.0f-m_progress)*5.8f; -#endif pos.z = 0.0f; m_object->SetPosition(2, pos); } @@ -230,11 +216,7 @@ Error CTaskTerraform::Start() m_phase = TTP_CHARGE; m_progress = 0.0f; -#if _TEEN - m_speed = 1.0f/1.5f; -#else m_speed = 1.0f/4.0f; -#endif m_time = 0.0f; m_bError = false; // ok @@ -261,9 +243,6 @@ Error CTaskTerraform::IsEnded() if ( m_phase == TTP_CHARGE ) { -#if _TEEN - Terraform(); // changes the terrain. -#endif m_phase = TTP_DOWN; m_speed = 1.0f/0.2f; @@ -272,9 +251,7 @@ Error CTaskTerraform::IsEnded() if ( m_phase == TTP_DOWN ) { -#if !_TEEN Terraform(); // changes the terrain. -#endif m_object->SetCirVibration(Math::Vector(0.0f, 0.0f, 0.0f)); m_object->SetZoom(0, 1.0f); -- cgit v1.2.3-1-g7c22