Moved all UI code out of CBrain into Ui::CObjectInterface
parent
2b44a7be3d
commit
78a51f0acb
|
@ -206,25 +206,9 @@ set(BASE_SOURCES
|
|||
script/scriptfunc.cpp
|
||||
sound/sound.cpp
|
||||
sound/sound_type.cpp
|
||||
ui/screen/screen.cpp
|
||||
ui/screen/screen_apperance.cpp
|
||||
ui/screen/screen_io.cpp
|
||||
ui/screen/screen_io_read.cpp
|
||||
ui/screen/screen_io_write.cpp
|
||||
ui/screen/screen_level_list.cpp
|
||||
ui/screen/screen_loading.cpp
|
||||
ui/screen/screen_main_menu.cpp
|
||||
ui/screen/screen_player_select.cpp
|
||||
ui/screen/screen_quit.cpp
|
||||
ui/screen/screen_setup.cpp
|
||||
ui/screen/screen_setup_controls.cpp
|
||||
ui/screen/screen_setup_display.cpp
|
||||
ui/screen/screen_setup_game.cpp
|
||||
ui/screen/screen_setup_graphics.cpp
|
||||
ui/screen/screen_setup_sound.cpp
|
||||
ui/screen/screen_welcome.cpp
|
||||
ui/displayinfo.cpp
|
||||
ui/displaytext.cpp
|
||||
ui/object_interface.cpp
|
||||
ui/maindialog.cpp
|
||||
ui/mainmap.cpp
|
||||
ui/mainshort.cpp
|
||||
|
@ -251,6 +235,23 @@ set(BASE_SOURCES
|
|||
ui/controls/slider.cpp
|
||||
ui/controls/target.cpp
|
||||
ui/controls/window.cpp
|
||||
ui/screen/screen.cpp
|
||||
ui/screen/screen_apperance.cpp
|
||||
ui/screen/screen_io.cpp
|
||||
ui/screen/screen_io_read.cpp
|
||||
ui/screen/screen_io_write.cpp
|
||||
ui/screen/screen_level_list.cpp
|
||||
ui/screen/screen_loading.cpp
|
||||
ui/screen/screen_main_menu.cpp
|
||||
ui/screen/screen_player_select.cpp
|
||||
ui/screen/screen_quit.cpp
|
||||
ui/screen/screen_setup.cpp
|
||||
ui/screen/screen_setup_controls.cpp
|
||||
ui/screen/screen_setup_display.cpp
|
||||
ui/screen/screen_setup_game.cpp
|
||||
ui/screen/screen_setup_graphics.cpp
|
||||
ui/screen/screen_setup_sound.cpp
|
||||
ui/screen/screen_welcome.cpp
|
||||
${OPENAL_SRC}
|
||||
)
|
||||
|
||||
|
|
2240
src/object/brain.cpp
2240
src/object/brain.cpp
File diff suppressed because it is too large
Load Diff
|
@ -25,14 +25,9 @@
|
|||
#pragma once
|
||||
|
||||
#include "common/event.h"
|
||||
#include "common/misc.h"
|
||||
|
||||
#include "object/trace_color.h"
|
||||
|
||||
#include "object/task/taskflag.h"
|
||||
#include "object/task/taskmanip.h"
|
||||
#include "object/task/taskshield.h"
|
||||
|
||||
#include <vector>
|
||||
#include <sstream>
|
||||
#include <memory>
|
||||
|
@ -41,26 +36,14 @@ class COldObject;
|
|||
class CTaskExecutorObject;
|
||||
class CPhysics;
|
||||
class CMotion;
|
||||
class CTaskManager;
|
||||
class CScript;
|
||||
class CRobotMain;
|
||||
class CSoundInterface;
|
||||
class CLevelParserLine;
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class CStudio;
|
||||
class CInterface;
|
||||
class CWindow;
|
||||
}
|
||||
|
||||
namespace Gfx
|
||||
{
|
||||
class CEngine;
|
||||
class CTerrain;
|
||||
class CWater;
|
||||
class CCamera;
|
||||
class CParticle;
|
||||
} /* Gfx */
|
||||
|
||||
|
||||
|
@ -96,13 +79,10 @@ public:
|
|||
CBrain(COldObject* object);
|
||||
~CBrain();
|
||||
|
||||
void DeleteObject(bool bAll=false);
|
||||
|
||||
void SetPhysics(CPhysics* physics);
|
||||
void SetMotion(CMotion* motion);
|
||||
|
||||
bool EventProcess(const Event &event);
|
||||
bool CreateInterface(bool bSelect);
|
||||
|
||||
bool Write(CLevelParserLine* line);
|
||||
bool Read(CLevelParserLine* line);
|
||||
|
@ -127,70 +107,48 @@ public:
|
|||
bool WriteProgram(Program* program, const char* filename);
|
||||
bool ReadStack(FILE *file);
|
||||
bool WriteStack(FILE *file);
|
||||
std::vector<std::unique_ptr<Program>>& GetPrograms();
|
||||
|
||||
void UpdateInterface(float rTime);
|
||||
void UpdateInterface();
|
||||
|
||||
Program* AddProgram();
|
||||
void AddProgram(std::unique_ptr<Program> program);
|
||||
void RemoveProgram(Program* program);
|
||||
Program* CloneProgram(Program* program);
|
||||
|
||||
std::vector<std::unique_ptr<Program>>& GetPrograms();
|
||||
int GetProgramCount();
|
||||
Program* GetProgram(int index);
|
||||
Program* GetOrAddProgram(int index);
|
||||
int GetProgramIndex(Program* program);
|
||||
|
||||
//! Start recording trace
|
||||
void TraceRecordStart();
|
||||
//! Stop recording trace and generate CBot program
|
||||
void TraceRecordStop();
|
||||
//! Returns true if trace recording is in progress
|
||||
bool IsTraceRecord();
|
||||
|
||||
protected:
|
||||
bool EventFrame(const Event &event);
|
||||
|
||||
void StartEditScript(Program* program, char* name);
|
||||
void StopEditScript(bool bCancel);
|
||||
|
||||
void GroundFlat();
|
||||
void ColorFlag(int color);
|
||||
|
||||
void UpdateScript(Ui::CWindow *pw);
|
||||
int GetSelScript();
|
||||
void SetSelScript(int index);
|
||||
void BlinkScript(bool bEnable);
|
||||
|
||||
void CheckInterface(Ui::CWindow *pw, EventType event, bool bState);
|
||||
void EnableInterface(Ui::CWindow *pw, EventType event, bool bState);
|
||||
void DeadInterface(Ui::CWindow *pw, EventType event, bool bState);
|
||||
void DefaultEnter(Ui::CWindow *pw, EventType event, bool bState=true);
|
||||
|
||||
//! Start recording trace
|
||||
void TraceRecordStart();
|
||||
//! Save current status to recording buffer
|
||||
void TraceRecordFrame();
|
||||
//! Stop recording trace and generate CBot program
|
||||
void TraceRecordStop();
|
||||
//! Save this operation to recording buffer
|
||||
bool TraceRecordOper(TraceOper oper, float param);
|
||||
//! Convert this recording operation to CBot instruction
|
||||
bool TraceRecordPut(std::stringstream& buffer, TraceOper oper, float param);
|
||||
|
||||
protected:
|
||||
CRobotMain* m_main;
|
||||
Gfx::CEngine* m_engine;
|
||||
Gfx::CTerrain* m_terrain;
|
||||
Gfx::CWater* m_water;
|
||||
Gfx::CCamera* m_camera;
|
||||
Gfx::CParticle* m_particle;
|
||||
|
||||
COldObject* m_object;
|
||||
CTaskExecutorObject* m_taskExecutor;
|
||||
CPhysics* m_physics;
|
||||
CMotion* m_motion;
|
||||
Ui::CInterface* m_interface;
|
||||
CRobotMain* m_main;
|
||||
Ui::CStudio* m_studio;
|
||||
CSoundInterface* m_sound;
|
||||
|
||||
std::vector<std::unique_ptr<Program>> m_program;
|
||||
Program* m_currentProgram;
|
||||
|
||||
unsigned int m_selScript; // rank of the selected script
|
||||
|
||||
bool m_bBurn;
|
||||
bool m_bActiveVirus;
|
||||
|
||||
|
@ -198,15 +156,9 @@ protected:
|
|||
char m_soluceName[50];
|
||||
|
||||
EventType m_buttonAxe;
|
||||
EventType m_manipStyle;
|
||||
EventType m_defaultEnter;
|
||||
|
||||
float m_time;
|
||||
float m_burnTime;
|
||||
float m_lastUpdateTime;
|
||||
float m_lastAlarmTime;
|
||||
int m_soundChannelAlarm;
|
||||
int m_flagColor;
|
||||
|
||||
bool m_bTraceRecord;
|
||||
TraceOper m_traceOper;
|
||||
|
|
|
@ -2642,7 +2642,7 @@ CObjectUPtr CObjectFactory::CreateVehicle(const ObjectCreateParams& params)
|
|||
}
|
||||
else if ( type == OBJECT_CONTROLLER )
|
||||
{
|
||||
motion = MakeUnique<CMotionLevelController>(obj.get()); //dummy object
|
||||
motion = MakeUnique<CMotionLevelController>(obj.get());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -58,6 +58,8 @@
|
|||
#include "script/cbottoken.h"
|
||||
#include "script/scriptfunc.h"
|
||||
|
||||
#include "ui/object_interface.h"
|
||||
|
||||
#include <boost/lexical_cast.hpp>
|
||||
|
||||
|
||||
|
@ -290,9 +292,9 @@ void COldObject::DeleteObject(bool bAll)
|
|||
m_physics->DeleteObject(bAll);
|
||||
}
|
||||
|
||||
if ( m_brain != nullptr )
|
||||
if ( m_objectInterface != nullptr )
|
||||
{
|
||||
m_brain->DeleteObject(bAll);
|
||||
m_objectInterface->DeleteObject(bAll);
|
||||
}
|
||||
|
||||
if ( m_motion != nullptr )
|
||||
|
@ -347,9 +349,14 @@ void COldObject::Simplify()
|
|||
m_physics.reset();
|
||||
}
|
||||
|
||||
if ( m_objectInterface != nullptr )
|
||||
{
|
||||
m_objectInterface->DeleteObject();
|
||||
m_objectInterface.reset();
|
||||
}
|
||||
|
||||
if ( m_brain != nullptr )
|
||||
{
|
||||
m_brain->DeleteObject();
|
||||
m_brain.reset();
|
||||
}
|
||||
|
||||
|
@ -1850,11 +1857,16 @@ bool COldObject::EventProcess(const Event &event)
|
|||
}
|
||||
}
|
||||
|
||||
if ( m_brain.get() != nullptr )
|
||||
if ( m_brain != nullptr )
|
||||
{
|
||||
m_brain->EventProcess(event);
|
||||
}
|
||||
|
||||
if ( m_objectInterface != nullptr )
|
||||
{
|
||||
m_objectInterface->EventProcess(event);
|
||||
}
|
||||
|
||||
if ( m_auto != nullptr )
|
||||
{
|
||||
m_auto->EventProcess(event);
|
||||
|
@ -2472,9 +2484,15 @@ void COldObject::SetSelect(bool bMode, bool bDisplayError)
|
|||
|
||||
m_bSelect = bMode;
|
||||
|
||||
if ( m_brain != nullptr )
|
||||
// NOTE: Right now, Ui::CObjectInterface is only for programmable objects. Right now all selectable objects are programmable anyway.
|
||||
// TODO: All UI-related stuff should be moved out of CObject classes
|
||||
if (Implements(ObjectInterfaceType::Programmable))
|
||||
{
|
||||
m_brain->CreateInterface(m_bSelect);
|
||||
if ( m_objectInterface == nullptr )
|
||||
{
|
||||
m_objectInterface = MakeUnique<Ui::CObjectInterface>(this);
|
||||
}
|
||||
m_objectInterface->CreateInterface(m_bSelect);
|
||||
}
|
||||
|
||||
if ( m_auto != nullptr )
|
||||
|
@ -3163,7 +3181,7 @@ Error COldObject::StartTaskTake()
|
|||
|
||||
m_foregroundTask = MakeUnique<CTaskManager>(this);
|
||||
Error err = m_foregroundTask->StartTaskTake();
|
||||
m_brain->UpdateInterface();
|
||||
UpdateInterface();
|
||||
return err;
|
||||
}
|
||||
|
||||
|
@ -3175,7 +3193,7 @@ Error COldObject::StartTaskManip(TaskManipOrder order, TaskManipArm arm)
|
|||
|
||||
m_foregroundTask = MakeUnique<CTaskManager>(this);
|
||||
Error err = m_foregroundTask->StartTaskManip(order, arm);
|
||||
m_brain->UpdateInterface();
|
||||
UpdateInterface();
|
||||
return err;
|
||||
}
|
||||
|
||||
|
@ -3187,7 +3205,7 @@ Error COldObject::StartTaskFlag(TaskFlagOrder order, int rank)
|
|||
|
||||
m_foregroundTask = MakeUnique<CTaskManager>(this);
|
||||
Error err = m_foregroundTask->StartTaskFlag(order, rank);
|
||||
m_brain->UpdateInterface();
|
||||
UpdateInterface();
|
||||
return err;
|
||||
}
|
||||
|
||||
|
@ -3199,7 +3217,7 @@ Error COldObject::StartTaskBuild(ObjectType type)
|
|||
|
||||
m_foregroundTask = MakeUnique<CTaskManager>(this);
|
||||
Error err = m_foregroundTask->StartTaskBuild(type);
|
||||
m_brain->UpdateInterface();
|
||||
UpdateInterface();
|
||||
return err;
|
||||
}
|
||||
|
||||
|
@ -3211,7 +3229,7 @@ Error COldObject::StartTaskSearch()
|
|||
|
||||
m_foregroundTask = MakeUnique<CTaskManager>(this);
|
||||
Error err = m_foregroundTask->StartTaskSearch();
|
||||
m_brain->UpdateInterface();
|
||||
UpdateInterface();
|
||||
return err;
|
||||
}
|
||||
|
||||
|
@ -3223,7 +3241,7 @@ Error COldObject::StartTaskDeleteMark()
|
|||
|
||||
m_foregroundTask = MakeUnique<CTaskManager>(this);
|
||||
Error err = m_foregroundTask->StartTaskDeleteMark();
|
||||
m_brain->UpdateInterface();
|
||||
UpdateInterface();
|
||||
return err;
|
||||
}
|
||||
|
||||
|
@ -3236,7 +3254,7 @@ Error COldObject::StartTaskTerraform()
|
|||
|
||||
m_foregroundTask = MakeUnique<CTaskManager>(this);
|
||||
Error err = m_foregroundTask->StartTaskTerraform();
|
||||
m_brain->UpdateInterface();
|
||||
UpdateInterface();
|
||||
return err;
|
||||
}
|
||||
|
||||
|
@ -3261,7 +3279,7 @@ Error COldObject::StartTaskPen(bool down, TraceColor color)
|
|||
|
||||
m_foregroundTask = MakeUnique<CTaskManager>(this);
|
||||
Error err = m_foregroundTask->StartTaskPen(down, color);
|
||||
m_brain->UpdateInterface();
|
||||
UpdateInterface();
|
||||
return err;
|
||||
}
|
||||
|
||||
|
@ -3273,7 +3291,7 @@ Error COldObject::StartTaskRecover()
|
|||
|
||||
m_foregroundTask = MakeUnique<CTaskManager>(this);
|
||||
Error err = m_foregroundTask->StartTaskRecover();
|
||||
m_brain->UpdateInterface();
|
||||
UpdateInterface();
|
||||
return err;
|
||||
}
|
||||
|
||||
|
@ -3285,7 +3303,7 @@ Error COldObject::StartTaskFire(float delay)
|
|||
|
||||
m_foregroundTask = MakeUnique<CTaskManager>(this);
|
||||
Error err = m_foregroundTask->StartTaskFire(delay);
|
||||
m_brain->UpdateInterface();
|
||||
UpdateInterface();
|
||||
return err;
|
||||
}
|
||||
|
||||
|
@ -3297,7 +3315,7 @@ Error COldObject::StartTaskSpiderExplo()
|
|||
|
||||
m_foregroundTask = MakeUnique<CTaskManager>(this);
|
||||
Error err = m_foregroundTask->StartTaskSpiderExplo();
|
||||
m_brain->UpdateInterface();
|
||||
UpdateInterface();
|
||||
return err;
|
||||
}
|
||||
|
||||
|
@ -3309,7 +3327,7 @@ Error COldObject::StartTaskFireAnt(Math::Vector impact)
|
|||
|
||||
m_foregroundTask = MakeUnique<CTaskManager>(this);
|
||||
Error err = m_foregroundTask->StartTaskFireAnt(impact);
|
||||
m_brain->UpdateInterface();
|
||||
UpdateInterface();
|
||||
return err;
|
||||
}
|
||||
|
||||
|
@ -3319,7 +3337,7 @@ Error COldObject::StartTaskWait(float time)
|
|||
|
||||
m_foregroundTask = MakeUnique<CTaskManager>(this);
|
||||
Error err = m_foregroundTask->StartTaskWait(time);
|
||||
m_brain->UpdateInterface();
|
||||
UpdateInterface();
|
||||
return err;
|
||||
}
|
||||
|
||||
|
@ -3329,7 +3347,7 @@ Error COldObject::StartTaskAdvance(float length)
|
|||
|
||||
m_foregroundTask = MakeUnique<CTaskManager>(this);
|
||||
Error err = m_foregroundTask->StartTaskAdvance(length);
|
||||
m_brain->UpdateInterface();
|
||||
UpdateInterface();
|
||||
return err;
|
||||
}
|
||||
|
||||
|
@ -3339,7 +3357,7 @@ Error COldObject::StartTaskTurn(float angle)
|
|||
|
||||
m_foregroundTask = MakeUnique<CTaskManager>(this);
|
||||
Error err = m_foregroundTask->StartTaskTurn(angle);
|
||||
m_brain->UpdateInterface();
|
||||
UpdateInterface();
|
||||
return err;
|
||||
}
|
||||
|
||||
|
@ -3349,7 +3367,7 @@ Error COldObject::StartTaskGoto(Math::Vector pos, float altitude, TaskGotoGoal g
|
|||
|
||||
m_foregroundTask = MakeUnique<CTaskManager>(this);
|
||||
Error err = m_foregroundTask->StartTaskGoto(pos, altitude, goalMode, crashMode);
|
||||
m_brain->UpdateInterface();
|
||||
UpdateInterface();
|
||||
return err;
|
||||
}
|
||||
|
||||
|
@ -3359,7 +3377,7 @@ Error COldObject::StartTaskInfo(const char *name, float value, float power, bool
|
|||
|
||||
m_foregroundTask = MakeUnique<CTaskManager>(this);
|
||||
Error err = m_foregroundTask->StartTaskInfo(name, value, power, bSend);
|
||||
m_brain->UpdateInterface();
|
||||
UpdateInterface();
|
||||
return err;
|
||||
}
|
||||
|
||||
|
@ -3372,7 +3390,7 @@ Error COldObject::StartTaskShield(TaskShieldMode mode, float delay)
|
|||
m_backgroundTask = MakeUnique<CTaskManager>(this);
|
||||
}
|
||||
Error err = m_backgroundTask->StartTaskShield(mode, delay);
|
||||
m_brain->UpdateInterface();
|
||||
UpdateInterface();
|
||||
return err;
|
||||
}
|
||||
|
||||
|
@ -3384,7 +3402,7 @@ Error COldObject::StartTaskGunGoal(float dirV, float dirH)
|
|||
|
||||
m_backgroundTask = MakeUnique<CTaskManager>(this);
|
||||
Error err = m_backgroundTask->StartTaskGunGoal(dirV, dirH);
|
||||
m_brain->UpdateInterface();
|
||||
UpdateInterface();
|
||||
return err;
|
||||
}
|
||||
|
||||
|
@ -3442,7 +3460,7 @@ Error COldObject::EndedTask()
|
|||
if ( err != ERR_CONTINUE ) // job ended?
|
||||
{
|
||||
m_backgroundTask.reset();
|
||||
m_brain->UpdateInterface();
|
||||
UpdateInterface();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3452,7 +3470,7 @@ Error COldObject::EndedTask()
|
|||
if ( err != ERR_CONTINUE ) // job ended?
|
||||
{
|
||||
m_foregroundTask.reset();
|
||||
m_brain->UpdateInterface();
|
||||
UpdateInterface();
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
@ -3471,3 +3489,11 @@ bool COldObject::GetActivity()
|
|||
{
|
||||
return m_activity;
|
||||
}
|
||||
|
||||
void COldObject::UpdateInterface()
|
||||
{
|
||||
if (m_objectInterface != nullptr && GetSelect())
|
||||
{
|
||||
m_objectInterface->UpdateInterface();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -55,6 +55,11 @@ struct ObjectPart
|
|||
Math::Matrix matWorld;
|
||||
};
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class CObjectInterface;
|
||||
}
|
||||
|
||||
|
||||
class COldObject : public CObject,
|
||||
public CInteractiveObject,
|
||||
|
@ -329,6 +334,8 @@ public:
|
|||
void StopForegroundTask() override;
|
||||
void StopBackgroundTask() override;
|
||||
|
||||
void UpdateInterface();
|
||||
|
||||
protected:
|
||||
bool EventFrame(const Event &event);
|
||||
void VirusFrame(float rTime);
|
||||
|
@ -351,12 +358,15 @@ protected:
|
|||
Gfx::CTerrain* m_terrain;
|
||||
Gfx::CCamera* m_camera;
|
||||
Gfx::CParticle* m_particle;
|
||||
CRobotMain* m_main;
|
||||
CSoundInterface* m_sound;
|
||||
|
||||
std::unique_ptr<CPhysics> m_physics;
|
||||
std::unique_ptr<CBrain> m_brain;
|
||||
std::unique_ptr<CMotion> m_motion;
|
||||
std::unique_ptr<CAuto> m_auto;
|
||||
CRobotMain* m_main;
|
||||
CSoundInterface* m_sound;
|
||||
std::unique_ptr<Ui::CObjectInterface> m_objectInterface;
|
||||
|
||||
CBotVar* m_botVar;
|
||||
CScript* m_runScript;
|
||||
|
||||
|
|
|
@ -246,7 +246,7 @@ Error CTaskShield::Start(TaskShieldMode mode, float delay)
|
|||
{
|
||||
if ( m_object->GetSelect() )
|
||||
{
|
||||
m_brain->UpdateInterface();
|
||||
m_object->UpdateInterface();
|
||||
}
|
||||
return ERR_OK;
|
||||
}
|
||||
|
@ -282,7 +282,7 @@ Error CTaskShield::Start(TaskShieldMode mode, float delay)
|
|||
|
||||
if ( m_object->GetSelect() )
|
||||
{
|
||||
m_brain->UpdateInterface();
|
||||
m_object->UpdateInterface();
|
||||
}
|
||||
return ERR_OK;
|
||||
}
|
||||
|
@ -319,7 +319,7 @@ Error CTaskShield::Start(TaskShieldMode mode, float delay)
|
|||
|
||||
if ( m_object->GetSelect() )
|
||||
{
|
||||
m_brain->UpdateInterface();
|
||||
m_object->UpdateInterface();
|
||||
}
|
||||
//? m_camera->StartCentering(m_object, Math::PI*0.85f, -Math::PI*0.15f, GetRadius()+40.0f, 3.0f);
|
||||
return ERR_OK;
|
||||
|
@ -358,7 +358,7 @@ Error CTaskShield::Stop()
|
|||
|
||||
if ( m_object->GetSelect() )
|
||||
{
|
||||
m_brain->UpdateInterface();
|
||||
m_object->UpdateInterface();
|
||||
}
|
||||
return ERR_CONTINUE;
|
||||
}
|
||||
|
@ -436,7 +436,7 @@ Error CTaskShield::IsEnded()
|
|||
|
||||
if ( m_object->GetSelect() )
|
||||
{
|
||||
m_brain->UpdateInterface();
|
||||
m_object->UpdateInterface();
|
||||
}
|
||||
return ERR_CONTINUE;
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,111 @@
|
|||
/*
|
||||
* This file is part of the Colobot: Gold Edition source code
|
||||
* Copyright (C) 2001-2015, Daniel Roux, EPSITEC SA & TerranovaTeam
|
||||
* http://epsiteс.ch; http://colobot.info; http://github.com/colobot
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see http://gnu.org/licenses
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "common/event.h"
|
||||
|
||||
class COldObject;
|
||||
class CTaskExecutorObject;
|
||||
class CPhysics;
|
||||
class CMotion;
|
||||
class CRobotMain;
|
||||
class CSoundInterface;
|
||||
class CLevelParserLine;
|
||||
class CBrain;
|
||||
struct Program;
|
||||
|
||||
namespace Gfx
|
||||
{
|
||||
class CEngine;
|
||||
class CTerrain;
|
||||
class CWater;
|
||||
class CCamera;
|
||||
class CParticle;
|
||||
} /* Gfx */
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class CStudio;
|
||||
class CInterface;
|
||||
class CWindow;
|
||||
|
||||
|
||||
class CObjectInterface
|
||||
{
|
||||
public:
|
||||
CObjectInterface(COldObject* object);
|
||||
~CObjectInterface();
|
||||
|
||||
void DeleteObject(bool bAll=false);
|
||||
|
||||
bool EventProcess(const Event &event);
|
||||
bool CreateInterface(bool bSelect);
|
||||
|
||||
void UpdateInterface(float rTime);
|
||||
void UpdateInterface();
|
||||
|
||||
protected:
|
||||
bool EventFrame(const Event &event);
|
||||
|
||||
void StartEditScript(Program* program, char* name);
|
||||
void StopEditScript(bool bCancel);
|
||||
|
||||
void GroundFlat();
|
||||
void ColorFlag(int color);
|
||||
|
||||
void UpdateScript(Ui::CWindow *pw);
|
||||
int GetSelScript();
|
||||
void SetSelScript(int index);
|
||||
void BlinkScript(bool bEnable);
|
||||
|
||||
void CheckInterface(CWindow *pw, EventType event, bool bState);
|
||||
void EnableInterface(CWindow *pw, EventType event, bool bState);
|
||||
void DeadInterface(CWindow *pw, EventType event, bool bState);
|
||||
void DefaultEnter(CWindow *pw, EventType event, bool bState=true);
|
||||
|
||||
protected:
|
||||
Gfx::CEngine* m_engine;
|
||||
Gfx::CTerrain* m_terrain;
|
||||
Gfx::CWater* m_water;
|
||||
Gfx::CCamera* m_camera;
|
||||
Gfx::CParticle* m_particle;
|
||||
COldObject* m_object;
|
||||
CTaskExecutorObject* m_taskExecutor;
|
||||
CBrain* m_brain;
|
||||
CPhysics* m_physics;
|
||||
CMotion* m_motion;
|
||||
Ui::CInterface* m_interface;
|
||||
CRobotMain* m_main;
|
||||
Ui::CStudio* m_studio;
|
||||
CSoundInterface* m_sound;
|
||||
|
||||
int m_selScript; // rank of the selected script
|
||||
|
||||
EventType m_manipStyle;
|
||||
EventType m_defaultEnter;
|
||||
|
||||
float m_time;
|
||||
float m_lastUpdateTime;
|
||||
float m_lastAlarmTime;
|
||||
int m_soundChannelAlarm;
|
||||
int m_flagColor;
|
||||
};
|
||||
|
||||
} // namespace Ui
|
Loading…
Reference in New Issue