diff options
Diffstat (limited to 'src/object')
38 files changed, 156 insertions, 209 deletions
diff --git a/src/object/auto/auto.cpp b/src/object/auto/auto.cpp index 509904c..711497d 100644 --- a/src/object/auto/auto.cpp +++ b/src/object/auto/auto.cpp @@ -15,8 +15,6 @@ // * along with this program. If not, see http://www.gnu.org/licenses/. -#include <stdio.h> - #include "object/auto/auto.h" @@ -26,7 +24,8 @@ #include "ui/gauge.h" #include "ui/window.h" - +#include <stdio.h> +#include <string.h> // Object's constructor. diff --git a/src/object/auto/auto.h b/src/object/auto/auto.h index dd55904..2194924 100644 --- a/src/object/auto/auto.h +++ b/src/object/auto/auto.h @@ -19,7 +19,7 @@ #pragma once -#include "common/misc.h" +#include "common/global.h" #include "object/object.h" diff --git a/src/object/auto/autoconvert.cpp b/src/object/auto/autoconvert.cpp index 14fa4cf..ec4392b 100644 --- a/src/object/auto/autoconvert.cpp +++ b/src/object/auto/autoconvert.cpp @@ -16,8 +16,6 @@ // * along with this program. If not, see http://www.gnu.org/licenses/. -#include <stdio.h> - #include "object/auto/autoconvert.h" #include "common/iman.h" @@ -27,7 +25,8 @@ #include "ui/window.h" #include "ui/displaytext.h" - +#include <stdio.h> +#include <string.h> // Object's constructor. diff --git a/src/object/auto/autoderrick.cpp b/src/object/auto/autoderrick.cpp index 432c5ea..3578c0d 100644 --- a/src/object/auto/autoderrick.cpp +++ b/src/object/auto/autoderrick.cpp @@ -16,8 +16,6 @@ // * along with this program. If not, see http://www.gnu.org/licenses/. -#include <stdio.h> - #include "object/auto/autoderrick.h" #include "common/iman.h" @@ -28,7 +26,8 @@ #include "ui/window.h" #include "ui/displaytext.h" - +#include <stdio.h> +#include <string.h> const float DERRICK_DELAY = 10.0f; // duration of the extraction diff --git a/src/object/auto/autodestroyer.cpp b/src/object/auto/autodestroyer.cpp index d91af29..740f600 100644 --- a/src/object/auto/autodestroyer.cpp +++ b/src/object/auto/autodestroyer.cpp @@ -16,8 +16,6 @@ // * along with this program. If not, see http://www.gnu.org/licenses/. -#include <stdio.h> - #include "object/auto/autodestroyer.h" #include "common/iman.h" @@ -25,7 +23,8 @@ #include "ui/interface.h" #include "ui/window.h" - +#include <stdio.h> +#include <string.h> // Object's constructor. diff --git a/src/object/auto/autoegg.cpp b/src/object/auto/autoegg.cpp index 04d03f9..35a6add 100644 --- a/src/object/auto/autoegg.cpp +++ b/src/object/auto/autoegg.cpp @@ -16,15 +16,14 @@ // * along with this program. If not, see http://www.gnu.org/licenses/. -#include <stdio.h> - #include "object/auto/autoegg.h" #include "math/geometry.h" #include "common/iman.h" #include "script/cmdtoken.h" - +#include <stdio.h> +#include <string.h> // Object's constructor. diff --git a/src/object/auto/autoenergy.cpp b/src/object/auto/autoenergy.cpp index d0117ab..18a21ab 100644 --- a/src/object/auto/autoenergy.cpp +++ b/src/object/auto/autoenergy.cpp @@ -16,8 +16,6 @@ // * along with this program. If not, see http://www.gnu.org/licenses/. -#include <stdio.h> - #include "object/auto/autoenergy.h" #include "common/iman.h" @@ -29,6 +27,8 @@ #include "ui/window.h" #include "ui/displaytext.h" +#include <stdio.h> +#include <string.h> const float ENERGY_POWER = 0.4f; // Necessary energy for a battery diff --git a/src/object/auto/autofactory.cpp b/src/object/auto/autofactory.cpp index 8e7d480..0789443 100644 --- a/src/object/auto/autofactory.cpp +++ b/src/object/auto/autofactory.cpp @@ -16,8 +16,6 @@ // * along with this program. If not, see http://www.gnu.org/licenses/. -#include <stdio.h> - #include "object/auto/autofactory.h" #include "common/global.h" @@ -30,7 +28,8 @@ #include "ui/window.h" #include "ui/displaytext.h" - +#include <stdio.h> +#include <string.h> diff --git a/src/object/auto/autoflag.cpp b/src/object/auto/autoflag.cpp index acab2d0..e88ee3a 100644 --- a/src/object/auto/autoflag.cpp +++ b/src/object/auto/autoflag.cpp @@ -16,13 +16,13 @@ // * along with this program. If not, see http://www.gnu.org/licenses/. -#include <stdio.h> - #include "object/auto/autoflag.h" #include "math/geometry.h" #include "graphics/engine/terrain.h" +#include <stdio.h> + #define ADJUST_ANGLE false // true -> adjusts the angles of the members diff --git a/src/object/auto/autohuston.cpp b/src/object/auto/autohuston.cpp index 1dd92f0..1e81a65 100644 --- a/src/object/auto/autohuston.cpp +++ b/src/object/auto/autohuston.cpp @@ -16,14 +16,12 @@ // * along with this program. If not, see http://www.gnu.org/licenses/. -#include <stdio.h> - #include "object/auto/autohuston.h" #include "ui/interface.h" #include "ui/window.h" - +#include <stdio.h> // Object's constructor. diff --git a/src/object/auto/autoinfo.cpp b/src/object/auto/autoinfo.cpp index 1edd5e0..78cc249 100644 --- a/src/object/auto/autoinfo.cpp +++ b/src/object/auto/autoinfo.cpp @@ -16,8 +16,6 @@ // * along with this program. If not, see http://www.gnu.org/licenses/. -#include <stdio.h> - #include "object/auto/autoinfo.h" #include "script/cmdtoken.h" @@ -25,7 +23,8 @@ #include "ui/list.h" #include "ui/window.h" - +#include <stdio.h> +#include <string.h> diff --git a/src/object/auto/autojostle.cpp b/src/object/auto/autojostle.cpp index 68fe6d1..788b562 100644 --- a/src/object/auto/autojostle.cpp +++ b/src/object/auto/autojostle.cpp @@ -16,11 +16,9 @@ // * along with this program. If not, see http://www.gnu.org/licenses/. -#include <stdio.h> - #include "object/auto/autojostle.h" - +#include <stdio.h> // Object's constructor. diff --git a/src/object/auto/autokid.cpp b/src/object/auto/autokid.cpp index 0ffbd7f..7004e6b 100644 --- a/src/object/auto/autokid.cpp +++ b/src/object/auto/autokid.cpp @@ -16,13 +16,12 @@ // * along with this program. If not, see http://www.gnu.org/licenses/. -#include <stdio.h> - #include "object/auto/autokid.h" #include "graphics/engine/particle.h" #include "graphics/engine/water.h" +#include <stdio.h> // Object's constructor. diff --git a/src/object/auto/autolabo.cpp b/src/object/auto/autolabo.cpp index c5e4c82..af780e0 100644 --- a/src/object/auto/autolabo.cpp +++ b/src/object/auto/autolabo.cpp @@ -16,8 +16,6 @@ // * along with this program. If not, see http://www.gnu.org/licenses/. -#include <stdio.h> - #include "object/auto/autolabo.h" #include "common/global.h" @@ -29,6 +27,8 @@ #include "ui/window.h" #include "ui/displaytext.h" +#include <stdio.h> +#include <string.h> const float LABO_DELAY = 20.0f; // duration of the analysis diff --git a/src/object/auto/automush.cpp b/src/object/auto/automush.cpp index 0b1608b..d7aa98e 100644 --- a/src/object/auto/automush.cpp +++ b/src/object/auto/automush.cpp @@ -16,14 +16,14 @@ // * along with this program. If not, see http://www.gnu.org/licenses/. -#include <stdio.h> - #include "object/auto/automush.h" #include "common/iman.h" #include "script/cmdtoken.h" +#include <stdio.h> +#include <string.h> // Object's constructor. diff --git a/src/object/auto/autonest.cpp b/src/object/auto/autonest.cpp index d7f94e1..4a8132a 100644 --- a/src/object/auto/autonest.cpp +++ b/src/object/auto/autonest.cpp @@ -16,15 +16,14 @@ // * along with this program. If not, see http://www.gnu.org/licenses/. -#include <stdio.h> - #include "object/auto/autonest.h" #include "common/iman.h" #include "graphics/engine/terrain.h" #include "script/cmdtoken.h" - +#include <stdio.h> +#include <string.h> // Object's constructor. diff --git a/src/object/auto/autonuclear.cpp b/src/object/auto/autonuclear.cpp index d8a3bdf..bb20dde 100644 --- a/src/object/auto/autonuclear.cpp +++ b/src/object/auto/autonuclear.cpp @@ -16,8 +16,6 @@ // * along with this program. If not, see http://www.gnu.org/licenses/. -#include <stdio.h> - #include "object/auto/autonuclear.h" #include "common/iman.h" @@ -27,6 +25,8 @@ #include "ui/window.h" #include "ui/displaytext.h" +#include <stdio.h> +#include <string.h> const float NUCLEAR_DELAY = 30.0f; // duration of the generation diff --git a/src/object/auto/autopara.cpp b/src/object/auto/autopara.cpp index 973a847..b52344f 100644 --- a/src/object/auto/autopara.cpp +++ b/src/object/auto/autopara.cpp @@ -16,8 +16,6 @@ // * along with this program. If not, see http://www.gnu.org/licenses/. -#include <stdio.h> - #include "object/auto/autopara.h" @@ -27,6 +25,8 @@ #include "ui/interface.h" #include "ui/window.h" +#include <stdio.h> +#include <string.h> diff --git a/src/object/auto/autoportico.cpp b/src/object/auto/autoportico.cpp index 3d93411..01c981d 100644 --- a/src/object/auto/autoportico.cpp +++ b/src/object/auto/autoportico.cpp @@ -16,14 +16,13 @@ // * along with this program. If not, see http://www.gnu.org/licenses/. -#include <stdio.h> - #include "object/auto/autoportico.h" #include "object/robotmain.h" - +#include <stdio.h> +#include <string.h> const int PARAM_DEPOSE = 2; // run=2 -> deposits the spaceship diff --git a/src/object/auto/autoradar.cpp b/src/object/auto/autoradar.cpp index 224246c..b586521 100644 --- a/src/object/auto/autoradar.cpp +++ b/src/object/auto/autoradar.cpp @@ -16,8 +16,6 @@ // * along with this program. If not, see http://www.gnu.org/licenses/. -#include <stdio.h> - #include "object/auto/autoradar.h" #include "common/iman.h" @@ -26,6 +24,8 @@ #include "ui/window.h" #include "ui/gauge.h" +#include <stdio.h> + // Object's constructor. diff --git a/src/object/auto/autorepair.cpp b/src/object/auto/autorepair.cpp index 2f679fa..4662699 100644 --- a/src/object/auto/autorepair.cpp +++ b/src/object/auto/autorepair.cpp @@ -16,8 +16,6 @@ // * along with this program. If not, see http://www.gnu.org/licenses/. -#include <stdio.h> - #include "object/auto/autorepair.h" #include "common/iman.h" @@ -26,6 +24,9 @@ #include "ui/interface.h" #include "ui/window.h" +#include <stdio.h> +#include <string.h> + // Object's constructor. diff --git a/src/object/auto/autoresearch.cpp b/src/object/auto/autoresearch.cpp index c2395e8..a3ce464 100644 --- a/src/object/auto/autoresearch.cpp +++ b/src/object/auto/autoresearch.cpp @@ -16,8 +16,6 @@ // * along with this program. If not, see http://www.gnu.org/licenses/. -#include <stdio.h> - #include "object/auto/autoresearch.h" #include "common/global.h" @@ -29,6 +27,8 @@ #include "ui/window.h" #include "ui/displaytext.h" +#include <stdio.h> +#include <string.h> const float SEARCH_TIME = 30.0f; // duration of a research diff --git a/src/object/auto/autoroot.cpp b/src/object/auto/autoroot.cpp index b43f40b..4413d56 100644 --- a/src/object/auto/autoroot.cpp +++ b/src/object/auto/autoroot.cpp @@ -15,15 +15,13 @@ // * along with this program. If not, see http://www.gnu.org/licenses/. -#include <stdio.h> - #include "object/auto/autoroot.h" #include "graphics/engine/particle.h" #include "graphics/engine/terrain.h" #include "math/geometry.h" - +#include <stdio.h> // Object's constructor. diff --git a/src/object/auto/autosafe.cpp b/src/object/auto/autosafe.cpp index 144f36e..82b1c12 100644 --- a/src/object/auto/autosafe.cpp +++ b/src/object/auto/autosafe.cpp @@ -16,8 +16,6 @@ // * along with this program. If not, see http://www.gnu.org/licenses/. -#include <stdio.h> - #include "object/auto/autosafe.h" #include "common/iman.h" @@ -27,6 +25,9 @@ #include "ui/interface.h" #include "ui/window.h" +#include <stdio.h> +#include <string.h> + const float OPEN_DELAY = 8.0f; // duration of opening diff --git a/src/object/auto/autostation.cpp b/src/object/auto/autostation.cpp index 3771c0f..1dbcf26 100644 --- a/src/object/auto/autostation.cpp +++ b/src/object/auto/autostation.cpp @@ -16,8 +16,6 @@ // * along with this program. If not, see http://www.gnu.org/licenses/. -#include <stdio.h> - #include "object/auto/autostation.h" #include "common/iman.h" @@ -28,7 +26,7 @@ #include "ui/gauge.h" #include "ui/window.h" - +#include <stdio.h> // Object's constructor. diff --git a/src/object/auto/autotower.cpp b/src/object/auto/autotower.cpp index 8410086..7674794 100644 --- a/src/object/auto/autotower.cpp +++ b/src/object/auto/autotower.cpp @@ -16,8 +16,6 @@ // * along with this program. If not, see http://www.gnu.org/licenses/. -#include <stdio.h> - #include "object/auto/autotower.h" #include "common/iman.h" @@ -29,6 +27,9 @@ #include "ui/window.h" #include "ui/gauge.h" +#include <stdio.h> +#include <string.h> + const float TOWER_SCOPE = 200.0f; // range of beam const float ENERGY_FIRE = 0.125f; // energy consumed by fire diff --git a/src/object/brain.cpp b/src/object/brain.cpp index f32aea9..d047185 100644 --- a/src/object/brain.cpp +++ b/src/object/brain.cpp @@ -15,57 +15,23 @@ // * along with this program. If not, see http://www.gnu.org/licenses/. -// #include <stdio.h> -// #include "object/brain.h" -// -// #include "CBot/CBotDll.h" -// #include "common/struct.h" -// #include "math/geometry.h" -// #include "math/const.h" -// #include "old/d3dengine.h" -// #include "old/d3dmath.h" -// #include "common/language.h" -// #include "common/global.h" -// #include "common/event.h" + #include "common/misc.h" #include "common/iman.h" -// #include "common/restext.h" -// #include "old/math3d.h" -// #include "object/robotmain.h" #include "graphics/core/color.h" #include "graphics/engine/terrain.h" -// #include "old/water.h" -// #include "old/camera.h" -// #include "object/object.h" -// #include "physics/physics.h" -// #include "object/motion/motion.h" -// #include "object/motion/motionspider.h" -// #include "old/pyro.h" +#include "object/motion/motion.h" #include "object/task/taskmanager.h" -// #include "object/task/task.h" -// #include "object/task/taskmanip.h" -// #include "object/task/taskflag.h" -// #include "object/task/taskshield.h" +#include "physics/physics.h" +#include "script/cmdtoken.h" #include "script/script.h" -// #include "ui/studio.h" +#include "sound/sound.h" +#include "ui/displaytext.h" #include "ui/interface.h" -// #include "ui/button.h" -// #include "ui/color.h" -// #include "ui/edit.h" -// #include "ui/list.h" -// #include "ui/label.h" -// #include "ui/group.h" -// #include "ui/gauge.h" #include "ui/slider.h" -// #include "ui/compass.h" -// #include "ui/target.h" +#include "ui/studio.h" #include "ui/window.h" -// #include "ui/displaytext.h" -// #include "old/text.h" -#include "sound/sound.h" -// #include "old/particule.h" -#include "script/cmdtoken.h" @@ -96,8 +62,7 @@ CBrain::CBrain(CInstanceManager* iMan, CObject* object) m_motion = 0; m_primaryTask = 0; m_secondaryTask = 0; - // TODO uncoment when ui/studio will be implemented. - // m_studio = 0; + m_studio = 0; m_program = -1; m_bActivity = true; @@ -144,8 +109,7 @@ CBrain::~CBrain() delete m_primaryTask; delete m_secondaryTask; - // TODO uncoment when ui/studio will be implemented. - // delete m_studio; + delete m_studio; delete m_traceRecordBuffer; m_iMan->DeleteInstance(CLASS_BRAIN, this); } @@ -172,8 +136,7 @@ void CBrain::DeleteObject(bool bAll) } } - // TODO uncoment when ui/studio will be implemented. - // if ( m_studio != 0 ) // current edition? + if ( m_studio != 0 ) // current edition? { StopEditScript(true); } @@ -239,9 +202,12 @@ bool CBrain::EventProcess(const Event &event) action = EVENT_NULL; + CApplication* app = CApplication::GetInstancePointer(); + if ( event.type == EVENT_KEY_DOWN && - (event.param == m_engine->GetKey(KEYRANK_ACTION, 0) || - event.param == m_engine->GetKey(KEYRANK_ACTION, 1) ) && + (event.key.key == app->GetInputBinding(INPUT_SLOT_ACTION).key + /* TODO joystick input binding + event.param == app->GetInputBinding(INPUT_SLOT_ACTION).joy*/ ) && !m_main->GetEditLock() ) { pw = static_cast< Ui::CWindow* >(m_interface->SearchControl(EVENT_WINDOW0)); @@ -250,7 +216,7 @@ bool CBrain::EventProcess(const Event &event) pc = pw->SearchControl(m_defaultEnter); if ( pc != 0 ) { - if ( pc->TestState(STATE_ENABLE) ) + if ( pc->TestState(Ui::STATE_ENABLE) ) { action = m_defaultEnter; } @@ -274,9 +240,8 @@ bool CBrain::EventProcess(const Event &event) EventFrame(event); } - // TODO uncoment when ui/studio will be implemented. if ( m_object->GetSelect() && // robot selected? - /* m_studio != 0 */ ) // current issue? + m_studio != 0 ) // current issue? { // m_studio->EventProcess(event); @@ -394,8 +359,7 @@ bool CBrain::EventProcess(const Event &event) { m_buttonAxe = action; } - if ( action == EVENT_LBUTTONUP || - action == EVENT_RBUTTONUP ) + if ( action == EVENT_MOUSE_BUTTON_UP ) { m_buttonAxe = EVENT_NULL; } @@ -770,11 +734,10 @@ bool CBrain::EventFrame(const Event &event) m_sound->Position(m_soundChannelAlarm, m_object->GetPosition(0)); } - // TODO uncoment when ui/studio will be implemented. - // if ( m_studio != 0 ) // current edition? - // { - // m_studio->EventProcess(event); - // } + if ( m_studio != 0 ) // current edition? + { + m_studio->EventProcess(event); + } UpdateInterface(event.rTime); @@ -826,7 +789,7 @@ void CBrain::StopProgram() UpdateInterface(); m_main->UpdateShortcuts(); - m_object->CreateSelectParticule(); + m_object->CreateSelectParticle(); } // Stops the current task. @@ -897,9 +860,8 @@ void CBrain::StartEditScript(int rank, char* name) m_script[rank] = new CScript(m_iMan, m_object, &m_secondaryTask); } - // TODO uncoment when ui/studio will be implemented. - // m_studio = new CStudio(m_iMan); - // m_studio->StartEditScript(m_script[rank], name, rank); + m_studio = new Ui::CStudio(); + m_studio->StartEditScript(m_script[rank], name, rank); } // End of editing a program. @@ -908,11 +870,10 @@ void CBrain::StopEditScript(bool bCancel) { if ( !bCancel ) SetActiveVirus(false); - // TODO uncoment when ui/studio will be implemented. - // if ( !m_studio->StopEditScript(bCancel) ) return; + if ( !m_studio->StopEditScript(bCancel) ) return; - // delete m_studio; - // m_studio = 0; + delete m_studio; + m_studio = 0; CreateInterface(true); // puts the control buttons } @@ -1506,19 +1467,19 @@ bool CBrain::CreateInterface(bool bSelect) pos.x = ox+sx*10.1f; pos.y = oy+sy*2.0f-ddim.y; pc = pw->CreateColor(pos, ddim, -1, EVENT_OBJECT_FCOLORb); - pc->SetColor(GetColor(Gfx::Color(0.28f, 0.56f, 1.0f, 0.0f))); + pc->SetColor(Gfx::Color(0.28f, 0.56f, 1.0f, 0.0f)); pos.x += ddim.x; pc = pw->CreateColor(pos, ddim, -1, EVENT_OBJECT_FCOLORr); - pc->SetColor(GetColor(Gfx::Color(1.0f, 0.0f, 0.0f, 0.0f); + pc->SetColor(Gfx::Color(1.0f, 0.0f, 0.0f, 0.0f)); pos.x += ddim.x; pc = pw->CreateColor(pos, ddim, -1, EVENT_OBJECT_FCOLORg); - pc->SetColor(GetColor(Gfx::Color(0.0f, 0.8f, 0.0f, 0.0f))); + pc->SetColor(Gfx::Color(0.0f, 0.8f, 0.0f, 0.0f)); pos.x += ddim.x; pc = pw->CreateColor(pos, ddim, -1, EVENT_OBJECT_FCOLORy); - pc->SetColor(GetColor(Gfx::Color(1.0f, 0.93f, 0.0f, 0.0f); //0x00ffec00 + pc->SetColor(Gfx::Color(1.0f, 0.93f, 0.0f, 0.0f)); //0x00ffec00 pos.x += ddim.x; pc = pw->CreateColor(pos, ddim, -1, EVENT_OBJECT_FCOLORv); - pc->SetColor(GetColor(Gfx::Color(0.82f, 0.004f, 0.99f, 0.0f); //0x00d101fe + pc->SetColor(Gfx::Color(0.82f, 0.004f, 0.99f, 0.0f)); //0x00d101fe } } @@ -1577,7 +1538,7 @@ bool CBrain::CreateInterface(bool bSelect) ddim.x = dim.x*0.5f; ddim.y = dim.y*2.0f; ps = pw->CreateSlider(pos, ddim, 0, EVENT_OBJECT_DIMSHIELD); - ps->SetState(STATE_VALUE); + ps->SetState(Ui::STATE_VALUE); ps->SetLimit((RADIUS_SHIELD_MIN/g_unit), (RADIUS_SHIELD_MAX/g_unit)); ps->SetArrowStep(1.0f); } @@ -1628,35 +1589,35 @@ bool CBrain::CreateInterface(bool bSelect) pos.x = ox+sx*10.15f; pos.y = oy+sy*1.50f; pc = pw->CreateColor(pos, ddim, -1, EVENT_OBJECT_PEN1); // black - pc->SetColor(GetColor(Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f))); + pc->SetColor(Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f)); pos.x = ox+sx*10.65f; pos.y = oy+sy*1.25f; pc = pw->CreateColor(pos, ddim, -1, EVENT_OBJECT_PEN2); // yellow - pc->SetColor(GetColor(Gfx::Color(1.0f, 1.0f, 0.0f, 0.0f ))); + pc->SetColor(Gfx::Color(1.0f, 1.0f, 0.0f, 0.0f )); pos.x = ox+sx*10.90f; pos.y = oy+sy*0.75f; pc = pw->CreateColor(pos, ddim, -1, EVENT_OBJECT_PEN3); // orange - pc->SetColor(GetColor(Gfx::Color(1.0f, 0.53f, 0x00, 0x00))); + pc->SetColor(Gfx::Color(1.0f, 0.53f, 0x00, 0x00)); pos.x = ox+sx*10.65f; pos.y = oy+sy*0.25f; pc = pw->CreateColor(pos, ddim, -1, EVENT_OBJECT_PEN4); // red - pc->SetColor(GetColor(Gfx::Color(1.0f, 0.0f, 0.0f, 0.0f))); + pc->SetColor(Gfx::Color(1.0f, 0.0f, 0.0f, 0.0f)); pos.x = ox+sx*10.15f; pos.y = oy+sy*0.00f; pc = pw->CreateColor(pos, ddim, -1, EVENT_OBJECT_PEN5); // violet - pc->SetColor(GetColor(Gfx::Color(1.0f, 0.0f, 1.0f 0.0f ))); + pc->SetColor(Gfx::Color(1.0f, 0.0f, 1.0f, 0.0f)); pos.x = ox+sx*9.65f; pos.y = oy+sy*0.25f; pc = pw->CreateColor(pos, ddim, -1, EVENT_OBJECT_PEN6); // blue - pc->SetColor(GetColor(Gfx::Color(0.0f, 0.4f, 1.0f, 0.0f)));//0x000066ff)); + pc->SetColor(Gfx::Color(0.0f, 0.4f, 1.0f, 0.0f));//0x000066ff)); pos.x = ox+sx*9.40f; pos.y = oy+sy*0.75f; pc = pw->CreateColor(pos, ddim, -1, EVENT_OBJECT_PEN7); // green - pc->SetColor(GetColor(Gfx::Color(0.0f, 0.0f, 0.8f, 0.0f)));//0x0000cc00)); + pc->SetColor(Gfx::Color(0.0f, 0.0f, 0.8f, 0.0f));//0x0000cc00)); pos.x = ox+sx*9.65f; pos.y = oy+sy*1.25f; pc = pw->CreateColor(pos, ddim, -1, EVENT_OBJECT_PEN8); // brown - pc->SetColor(GetColor(Gfx::Color(0.53f, 0.27f, 0.0f, 0.0f)));//0x00884400)); + pc->SetColor(Gfx::Color(0.53f, 0.27f, 0.0f, 0.0f));//0x00884400)); pos.x = ox+sx*6.9f; pos.y = oy+sy*1.2f; @@ -1869,7 +1830,7 @@ bool CBrain::CreateInterface(bool bSelect) pc = (CCompass*)pw->SearchControl(EVENT_OBJECT_COMPASS); if ( pc != 0 ) { - pc->SetState(STATE_VISIBLE, m_main->GetShowMap()); + pc->SetState(Ui::STATE_VISIBLE, m_main->GetShowMap()); } } #endif @@ -1895,7 +1856,7 @@ bool CBrain::CreateInterface(bool bSelect) ddim.x = 600.0f/640.0f; ddim.y = 340.0f/480.0f; pt = pw->CreateTarget(pos, ddim, 0, EVENT_OBJECT_TARGET); - pt->ClearState(STATE_GLINT); + pt->ClearState(Ui::STATE_GLINT); } ddim.x = 64.0f/640.0f; @@ -1935,14 +1896,14 @@ bool CBrain::CreateInterface(bool bSelect) void CBrain::UpdateInterface(float rTime) { Ui::CWindow* pw; -#if _TEEN - CButton* pb; -#endif - CGauge* pg; - CCompass* pc; - CGroup* pgr; - CTarget* ptg; - CObject* power; +/* TODO: #if _TEEN + Ui::CButton* pb; +#endif*/ + Ui::CGauge* pg; + Ui::CCompass* pc; + Ui::CGroup* pgr; + Ui::CTarget* ptg; + CObject* power; Math::Vector pos, hPos; Math::Point ppos; float energy, limit, angle, range; @@ -2045,7 +2006,7 @@ void CBrain::UpdateInterface(float rTime) angle = -(m_object->GetAngleY(0)+Math::PI/2.0f); pc->SetDirection(angle); - pc->SetState(STATE_VISIBLE, m_main->GetShowMap()); + pc->SetState(Ui::STATE_VISIBLE, m_main->GetShowMap()); } #if _TEEN @@ -2054,16 +2015,16 @@ void CBrain::UpdateInterface(float rTime) { if ( m_bTraceRecord && Math::Mod(m_time, 0.4f) >= 0.2f ) { - pb->SetState(STATE_CHECK); + pb->SetState(Ui::STATE_CHECK); } else { - pb->ClearState(STATE_CHECK); + pb->ClearState(Ui::STATE_CHECK); } } #endif - bOnBoard = m_camera->GetType() == CAMERA_ONBOARD; + bOnBoard = m_camera->GetType() == Gfx::CAM_TYPE_ONBOARD; pgr = static_cast< Ui::CGroup* >(pw->SearchControl(EVENT_OBJECT_CROSSHAIR)); if ( pgr != 0 ) @@ -2087,11 +2048,11 @@ void CBrain::UpdateInterface(float rTime) ppos.y += m_object->GetGunGoalV()/1.3f; pgr->SetPos(ppos); #endif - pgr->SetState(STATE_VISIBLE, !m_main->GetFriendAim()); + pgr->SetState(Ui::STATE_VISIBLE, !m_main->GetFriendAim()); } else { - pgr->ClearState(STATE_VISIBLE); + pgr->ClearState(Ui::STATE_VISIBLE); } } @@ -2100,36 +2061,36 @@ void CBrain::UpdateInterface(float rTime) { if ( bOnBoard ) { - ptg->SetState(STATE_VISIBLE); + ptg->SetState(Ui::STATE_VISIBLE); } else { - ptg->ClearState(STATE_VISIBLE); + ptg->ClearState(Ui::STATE_VISIBLE); } } pgr = static_cast< Ui::CGroup* >(pw->SearchControl(EVENT_OBJECT_CORNERul)); if ( pgr != 0 ) { - pgr->SetState(STATE_VISIBLE, bOnBoard); + pgr->SetState(Ui::STATE_VISIBLE, bOnBoard); } pgr = static_cast< Ui::CGroup* >(pw->SearchControl(EVENT_OBJECT_CORNERur)); if ( pgr != 0 ) { - pgr->SetState(STATE_VISIBLE, bOnBoard); + pgr->SetState(Ui::STATE_VISIBLE, bOnBoard); } pgr = static_cast< Ui::CGroup* >(pw->SearchControl(EVENT_OBJECT_CORNERdl)); if ( pgr != 0 ) { - pgr->SetState(STATE_VISIBLE, bOnBoard); + pgr->SetState(Ui::STATE_VISIBLE, bOnBoard); } pgr = static_cast< Ui::CGroup* >(pw->SearchControl(EVENT_OBJECT_CORNERdr)); if ( pgr != 0 ) { - pgr->SetState(STATE_VISIBLE, bOnBoard); + pgr->SetState(Ui::STATE_VISIBLE, bOnBoard); } } @@ -2213,7 +2174,7 @@ void CBrain::UpdateInterface() pb = static_cast< Ui::CButton* >(pw->SearchControl(EVENT_OBJECT_GFLAT)); if ( pb != 0 ) { - pb->SetState(STATE_VISIBLE, m_engine->GetGroundSpot()); + pb->SetState(Ui::STATE_VISIBLE, m_engine->GetGroundSpot()); } if ( type == OBJECT_HUMAN || // builder? @@ -2347,49 +2308,49 @@ void CBrain::UpdateInterface() pb = static_cast< Ui::CButton* >(pw->SearchControl(EVENT_OBJECT_PEN0)); if ( pb != 0 ) { - pb->ClearState(STATE_CHECK); + pb->ClearState(Ui::STATE_CHECK); } color = m_object->GetTraceColor(); pc = static_cast< Ui::CColor* >(pw->SearchControl(EVENT_OBJECT_PEN1)); if ( pc != 0 ) { - pc->SetState(STATE_CHECK, color==1); + pc->SetState(Ui::STATE_CHECK, color==1); } pc = static_cast< Ui::CColor* >(pw->SearchControl(EVENT_OBJECT_PEN2)); if ( pc != 0 ) { - pc->SetState(STATE_CHECK, color==8); + pc->SetState(Ui::STATE_CHECK, color==8); } pc = static_cast< Ui::CColor* >(pw->SearchControl(EVENT_OBJECT_PEN3)); if ( pc != 0 ) { - pc->SetState(STATE_CHECK, color==7); + pc->SetState(Ui::STATE_CHECK, color==7); } pc = static_cast< Ui::CColor* >(pw->SearchControl(EVENT_OBJECT_PEN4)); if ( pc != 0 ) { - pc->SetState(STATE_CHECK, color==4); + pc->SetState(Ui::STATE_CHECK, color==4); } pc = static_cast< Ui::CColor* >(pw->SearchControl(EVENT_OBJECT_PEN5)); if ( pc != 0 ) { - pc->SetState(STATE_CHECK, color==6); + pc->SetState(Ui::STATE_CHECK, color==6); } pc = static_cast< Ui::CColor* >(pw->SearchControl(EVENT_OBJECT_PEN6)); if ( pc != 0 ) { - pc->SetState(STATE_CHECK, color==14); + pc->SetState(Ui::STATE_CHECK, color==14); } pc = static_cast< Ui::CColor* >(pw->SearchControl(EVENT_OBJECT_PEN7)); if ( pc != 0 ) { - pc->SetState(STATE_CHECK, color==12); + pc->SetState(Ui::STATE_CHECK, color==12); } pc = static_cast< Ui::CColor* >(pw->SearchControl(EVENT_OBJECT_PEN8)); if ( pc != 0 ) { - pc->SetState(STATE_CHECK, color==10); + pc->SetState(Ui::STATE_CHECK, color==10); } } else @@ -2397,48 +2358,48 @@ void CBrain::UpdateInterface() pb = static_cast< Ui::CButton* >(pw->SearchControl(EVENT_OBJECT_PEN0)); if ( pb != 0 ) { - pb->SetState(STATE_CHECK); + pb->SetState(Ui::STATE_CHECK); } pc = static_cast< Ui::CColor* >(pw->SearchControl(EVENT_OBJECT_PEN1)); if ( pc != 0 ) { - pc->ClearState(STATE_CHECK); + pc->ClearState(Ui::STATE_CHECK); } pc = static_cast< Ui::CColor* >(pw->SearchControl(EVENT_OBJECT_PEN2)); if ( pc != 0 ) { - pc->ClearState(STATE_CHECK); + pc->ClearState(Ui::STATE_CHECK); } pc = static_cast< Ui::CColor* >(pw->SearchControl(EVENT_OBJECT_PEN3)); if ( pc != 0 ) { - pc->ClearState(STATE_CHECK); + pc->ClearState(Ui::STATE_CHECK); } pc = static_cast< Ui::CColor* >(pw->SearchControl(EVENT_OBJECT_PEN4)); if ( pc != 0 ) { - pc->ClearState(STATE_CHECK); + pc->ClearState(Ui::STATE_CHECK); } pc = static_cast< Ui::CColor* >(pw->SearchControl(EVENT_OBJECT_PEN5)); if ( pc != 0 ) { - pc->ClearState(STATE_CHECK); + pc->ClearState(Ui::STATE_CHECK); } pc = static_cast< Ui::CColor* >(pw->SearchControl(EVENT_OBJECT_PEN6)); if ( pc != 0 ) { - pc->ClearState(STATE_CHECK); + pc->ClearState(Ui::STATE_CHECK); } pc = static_cast< Ui::CColor* >(pw->SearchControl(EVENT_OBJECT_PEN7)); if ( pc != 0 ) { - pc->ClearState(STATE_CHECK); + pc->ClearState(Ui::STATE_CHECK); } pc = static_cast< Ui::CColor* >(pw->SearchControl(EVENT_OBJECT_PEN8)); if ( pc != 0 ) { - pc->ClearState(STATE_CHECK); + pc->ClearState(Ui::STATE_CHECK); } } #endif @@ -2535,7 +2496,7 @@ void CBrain::CheckInterface(Ui::CWindow *pw, EventType event, bool bState) control = pw->SearchControl(event); if ( control == 0 ) return; - control->SetState(STATE_CHECK, bState); + control->SetState(Ui::STATE_CHECK, bState); } // Changes the state of a button interface. @@ -2547,7 +2508,7 @@ void CBrain::EnableInterface(Ui::CWindow *pw, EventType event, bool bState) control = pw->SearchControl(event); if ( control == 0 ) return; - control->SetState(STATE_ENABLE, bState); + control->SetState(Ui::STATE_ENABLE, bState); } // Changes the state of a button on the interface. @@ -2559,7 +2520,7 @@ void CBrain::DeadInterface(Ui::CWindow *pw, EventType event, bool bState) control = pw->SearchControl(event); if ( control == 0 ) return; - control->SetState(STATE_DEAD, !bState); + control->SetState(Ui::STATE_DEAD, !bState); } // Change the default input state of a button interface. @@ -2573,12 +2534,12 @@ void CBrain::DefaultEnter(Ui::CWindow *pw, EventType event, bool bState) if ( bState ) { - control->SetState(STATE_DEFAULT); + control->SetState(Ui::STATE_DEFAULT); m_defaultEnter = event; } else { - control->ClearState(STATE_DEFAULT); + control->ClearState(Ui::STATE_DEFAULT); } } diff --git a/src/object/brain.h b/src/object/brain.h index 3db5b4c..008fb67 100644 --- a/src/object/brain.h +++ b/src/object/brain.h @@ -18,9 +18,6 @@ #pragma once - -// #include <stdio.h> - #include "common/event.h" #include "common/misc.h" diff --git a/src/object/motion/motion.cpp b/src/object/motion/motion.cpp index c3b74ee..df8a4be 100644 --- a/src/object/motion/motion.cpp +++ b/src/object/motion/motion.cpp @@ -17,14 +17,13 @@ // motion.cpp -#include <stdio.h> - #include "object/motion/motion.h" #include "common/iman.h" #include "script/cmdtoken.h" - +#include <stdio.h> +#include <string.h> // Object's constructor. diff --git a/src/object/motion/motion.h b/src/object/motion/motion.h index ef943d2..d195e65 100644 --- a/src/object/motion/motion.h +++ b/src/object/motion/motion.h @@ -20,7 +20,7 @@ #include "common/event.h" -#include "common/misc.h" +#include "common/global.h" #include "object/object.h" diff --git a/src/object/motion/motionvehicle.cpp b/src/object/motion/motionvehicle.cpp index af69d40..1e54562 100644 --- a/src/object/motion/motionvehicle.cpp +++ b/src/object/motion/motionvehicle.cpp @@ -17,8 +17,6 @@ // motionvehicle.cpp -#include <stdio.h> - #include "object/motion/motionvehicle.h" #include "graphics/engine/modelfile.h" @@ -28,6 +26,8 @@ #include "object/brain.h" #include "physics/physics.h" +#include <stdio.h> +#include <string.h> diff --git a/src/object/robotmain.cpp b/src/object/robotmain.cpp index 3f7ad9e..b521862 100644 --- a/src/object/robotmain.cpp +++ b/src/object/robotmain.cpp @@ -2760,7 +2760,7 @@ void CRobotMain::HiliteFrame(float rTime) } //! Creates a tooltip -void CRobotMain::CreateTooltip(Math::Point pos, char* text) +void CRobotMain::CreateTooltip(Math::Point pos, const char* text) { Math::Point corner; corner.x = pos.x+0.022f; @@ -6193,7 +6193,7 @@ Error CRobotMain::CheckEndMission(bool frame) } //! Checks if the mission is finished after displaying a message -void CRobotMain::CheckEndMessage(char *message) +void CRobotMain::CheckEndMessage(const char* message) { for (int t = 0; t < m_endTakeTotal; t++) { @@ -6222,7 +6222,7 @@ char* CRobotMain::GetObligatoryToken(int i) } //! Checks if an instruction is part of the obligatory list -int CRobotMain::IsObligatoryToken(char *token) +int CRobotMain::IsObligatoryToken(const char* token) { for (int i = 0; i < m_obligatoryTotal; i++) { @@ -6233,7 +6233,7 @@ int CRobotMain::IsObligatoryToken(char *token) } //! Checks if an instruction is not part of the banned list -bool CRobotMain::IsProhibitedToken(char *token) +bool CRobotMain::IsProhibitedToken(const char* token) { for (int i = 0; i < m_prohibitedTotal; i++) { diff --git a/src/object/robotmain.h b/src/object/robotmain.h index 4ec897b..fead48d 100644 --- a/src/object/robotmain.h +++ b/src/object/robotmain.h @@ -189,11 +189,11 @@ public: void ResetObject(); void ResetCreate(); Error CheckEndMission(bool frame); - void CheckEndMessage(char *message); + void CheckEndMessage(const char* message); int GetObligatoryToken(); char* GetObligatoryToken(int i); - int IsObligatoryToken(char *token); - bool IsProhibitedToken(char *token); + int IsObligatoryToken(const char* token); + bool IsProhibitedToken(const char* token); void UpdateMap(); bool GetShowMap(); diff --git a/src/object/task/task.h b/src/object/task/task.h index a0da9d2..7239d48 100644 --- a/src/object/task/task.h +++ b/src/object/task/task.h @@ -19,7 +19,8 @@ #pragma once -#include "common/misc.h" +#include "common/event.h" +#include "common/global.h" #include "math/const.h" diff --git a/src/object/task/taskbuild.cpp b/src/object/task/taskbuild.cpp index 6aa0ed2..469e9cb 100644 --- a/src/object/task/taskbuild.cpp +++ b/src/object/task/taskbuild.cpp @@ -31,6 +31,8 @@ #include "physics/physics.h" #include "ui/displaytext.h" +#include <string.h> + // Object's constructor. CTaskBuild::CTaskBuild(CInstanceManager* iMan, CObject* object) diff --git a/src/object/task/taskgoto.cpp b/src/object/task/taskgoto.cpp index fb3c9a2..ce778ef 100644 --- a/src/object/task/taskgoto.cpp +++ b/src/object/task/taskgoto.cpp @@ -28,6 +28,7 @@ #include "math/geometry.h" #include "physics/physics.h" +#include <string.h> const float FLY_DIST_GROUND = 80.0f; // minimum distance to remain on the ground diff --git a/src/object/task/taskinfo.cpp b/src/object/task/taskinfo.cpp index ab81d23..4e64584 100644 --- a/src/object/task/taskinfo.cpp +++ b/src/object/task/taskinfo.cpp @@ -22,7 +22,7 @@ #include "graphics/engine/particle.h" #include "object/auto/autoinfo.h" - +#include <string.h> diff --git a/src/object/task/taskshield.cpp b/src/object/task/taskshield.cpp index f6dc897..682bcb1 100644 --- a/src/object/task/taskshield.cpp +++ b/src/object/task/taskshield.cpp @@ -26,6 +26,7 @@ #include "object/brain.h" #include "physics/physics.h" +#include <string.h> const float ENERGY_TIME = 20.0f; // maximum duration if full battery |