diff options
Diffstat (limited to 'src/object')
51 files changed, 195 insertions, 159 deletions
diff --git a/src/object/README.txt b/src/object/README.txt index fe946db..4e21620 100644 --- a/src/object/README.txt +++ b/src/object/README.txt @@ -5,3 +5,4 @@ * Contains the main class of game engine - CRobotMain and the various in-game objects: * CObject and related auto, motion and task subclasses. */ + diff --git a/src/object/auto/auto.h b/src/object/auto/auto.h index e27804c..4a430ce 100644 --- a/src/object/auto/auto.h +++ b/src/object/auto/auto.h @@ -31,7 +31,7 @@ namespace Ui { class CDisplayText; class CInterface; class CWindow; -} /* Ui */ +} /* Ui */ namespace Gfx { @@ -44,7 +44,7 @@ class CCloud; class CCamera; class CPlanet; class CLightning; -} /* Gfx */ +} /* Gfx */ class CAuto diff --git a/src/object/auto/autoderrick.cpp b/src/object/auto/autoderrick.cpp index 260edcb..b613406 100644 --- a/src/object/auto/autoderrick.cpp +++ b/src/object/auto/autoderrick.cpp @@ -589,4 +589,3 @@ Error CAutoDerrick::GetError() return ERR_OK; } - diff --git a/src/object/auto/autodestroyer.cpp b/src/object/auto/autodestroyer.cpp index 8e3fa98..fdaebc0 100644 --- a/src/object/auto/autodestroyer.cpp +++ b/src/object/auto/autodestroyer.cpp @@ -82,8 +82,10 @@ Error CAutoDestroyer::StartAction(int param) scrap = SearchPlastic(); if ( scrap == nullptr ) return ERR_DESTROY_NOTFOUND; - else { - if ( m_phase == ADEP_WAIT ) { + else + { + if ( m_phase == ADEP_WAIT ) + { scrap->SetLock(true); // usable waste //? scrap->SetTruck(m_object); // usable waste @@ -93,7 +95,8 @@ Error CAutoDestroyer::StartAction(int param) m_progress = 0.0f; m_speed = 1.0f/1.0f; m_bExplo = false; - } else + } + else return ERR_GENERIC; } return ERR_OK; @@ -147,7 +150,8 @@ bool CAutoDestroyer::EventProcess(const Event &event) m_phase = ADEP_WAIT; // still waiting ... m_progress = 0.0f; m_speed = 1.0f/0.5f; - if (m_main->GetSelect() == m_object) { + if (m_main->GetSelect() == m_object) + { scrap = SearchPlastic(); if ( pw != 0 ) EnableInterface(pw, EVENT_OBJECT_BDESTROY, (scrap != 0)); } @@ -403,3 +407,4 @@ void CAutoDestroyer::EnableInterface(Ui::CWindow *pw, EventType event, bool bSta control->SetState(Ui::STATE_ENABLE, bState); } + diff --git a/src/object/auto/autoenergy.cpp b/src/object/auto/autoenergy.cpp index a0b4d85..6a8672b 100644 --- a/src/object/auto/autoenergy.cpp +++ b/src/object/auto/autoenergy.cpp @@ -649,3 +649,4 @@ bool CAutoEnergy::Read(char *line) return true; } + diff --git a/src/object/auto/autofactory.cpp b/src/object/auto/autofactory.cpp index fb82497..a648656 100644 --- a/src/object/auto/autofactory.cpp +++ b/src/object/auto/autofactory.cpp @@ -209,8 +209,8 @@ bool CAutoFactory::EventProcess(const Event &event) if ( event.type == EVENT_OBJECT_FACTORYrs ) type = OBJECT_MOBILErs; if ( event.type == EVENT_OBJECT_FACTORYsa ) type = OBJECT_MOBILEsa; - Error err = StartAction(type); - if( err != ERR_OK && err != ERR_GENERIC ) + Error err = StartAction(type); + if( err != ERR_OK && err != ERR_GENERIC ) m_displayText->DisplayError(err, m_object); if( err != ERR_GENERIC ) diff --git a/src/object/auto/autoflag.cpp b/src/object/auto/autoflag.cpp index 936546d..cc00db0 100644 --- a/src/object/auto/autoflag.cpp +++ b/src/object/auto/autoflag.cpp @@ -159,4 +159,3 @@ Error CAutoFlag::GetError() return ERR_OK; } - diff --git a/src/object/auto/autoinfo.cpp b/src/object/auto/autoinfo.cpp index e8f31c8..6d4a484 100644 --- a/src/object/auto/autoinfo.cpp +++ b/src/object/auto/autoinfo.cpp @@ -513,4 +513,3 @@ bool CAutoInfo::Read(char *line) return true; } - diff --git a/src/object/auto/autojostle.cpp b/src/object/auto/autojostle.cpp index df82ad5..5ce01c2 100644 --- a/src/object/auto/autojostle.cpp +++ b/src/object/auto/autojostle.cpp @@ -142,4 +142,3 @@ Error CAutoJostle::IsEnded() return m_error; } - diff --git a/src/object/auto/autokid.cpp b/src/object/auto/autokid.cpp index a9f86b0..7d61d64 100644 --- a/src/object/auto/autokid.cpp +++ b/src/object/auto/autokid.cpp @@ -197,4 +197,3 @@ Error CAutoKid::GetError() return ERR_OK; } - diff --git a/src/object/auto/autolabo.cpp b/src/object/auto/autolabo.cpp index 8424b93..172a618 100644 --- a/src/object/auto/autolabo.cpp +++ b/src/object/auto/autolabo.cpp @@ -177,8 +177,8 @@ bool CAutoLabo::EventProcess(const Event &event) Error err = ERR_GENERIC; if ( event.type == EVENT_OBJECT_RiPAW ) err = StartAction(RESEARCH_iPAW); if ( event.type == EVENT_OBJECT_RiGUN ) err = StartAction(RESEARCH_iGUN); - - if( err != ERR_OK && err != ERR_GENERIC ) + + if( err != ERR_OK && err != ERR_GENERIC ) m_displayText->DisplayError(err, m_object); if( err != ERR_GENERIC ) @@ -632,4 +632,3 @@ bool CAutoLabo::Read(char *line) return true; } - diff --git a/src/object/auto/automush.cpp b/src/object/auto/automush.cpp index e97e2a1..1e4796d 100644 --- a/src/object/auto/automush.cpp +++ b/src/object/auto/automush.cpp @@ -342,4 +342,3 @@ bool CAutoMush::Read(char *line) return true; } - diff --git a/src/object/auto/autonest.cpp b/src/object/auto/autonest.cpp index 1cf13d6..8a2d644 100644 --- a/src/object/auto/autonest.cpp +++ b/src/object/auto/autonest.cpp @@ -273,4 +273,3 @@ bool CAutoNest::Read(char *line) return true; } - diff --git a/src/object/auto/autonuclear.cpp b/src/object/auto/autonuclear.cpp index 75bfb45..224776d 100644 --- a/src/object/auto/autonuclear.cpp +++ b/src/object/auto/autonuclear.cpp @@ -484,4 +484,3 @@ bool CAutoNuclear::Read(char *line) return true; } - diff --git a/src/object/auto/autopara.cpp b/src/object/auto/autopara.cpp index ad6517b..24bc119 100644 --- a/src/object/auto/autopara.cpp +++ b/src/object/auto/autopara.cpp @@ -327,4 +327,3 @@ bool CAutoPara::Read(char *line) return true; } - diff --git a/src/object/auto/autoradar.cpp b/src/object/auto/autoradar.cpp index 1a10aa7..4afd3fe 100644 --- a/src/object/auto/autoradar.cpp +++ b/src/object/auto/autoradar.cpp @@ -305,4 +305,3 @@ bool CAutoRadar::SearchEnemy(Math::Vector &pos) return true; } - diff --git a/src/object/auto/autorepair.cpp b/src/object/auto/autorepair.cpp index 67aa9af..2f813f8 100644 --- a/src/object/auto/autorepair.cpp +++ b/src/object/auto/autorepair.cpp @@ -340,4 +340,3 @@ bool CAutoRepair::Read(char *line) return true; } - diff --git a/src/object/auto/autorepair.h b/src/object/auto/autorepair.h index 31a3c65..f522a55 100644 --- a/src/object/auto/autorepair.h +++ b/src/object/auto/autorepair.h @@ -63,4 +63,3 @@ protected: float m_lastParticle; }; - diff --git a/src/object/auto/autoresearch.cpp b/src/object/auto/autoresearch.cpp index 7564bb8..8308ebe 100644 --- a/src/object/auto/autoresearch.cpp +++ b/src/object/auto/autoresearch.cpp @@ -176,8 +176,8 @@ bool CAutoResearch::EventProcess(const Event &event) if ( event.type == EVENT_OBJECT_RPHAZER ) err = StartAction(RESEARCH_PHAZER); if ( event.type == EVENT_OBJECT_RSHIELD ) err = StartAction(RESEARCH_SHIELD); if ( event.type == EVENT_OBJECT_RATOMIC ) err = StartAction(RESEARCH_ATOMIC); - - if( err != ERR_OK && err != ERR_GENERIC ) + + if( err != ERR_OK && err != ERR_GENERIC ) m_displayText->DisplayError(err, m_object); if( err != ERR_GENERIC ) @@ -607,4 +607,3 @@ bool CAutoResearch::Read(char *line) return true; } - diff --git a/src/object/auto/autoroot.cpp b/src/object/auto/autoroot.cpp index a390e90..7e5c5e7 100644 --- a/src/object/auto/autoroot.cpp +++ b/src/object/auto/autoroot.cpp @@ -115,4 +115,3 @@ Error CAutoRoot::GetError() return ERR_OK; } - diff --git a/src/object/auto/autosafe.cpp b/src/object/auto/autosafe.cpp index 58c459a..2871a70 100644 --- a/src/object/auto/autosafe.cpp +++ b/src/object/auto/autosafe.cpp @@ -611,5 +611,3 @@ CObject* CAutoSafe::SearchVehicle() return 0; } - - diff --git a/src/object/auto/autostation.cpp b/src/object/auto/autostation.cpp index 4ace2ac..2c0aa02 100644 --- a/src/object/auto/autostation.cpp +++ b/src/object/auto/autostation.cpp @@ -368,4 +368,3 @@ void CAutoStation::UpdateInterface(float rTime) } } - diff --git a/src/object/auto/autotower.cpp b/src/object/auto/autotower.cpp index e3b06cf..17a41f4 100644 --- a/src/object/auto/autotower.cpp +++ b/src/object/auto/autotower.cpp @@ -397,7 +397,7 @@ void CAutoTower::FireStopUpdate(float progress, bool bLightOn) pos.y = 18.0f; pos.z = listpos[i*2+1]; pos = Transform(*mat, pos); - + m_partiStop[i] = m_particle->CreateParticle(pos, speed, dim, Gfx::PARTISELR, 1.0f, 0.0f, 0.0f); @@ -544,4 +544,3 @@ bool CAutoTower::Read(char *line) return true; } - diff --git a/src/object/brain.cpp b/src/object/brain.cpp index 4fab449..9e5149e 100644 --- a/src/object/brain.cpp +++ b/src/object/brain.cpp @@ -1312,7 +1312,8 @@ bool CBrain::CreateInterface(bool bSelect) type == OBJECT_WORM || type == OBJECT_CONTROLLER) // vehicle? { - if (!(m_main->GetRetroMode())) { + if (!(m_main->GetRetroMode())) + { ddim.x = dim.x*5.1f; ddim.y = dim.y*2.0f; // default => 2 pos.x = ox+sx*0.0f; diff --git a/src/object/brain.h b/src/object/brain.h index 38fb96f..dcf07a4 100644 --- a/src/object/brain.h +++ b/src/object/brain.h @@ -52,7 +52,7 @@ class CTerrain; class CWater; class CCamera; class CParticle; -} /* Gfx */ +} /* Gfx */ const int BRAINMAXSCRIPT = 10; diff --git a/src/object/mainmovie.cpp b/src/object/mainmovie.cpp index 04c0d56..85abee2 100644 --- a/src/object/mainmovie.cpp +++ b/src/object/mainmovie.cpp @@ -228,4 +228,3 @@ MainMovieType CMainMovie::GetStopType() return m_stopType; } - diff --git a/src/object/motion/motionant.cpp b/src/object/motion/motionant.cpp index 3eabc0e..16e53aa 100644 --- a/src/object/motion/motionant.cpp +++ b/src/object/motion/motionant.cpp @@ -831,4 +831,3 @@ bool CMotionAnt::EventFrame(const Event &event) return true; } - diff --git a/src/object/motion/motionbee.cpp b/src/object/motion/motionbee.cpp index a0f4734..2a052b2 100644 --- a/src/object/motion/motionbee.cpp +++ b/src/object/motion/motionbee.cpp @@ -610,4 +610,3 @@ bool CMotionBee::EventFrame(const Event &event) return true; } - diff --git a/src/object/motion/motiondummy.cpp b/src/object/motion/motiondummy.cpp index f25b81b..86e389e 100644 --- a/src/object/motion/motiondummy.cpp +++ b/src/object/motion/motiondummy.cpp @@ -81,4 +81,5 @@ bool CMotionDummy::Create(Math::Vector pos, float angle, ObjectType type, m_physics->SetCirMotionY(MO_STOACCEL, 2.0f); return true; -}
\ No newline at end of file +} + diff --git a/src/object/motion/motiondummy.h b/src/object/motion/motiondummy.h index de29148..2cb3a88 100644 --- a/src/object/motion/motiondummy.h +++ b/src/object/motion/motiondummy.h @@ -31,3 +31,4 @@ public: void DeleteObject(bool bAll=false); bool Create(Math::Vector pos, float angle, ObjectType type, float power); }; + diff --git a/src/object/motion/motionhuman.cpp b/src/object/motion/motionhuman.cpp index c469a7e..b1de44e 100644 --- a/src/object/motion/motionhuman.cpp +++ b/src/object/motion/motionhuman.cpp @@ -1735,4 +1735,3 @@ void CMotionHuman::StopDisplayPerso() m_bDisplayPerso = false; } - diff --git a/src/object/motion/motionmother.cpp b/src/object/motion/motionmother.cpp index c01dc66..03e7c21 100644 --- a/src/object/motion/motionmother.cpp +++ b/src/object/motion/motionmother.cpp @@ -493,4 +493,3 @@ bool CMotionMother::EventFrame(const Event &event) return true; } - diff --git a/src/object/motion/motionspider.cpp b/src/object/motion/motionspider.cpp index a9a9b9b..8d339b6 100644 --- a/src/object/motion/motionspider.cpp +++ b/src/object/motion/motionspider.cpp @@ -743,4 +743,3 @@ bool CMotionSpider::EventFrame(const Event &event) return true; } - diff --git a/src/object/motion/motiontoto.cpp b/src/object/motion/motiontoto.cpp index de473a1..b4ed89d 100644 --- a/src/object/motion/motiontoto.cpp +++ b/src/object/motion/motiontoto.cpp @@ -853,4 +853,3 @@ void CMotionToto::SetLinkType(ObjectType type) m_type = type; } - diff --git a/src/object/motion/motionvehicle.cpp b/src/object/motion/motionvehicle.cpp index 966fe75..a67ae24 100644 --- a/src/object/motion/motionvehicle.cpp +++ b/src/object/motion/motionvehicle.cpp @@ -1944,4 +1944,3 @@ void CMotionVehicle::SetTraceWidth(float width) m_traceWidth = width; } - diff --git a/src/object/motion/motionworm.cpp b/src/object/motion/motionworm.cpp index d153178..80bf7fc 100644 --- a/src/object/motion/motionworm.cpp +++ b/src/object/motion/motionworm.cpp @@ -91,7 +91,7 @@ bool CMotionWorm::Create(Math::Vector pos, float angle, ObjectType type, rank = m_engine->CreateObject(); m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_VEHICLE); // this is a moving object m_object->SetObjectRank(0, rank); - // This is an "empty" object, without triangles + // This is an "empty" object, without triangles m_object->SetPosition(0, pos); m_object->SetAngleY(0, angle); @@ -356,4 +356,3 @@ bool CMotionWorm::EventFrame(const Event &event) return true; } - diff --git a/src/object/object.cpp b/src/object/object.cpp index 5df4393..4cf0688 100644 --- a/src/object/object.cpp +++ b/src/object/object.cpp @@ -343,7 +343,7 @@ CObject::CObject() m_botVar = CBotVar::Create("", CBotTypResult(CBotTypClass, "object")); m_botVar->SetUserPtr(this); m_botVar->SetIdent(m_id); - + CObjectManager::GetInstancePointer()->AddInstance(this); } @@ -2146,10 +2146,12 @@ bool CObject::CreateVehicle(Math::Vector pos, float angle, ObjectType type, { m_motion = new CMotionHuman(this); } - else if ( type == OBJECT_CONTROLLER ) { + else if ( type == OBJECT_CONTROLLER ) + { m_motion = new CMotionDummy(this); //dummy object } - else { + else + { m_motion = new CMotionVehicle(this); } if ( m_motion == 0 ) return false; @@ -7391,4 +7393,3 @@ void CObject::SetTraceWidth(float width) mv->SetTraceWidth(width); } - diff --git a/src/object/objman.cpp b/src/object/objman.cpp index 76ab9b0..e4102b8 100644 --- a/src/object/objman.cpp +++ b/src/object/objman.cpp @@ -385,4 +385,5 @@ CObject* CObjectManager::CreateObject(Math::Vector pos, float angle, float zoom, } return object; -}
\ No newline at end of file +} + diff --git a/src/object/objman.h b/src/object/objman.h index c776a86..3087383 100644 --- a/src/object/objman.h +++ b/src/object/objman.h @@ -51,4 +51,3 @@ protected: int usedCount; }; - diff --git a/src/object/robotmain.cpp b/src/object/robotmain.cpp index 47c8d7f..3cd8384 100644 --- a/src/object/robotmain.cpp +++ b/src/object/robotmain.cpp @@ -706,7 +706,8 @@ CRobotMain::CRobotMain(CApplication* app, bool loadProfile) float fValue; int iValue; - if (loadProfile) { + if (loadProfile) + { if (GetProfile().GetLocalProfileFloat("Edit", "FontSize", fValue)) m_fontSize = fValue; if (GetProfile().GetLocalProfileFloat("Edit", "WindowPosX", fValue)) m_windowPos.x = fValue; if (GetProfile().GetLocalProfileFloat("Edit", "WindowPosY", fValue)) m_windowPos.y = fValue; @@ -719,7 +720,8 @@ CRobotMain::CRobotMain(CApplication* app, bool loadProfile) m_IOPos.x = (1.0f-m_IODim.x)/2.0f; // in the middle m_IOPos.y = (1.0f-m_IODim.y)/2.0f; - if (loadProfile) { + if (loadProfile) + { if (GetProfile().GetLocalProfileInt ("Edit", "IOPublic", iValue)) m_IOPublic = iValue; if (GetProfile().GetLocalProfileFloat("Edit", "IOPosX", fValue)) m_IOPos.x = fValue; if (GetProfile().GetLocalProfileFloat("Edit", "IOPosY", fValue)) m_IOPos.y = fValue; @@ -1281,7 +1283,7 @@ void CRobotMain::ChangePhase(Phase phase) ddim.x = dim.x*2; ddim.y = dim.y*2; m_interface->CreateButton(pos, ddim, 16, EVENT_BUTTON_OK); m_displayText->DisplayError(INFO_LOST, Math::Vector(0.0f,0.0f,0.0f), 15.0f, 60.0f, 1000.0f); - + StartMusic(); } } @@ -1530,9 +1532,8 @@ bool CRobotMain::EventProcess(Event &event) ChangePhase(PHASE_WIN); else if (m_lostDelay > 0.0f) ChangePhase(PHASE_LOST); - else if (!m_cmdEdit) { + else if (!m_cmdEdit) m_dialog->StartAbort(); // do you want to leave? - } } if (event.key.key == KEY(PAUSE)) { @@ -1842,7 +1843,8 @@ void CRobotMain::ExecuteCmd(char *cmd) if (strcmp(cmd, "controller") == 0) { - if (m_controller != nullptr) { + if (m_controller != nullptr) + { // Don't use SelectObject because it checks if the object is selectable if (m_camera->GetType() == Gfx::CAM_TYPE_VISIT) StopDisplayVisit(); @@ -1925,7 +1927,7 @@ void CRobotMain::ExecuteCmd(char *cmd) object->SetRange(object->GetRange()*10.0f); return; } - + if (strcmp(cmd, "\155\157\157") == 0) { // VGhpcyBpcyBlYXN0ZXItZWdnIGFuZCBzbyBpdCBzaG91bGQgYmUgb2JmdXNjYXRlZCEgRG8gbm90 @@ -2079,20 +2081,23 @@ void CRobotMain::ExecuteCmd(char *cmd) return; } - if (strcmp(cmd, "speed4") == 0) { + if (strcmp(cmd, "speed4") == 0) + { SetSpeed(4.0f); UpdateSpeedLabel(); - return; + return; } - if (strcmp(cmd, "speed8") == 0) { + if (strcmp(cmd, "speed8") == 0) + { SetSpeed(8.0f); UpdateSpeedLabel(); - return; + return; } - if (strcmp(cmd, "crazy") == 0) { + if (strcmp(cmd, "crazy") == 0) + { SetSpeed(1000.0f); UpdateSpeedLabel(); - return; + return; } if (m_phase == PHASE_SIMUL) @@ -2189,7 +2194,7 @@ void CRobotMain::StartDisplayInfo(const char *filename, int index) void CRobotMain::StopDisplayInfo() { if (m_cmdEdit) return; - + if (m_movieInfoIndex != -1) // film to read the SatCom? m_movie->Start(MM_SATCOMclose, 2.0f); @@ -3989,19 +3994,22 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject) // TODO: Fallback to an non-localized entry sprintf(op, "Title.%c", m_app->GetLanguageChar()); - if (Cmd(line, op) && !resetObject) { + if (Cmd(line, op) && !resetObject) + { OpString(line, "text", m_title); continue; } sprintf(op, "Resume.%c", m_app->GetLanguageChar()); - if (Cmd(line, op) && !resetObject) { + if (Cmd(line, op) && !resetObject) + { OpString(line, "text", m_resume); continue; } sprintf(op, "ScriptName.%c", m_app->GetLanguageChar()); - if (Cmd(line, op) && !resetObject) { + if (Cmd(line, op) && !resetObject) + { OpString(line, "text", m_scriptName); continue; } @@ -4010,7 +4018,8 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject) if (Cmd(line, "Resume")) continue; // Ignore if (Cmd(line, "ScriptName")) continue; // Ignore - if (Cmd(line, "ScriptFile") && !resetObject) { + if (Cmd(line, "ScriptFile") && !resetObject) + { OpString(line, "name", m_scriptFile); continue; } @@ -4022,7 +4031,7 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject) strcpy(m_infoFilename[SATCOM_HUSTON], path.c_str()); m_immediatSatCom = OpInt(line, "immediat", 0); - if(m_version >= 2) m_beginSatCom = m_lockedSatCom = OpInt(line, "lock", 0); + if (m_version >= 2) m_beginSatCom = m_lockedSatCom = OpInt(line, "lock", 0); continue; } @@ -4077,7 +4086,7 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject) m_sound->CacheMusic(filename); continue; } - + if (Cmd(line, "AudioChange") && !resetObject && m_version >= 2 && m_controller == nullptr) { int i = m_audioChangeTotal; @@ -4101,20 +4110,24 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject) if (Cmd(line, "Audio") && !resetObject && m_controller == nullptr) { - if(m_version < 2) { + if (m_version < 2) + { int trackid = OpInt(line, "track", 0); - if(trackid != 0) { + if (trackid != 0) + { std::stringstream filename; filename << "music" << std::setfill('0') << std::setw(3) << trackid << ".ogg"; m_audioTrack = filename.str(); } - } else { + } + else + { char trackname[100]; OpString(line, "filename", trackname); m_audioTrack = trackname; } m_audioRepeat = OpInt(line, "repeat", 1); - if(m_audioTrack != "") m_sound->CacheMusic(m_audioTrack); + if (m_audioTrack != "") m_sound->CacheMusic(m_audioTrack); continue; } @@ -4132,17 +4145,20 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject) continue; } - if (Cmd(line, "VehicleColor") && !resetObject) { + if (Cmd(line, "VehicleColor") && !resetObject) + { m_colorNewBot = OpColor(line, "color", Gfx::Color(0.533f, 0.533f, 0.533f, 0.533f)); continue; } - if (Cmd(line, "InsectColor") && !resetObject) { + if (Cmd(line, "InsectColor") && !resetObject) + { m_colorNewAlien = OpColor(line, "color", Gfx::Color(0.533f, 0.533f, 0.533f, 0.533f)); continue; } - if (Cmd(line, "GreeneryColor") && !resetObject) { + if (Cmd(line, "GreeneryColor") && !resetObject) + { m_colorNewGreen = OpColor(line, "color", Gfx::Color(0.533f, 0.533f, 0.533f, 0.533f)); continue; } @@ -4161,7 +4177,8 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject) continue; } - if (Cmd(line, "SecondTexture") && !resetObject) { + if (Cmd(line, "SecondTexture") && !resetObject) + { m_engine->SetSecondTexture(OpInt(line, "rank", 1)); continue; } @@ -4211,21 +4228,24 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject) g_unit = OpFloat(line, "unitScale", 4.0f); m_engine->SetTracePrecision(OpFloat(line, "traceQuality", 1.0f)); m_shortCut = OpInt(line, "shortcut", 1); - if(m_version >= 2) { + if (m_version >= 2) + { m_retroStyle = OpInt(line, "retro", 0); - if(m_retroStyle) GetLogger()->Info("Retro mode enabled.\n"); + if (m_retroStyle) GetLogger()->Info("Retro mode enabled.\n"); } continue; } if (Cmd(line, "TerrainGenerate") && !resetObject) { - if(m_terrainCreate) { + if (m_terrainCreate) + { GetLogger()->Error("Syntax error in file '%s' (line %d): TerrainGenerate after TerrainCreate\n", filename, lineNum); continue; } - if(m_terrainInit) { + if (m_terrainInit) + { GetLogger()->Error("Syntax error in file '%s' (line %d): TerrainGenerate after TerrainInit\n", filename, lineNum); continue; } @@ -4241,18 +4261,22 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject) continue; } - if (Cmd(line, "TerrainWind") && !resetObject) { - if(m_terrainCreate) { + if (Cmd(line, "TerrainWind") && !resetObject) + { + if (m_terrainCreate) + { GetLogger()->Error("Syntax error in file '%s' (line %d): TerrainWind after TerrainCreate\n", filename, lineNum); continue; } - if(m_terrainInit) { + if (m_terrainInit) + { GetLogger()->Error("Syntax error in file '%s' (line %d): TerrainWind after TerrainInit\n", filename, lineNum); continue; } - if(!m_terrainGenerate) { + if (!m_terrainGenerate) + { GetLogger()->Error("Syntax error in file '%s' (line %d): TerrainWind before TerrainGenerate\n", filename, lineNum); continue; } @@ -4263,17 +4287,20 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject) if (Cmd(line, "TerrainRelief") && !resetObject) { - if(m_terrainCreate) { + if (m_terrainCreate) + { GetLogger()->Error("Syntax error in file '%s' (line %d): TerrainRelief after TerrainCreate\n", filename, lineNum); continue; } - if(m_terrainInit) { + if (m_terrainInit) + { GetLogger()->Error("Syntax error in file '%s' (line %d): TerrainRelief after TerrainInit\n", filename, lineNum); continue; } - if(!m_terrainGenerate) { + if (!m_terrainGenerate) + { GetLogger()->Error("Syntax error in file '%s' (line %d): TerrainRelief before TerrainGenerate\n", filename, lineNum); continue; } @@ -4285,17 +4312,20 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject) if (Cmd(line, "TerrainResource") && !resetObject) { - if(m_terrainCreate) { + if (m_terrainCreate) + { GetLogger()->Error("Syntax error in file '%s' (line %d): TerrainResource after TerrainCreate\n", filename, lineNum); continue; } - if(m_terrainInit) { + if (m_terrainInit) + { GetLogger()->Error("Syntax error in file '%s' (line %d): TerrainResource after TerrainInit\n", filename, lineNum); continue; } - if(!m_terrainGenerate) { + if (!m_terrainGenerate) + { GetLogger()->Error("Syntax error in file '%s' (line %d): TerrainResource before TerrainGenerate\n", filename, lineNum); continue; } @@ -4325,7 +4355,8 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject) continue; } - if (Cmd(line, "TerrainLava") && !resetObject) { + if (Cmd(line, "TerrainLava") && !resetObject) + { m_water->SetLava(OpInt(line, "mode", 0)); continue; } @@ -4350,7 +4381,8 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject) if (Cmd(line, "TerrainInitTextures") && !resetObject) { - if(m_terrainInit) { + if (m_terrainInit) + { GetLogger()->Error("Syntax error in file '%s' (line %d): TerrainInitTextures and TerrainInit at same time\n", filename, lineNum); continue; } @@ -4373,8 +4405,10 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject) continue; } - if (Cmd(line, "TerrainInit") && !resetObject) { - if(m_terrainInitTextures) { + if (Cmd(line, "TerrainInit") && !resetObject) + { + if (m_terrainInitTextures) + { GetLogger()->Error("Syntax error in file '%s' (line %d): TerrainInit and TerrainInitTextures at same time\n", filename, lineNum); continue; } @@ -4386,24 +4420,28 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject) if (Cmd(line, "TerrainMaterial") && !resetObject) { - if(m_terrainCreate) { + if (m_terrainCreate) + { GetLogger()->Error("Syntax error in file '%s' (line %d): TerrainMaterial after TerrainCreate\n", filename, lineNum); continue; } - if(m_terrainInit) { + if (m_terrainInit) + { GetLogger()->Error("Syntax error in file '%s' (line %d): TerrainMaterial after TerrainInit\n", filename, lineNum); continue; } - if(m_terrainInitTextures) { + if (m_terrainInitTextures) + { GetLogger()->Error("Syntax error in file '%s' (line %d): TerrainMaterial and TerrainInitTextures at same time\n", filename, lineNum); continue; } OpString(line, "image", name); AddExt(name, ".png"); - if (strstr(name, "%user%") != 0) { + if (strstr(name, "%user%") != 0) + { GetProfile().CopyFileToTemp(std::string(name)); } @@ -4421,22 +4459,26 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject) if (Cmd(line, "TerrainLevel") && !resetObject) { - if(m_terrainCreate) { + if (m_terrainCreate) + { GetLogger()->Error("Syntax error in file '%s' (line %d): TerrainLevel after TerrainCreate\n", filename, lineNum); continue; } - if(!m_terrainInit) { + if (!m_terrainInit) + { GetLogger()->Error("Syntax error in file '%s' (line %d): TerrainLevel before TerrainInit\n", filename, lineNum); continue; } - if(m_terrainInitTextures) { + if (m_terrainInitTextures) + { GetLogger()->Error("Syntax error in file '%s' (line %d): TerrainLevel and TerrainInitTextures at same time\n", filename, lineNum); continue; } - if(!m_terrainGenerate) { + if (!m_terrainGenerate) + { GetLogger()->Error("Syntax error in file '%s' (line %d): TerrainLevel before TerrainGenerate\n", filename, lineNum); continue; } @@ -4460,7 +4502,8 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject) continue; } - if (Cmd(line, "TerrainCreate") && !resetObject) { + if (Cmd(line, "TerrainCreate") && !resetObject) + { m_terrain->CreateObjects(); m_terrainCreate = true; continue; @@ -4480,7 +4523,9 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject) if (Cmd(line, "MissionController") && read[0] == 0 && m_version >= 2) { - /*if (!m_beginObject) { + /* TODO: ??? + if (!m_beginObject) + { GetLogger()->Error("Syntax error in file '%s' (line %d): MissionController before BeginObject\n", filename, lineNum); continue; }*/ @@ -4500,7 +4545,8 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject) if (Cmd(line, "CreateObject") && read[0] == 0) { - if (!m_beginObject) { + if (!m_beginObject) + { GetLogger()->Error("Syntax error in file '%s' (line %d): CreateObject before BeginObject\n", filename, lineNum); continue; } @@ -4614,11 +4660,13 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject) obj->SetClip(OpInt(line, "clip", 1)); obj->SetCheckToken(m_version >= 2 ? trainer || !selectable : OpInt(line, "checkToken", 1)); // SetManual will affect bot speed - if (type == OBJECT_MOBILEdr) { + if (type == OBJECT_MOBILEdr) + { obj->SetManual(m_version >= 2 ? !trainer : OpInt(line, "manual", 0)); } - if(m_version >= 2) { + if (m_version >= 2) + { Math::Vector zoom = OpDir(line, "zoom"); if (zoom.x != 0.0f || zoom.y != 0.0f || zoom.z != 0.0f) obj->SetZoom(0, zoom); @@ -4774,7 +4822,8 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject) continue; } - if (Cmd(line, "WaterColor") && !resetObject) { + if (Cmd(line, "WaterColor") && !resetObject) + { m_engine->SetWaterAddColor(OpColor(line, "color", Gfx::Color(0.0f, 0.0f, 0.0f, 1.0f))); continue; } @@ -4846,12 +4895,15 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject) 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); - } else { - m_endTake[i].powermin = -1; - m_endTake[i].powermax = 100; + if (m_version >= 2) + { + m_endTake[i].powermin = OpInt(line, "powermin", -1); + m_endTake[i].powermax = OpInt(line, "powermax", 100); + } + else + { + m_endTake[i].powermin = -1; + m_endTake[i].powermax = 100; } m_endTake[i].lost = OpInt(line, "lost", -1); m_endTake[i].immediat = OpInt(line, "immediat", 0); @@ -4899,17 +4951,20 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject) continue; } - if (Cmd(line, "EnableBuild") && !resetObject) { + if (Cmd(line, "EnableBuild") && !resetObject) + { g_build |= OpBuild(line, "type"); continue; } - if (Cmd(line, "EnableResearch") && !resetObject) { + if (Cmd(line, "EnableResearch") && !resetObject) + { g_researchEnable |= OpResearch(line, "type"); continue; } - if (Cmd(line, "DoneResearch") && read[0] == 0 && !resetObject) { // not loading file? + if (Cmd(line, "DoneResearch") && read[0] == 0 && !resetObject) // not loading file? + { g_researchDone |= OpResearch(line, "type"); continue; } @@ -4922,7 +4977,7 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject) } if (line[0] == '\n') continue; // Ignore empty lines - if (line[0] == '\0') continue; // Ignore empty lines + if (line[0] == '\0') continue; // Ignore empty lines if (read[0] != 0) continue; // Ignore when loading saved game GetLogger()->Error("Syntax error in file '%s' (line %d): Unknown command: %s", filename, lineNum, line); // Don't add \n at the end of log message - it's included in line variable @@ -6207,7 +6262,7 @@ bool CRobotMain::IsBusy() void CRobotMain::IOWriteObject(FILE *file, CObject* obj, const char *cmd) { if (obj->GetType() == OBJECT_FIX) return; - + SetNumericLocale(); char line[3000]; @@ -6296,7 +6351,7 @@ void CRobotMain::IOWriteObject(FILE *file, CObject* obj, const char *cmd) strcat(line, "\n"); fputs(line, file); - + RestoreNumericLocale(); } @@ -6305,7 +6360,7 @@ bool CRobotMain::IOWriteScene(const char *filename, const char *filecbot, char * { FILE* file = fopen(filename, "w"); if (file == NULL) return false; - + SetNumericLocale(); char line[500]; @@ -6369,7 +6424,7 @@ bool CRobotMain::IOWriteScene(const char *filename, const char *filecbot, char * SaveFileScript(obj, filename, objRank++); } fclose(file); - + RestoreNumericLocale(); #if CBOT_STACK @@ -6417,7 +6472,7 @@ CObject* CRobotMain::IOReadObject(char *line, const char* filename, int objRank) return nullptr; SetNumericLocale(); - + int trainer = OpInt(line, "trainer", 0); int toy = OpInt(line, "toy", 0); int option = OpInt(line, "option", 0); @@ -6484,7 +6539,7 @@ CObject* CRobotMain::IOReadObject(char *line, const char* filename, int objRank) } RestoreNumericLocale(); - + return obj; } @@ -6495,7 +6550,7 @@ CObject* CRobotMain::IOReadScene(const char *filename, const char *filecbot) FILE* file = fopen(filename, "r"); if (file == NULL) return 0; - + SetNumericLocale(); CObject* fret = nullptr; @@ -6811,7 +6866,7 @@ void CRobotMain::UpdateAudio(bool frame) for (int t = 0; t < m_audioChangeTotal; t++) { - if(m_audioChange[t].changed) continue; + if (m_audioChange[t].changed) continue; Math::Vector bPos = m_audioChange[t].pos; bPos.y = 0.0f; @@ -6843,7 +6898,8 @@ void CRobotMain::UpdateAudio(bool frame) float energyLevel = -1; CObject* power = obj->GetPower(); - if (power != nullptr) { + if (power != nullptr) + { energyLevel = power->GetEnergy(); if (power->GetType() == OBJECT_ATOMIC) energyLevel *= 100; } @@ -6873,7 +6929,8 @@ void CRobotMain::UpdateAudio(bool frame) void CRobotMain::SetEndMission(Error result, float delay) { - if (m_controller != nullptr) { + if (m_controller != nullptr) + { m_endTakeWinDelay = delay; m_endTakeLostDelay = delay; m_missionResult = result; @@ -6883,22 +6940,25 @@ void CRobotMain::SetEndMission(Error result, float delay) //! Checks if the mission is over Error CRobotMain::CheckEndMission(bool frame) { - if (m_controller != nullptr) { - if (m_missionResult == INFO_LOST) { //mission lost? + if (m_controller != nullptr) + { + if (m_missionResult == INFO_LOST) //mission lost? + { m_displayText->DisplayError(INFO_LOST, Math::Vector(0.0f,0.0f,0.0f)); m_winDelay = 0.0f; - if(m_lostDelay == 0) m_lostDelay = m_endTakeLostDelay; + if (m_lostDelay == 0) m_lostDelay = m_endTakeLostDelay; m_displayText->SetEnable(false); } - if (m_missionResult == INFO_LOSTq) { //mission lost? + if (m_missionResult == INFO_LOSTq) //mission lost? + { m_winDelay = 0.0f; - if(m_lostDelay == 0) m_lostDelay = 0.1f; + if (m_lostDelay == 0) m_lostDelay = 0.1f; m_displayText->SetEnable(false); } if (frame && m_base) return ERR_MISSION_NOTERM; if (m_missionResult == ERR_OK) { //mission win? m_displayText->DisplayError(INFO_WIN, Math::Vector(0.0f,0.0f,0.0f)); - if(m_winDelay == 0) m_winDelay = m_endTakeWinDelay; + if (m_winDelay == 0) m_winDelay = m_endTakeWinDelay; m_lostDelay = 0.0f; m_displayText->SetEnable(false); } @@ -6942,7 +7002,8 @@ Error CRobotMain::CheckEndMission(bool frame) float energyLevel = -1; CObject* power = obj->GetPower(); - if (power != nullptr) { + if (power != nullptr) + { energyLevel = power->GetEnergy(); if (power->GetType() == OBJECT_ATOMIC) energyLevel *= 100; } @@ -7417,7 +7478,7 @@ void CRobotMain::StartMusic() { m_sound->StopMusic(); m_sound->PlayMusic(m_audioTrack, m_audioRepeat); - } + } } //! Removes hilite and tooltip @@ -7440,4 +7501,4 @@ void CRobotMain::RestoreNumericLocale() { setlocale(LC_NUMERIC, m_oldLocale.c_str()); } - + diff --git a/src/object/robotmain.h b/src/object/robotmain.h index a459a59..a75509d 100644 --- a/src/object/robotmain.h +++ b/src/object/robotmain.h @@ -370,7 +370,7 @@ public: CObject* IOReadObject(char *line, const char* filename, int objRank); int CreateSpot(Math::Vector pos, Gfx::Color color); - + void SetNumericLocale(); void RestoreNumericLocale(); @@ -412,7 +412,7 @@ protected: void ExecuteCmd(char *cmd); bool TestGadgetQuantity(int rank); void UpdateSpeedLabel(); - + protected: CApplication* m_app; @@ -544,7 +544,7 @@ protected: bool m_endTakeNever; float m_endTakeWinDelay; float m_endTakeLostDelay; - + int m_audioChangeTotal; AudioChange m_audioChange[10]; @@ -571,7 +571,7 @@ protected: Gfx::Color m_colorRefWater; Gfx::Color m_colorNewWater; float m_colorShiftWater; - + std::string m_oldLocale; }; diff --git a/src/object/task/task.cpp b/src/object/task/task.cpp index 39fdccf..5ec6f8a 100644 --- a/src/object/task/task.cpp +++ b/src/object/task/task.cpp @@ -81,4 +81,3 @@ bool CTask::Abort() return true; } - diff --git a/src/object/task/task.h b/src/object/task/task.h index 12961ef..41b3d3b 100644 --- a/src/object/task/task.h +++ b/src/object/task/task.h @@ -34,7 +34,7 @@ class CSoundInterface; namespace Ui { class CDisplayText; -} /* Ui */ +} /* Ui */ namespace Gfx { class CEngine; @@ -43,7 +43,7 @@ class CParticle; class CTerrain; class CWater; class CCamera; -} /* Gfx */ +} /* Gfx */ const float TAKE_DIST = 6.0f; // distance to an object to pick it diff --git a/src/object/task/taskadvance.cpp b/src/object/task/taskadvance.cpp index 58eb939..885e100 100644 --- a/src/object/task/taskadvance.cpp +++ b/src/object/task/taskadvance.cpp @@ -139,4 +139,3 @@ Error CTaskAdvance::IsEnded() return ERR_CONTINUE; } - diff --git a/src/object/task/taskgoto.cpp b/src/object/task/taskgoto.cpp index b3a7221..01ff38b 100644 --- a/src/object/task/taskgoto.cpp +++ b/src/object/task/taskgoto.cpp @@ -90,7 +90,8 @@ bool CTaskGoto::EventProcess(const Event &event) rot.x = m_leakPos.x-pos.x; rot.y = m_leakPos.z-pos.z; dist = Math::Point(rot.x, rot.y).Length(); - if (dist != 0) { + if (dist != 0) + { rot.x /= dist; rot.y /= dist; } @@ -2231,4 +2232,3 @@ bool CTaskGoto::BitmapTestDot(int rank, int x, int y) return m_bmArray[rank*m_bmLine*m_bmSize + m_bmLine*y + x/8] & (1<<x%8); } - diff --git a/src/object/task/taskmanager.cpp b/src/object/task/taskmanager.cpp index a2ce8b8..11fba6c 100644 --- a/src/object/task/taskmanager.cpp +++ b/src/object/task/taskmanager.cpp @@ -271,4 +271,3 @@ bool CTaskManager::Abort() return m_task->Abort(); } - diff --git a/src/object/task/tasksearch.cpp b/src/object/task/tasksearch.cpp index e2c2524..974a53d 100644 --- a/src/object/task/tasksearch.cpp +++ b/src/object/task/tasksearch.cpp @@ -220,10 +220,11 @@ bool CTaskSearch::Abort() { m_hand = TSH_UP; InitAngle(); - for (int i = 0; i < 3; i++) { + for (int i = 0; i < 3; i++) + { m_object->SetAngleZ(i+1, m_finalAngle[i]); } - + m_camera->StopCentering(m_object, 2.0f); m_physics->SetFreeze(false); // is moving again return true; @@ -325,4 +326,3 @@ void CTaskSearch::DeleteMark(ObjectType type) } } - diff --git a/src/object/task/taskshield.cpp b/src/object/task/taskshield.cpp index 929dd5c..fe6eaeb 100644 --- a/src/object/task/taskshield.cpp +++ b/src/object/task/taskshield.cpp @@ -552,5 +552,3 @@ float CTaskShield::GetRadius() return RADIUS_SHIELD_MIN + (RADIUS_SHIELD_MAX-RADIUS_SHIELD_MIN)*m_object->GetParam(); } - - diff --git a/src/object/task/tasktake.cpp b/src/object/task/tasktake.cpp index 0037f85..c7f0530 100644 --- a/src/object/task/tasktake.cpp +++ b/src/object/task/tasktake.cpp @@ -598,4 +598,3 @@ bool CTaskTake::IsFreeDeposeObject(Math::Vector pos) return true; // location free } - diff --git a/src/object/task/taskturn.cpp b/src/object/task/taskturn.cpp index 7a924cb..bf9d593 100644 --- a/src/object/task/taskturn.cpp +++ b/src/object/task/taskturn.cpp @@ -126,4 +126,3 @@ Error CTaskTurn::IsEnded() return ERR_CONTINUE; } - diff --git a/src/object/task/taskwait.cpp b/src/object/task/taskwait.cpp index 3e201e0..5b9fdb3 100644 --- a/src/object/task/taskwait.cpp +++ b/src/object/task/taskwait.cpp @@ -64,4 +64,3 @@ Error CTaskWait::IsEnded() return ERR_CONTINUE; } - |