MissionController improved

dev-ui
krzys-h 2013-04-29 17:26:32 +02:00
parent c2932f4ee3
commit 75950c55ba
8 changed files with 69 additions and 18 deletions

View File

@ -1309,7 +1309,8 @@ bool CBrain::CreateInterface(bool bSelect)
type == OBJECT_ANT ||
type == OBJECT_SPIDER ||
type == OBJECT_BEE ||
type == OBJECT_WORM ) // vehicle?
type == OBJECT_WORM ||
type == OBJECT_CONTROLLER) // vehicle?
{
if (!(m_main->GetRetroMode())) {
ddim.x = dim.x*5.1f;
@ -1334,7 +1335,8 @@ bool CBrain::CreateInterface(bool bSelect)
type == OBJECT_MOBILEfi ||
type == OBJECT_MOBILEfs ||
type == OBJECT_MOBILEft ||
type == OBJECT_BEE ) // driving?
type == OBJECT_BEE ||
type == OBJECT_CONTROLLER) // driving?
{
pos.x = ox+sx*6.4f;
pos.y = oy+sy*0;
@ -1346,8 +1348,9 @@ bool CBrain::CreateInterface(bool bSelect)
pb = pw->CreateButton(pos, dim, 28, EVENT_OBJECT_GASUP);
pb->SetImmediat(true);
if ( type != OBJECT_HUMAN ||
m_object->GetOption() != 2 )
if ( (type != OBJECT_HUMAN &&
type != OBJECT_CONTROLLER) ||
m_object->GetOption() != 2 )
{
pos.x = ox+sx*15.3f;
pos.y = oy+sy*0;
@ -2305,7 +2308,8 @@ void CBrain::UpdateInterface()
type == OBJECT_ANT ||
type == OBJECT_SPIDER ||
type == OBJECT_BEE ||
type == OBJECT_WORM ) // vehicle?
type == OBJECT_WORM ||
type == OBJECT_CONTROLLER) // vehicle?
{
bRun = false;
if ( m_script[m_selScript] != 0 )

View File

@ -17,16 +17,12 @@
#include "object/motion/motiondummy.h"
#include "physics/physics.h"
#include "graphics/engine/modelmanager.h"
#include <stdio.h>
#include <string.h>
// Object's constructor.
CMotionDummy::CMotionDummy(CObject* object) : CMotion(object)
@ -59,5 +55,30 @@ bool CMotionDummy::Create(Math::Vector pos, float angle, ObjectType type,
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_VEHICLE); // this is a moving object
m_object->SetObjectRank(0, rank);
// Movement
m_physics->SetType(TYPE_FLYING);
m_physics->SetLinMotionX(MO_ADVSPEED, 50.0f);
m_physics->SetLinMotionX(MO_RECSPEED, 50.0f);
m_physics->SetLinMotionX(MO_ADVACCEL, 20.0f);
m_physics->SetLinMotionX(MO_RECACCEL, 20.0f);
m_physics->SetLinMotionX(MO_STOACCEL, 20.0f);
m_physics->SetLinMotionX(MO_TERSLIDE, 5.0f);
m_physics->SetLinMotionZ(MO_TERSLIDE, 5.0f);
m_physics->SetLinMotionX(MO_TERFORCE, 50.0f);
m_physics->SetLinMotionZ(MO_TERFORCE, 50.0f);
m_physics->SetLinMotionZ(MO_MOTACCEL, 40.0f);
m_physics->SetLinMotionY(MO_ADVSPEED, 60.0f);
m_physics->SetLinMotionY(MO_RECSPEED, 60.0f);
m_physics->SetLinMotionY(MO_ADVACCEL, 20.0f);
m_physics->SetLinMotionY(MO_RECACCEL, 50.0f);
m_physics->SetLinMotionY(MO_STOACCEL, 50.0f);
m_physics->SetCirMotionY(MO_ADVSPEED, 0.4f*Math::PI);
m_physics->SetCirMotionY(MO_RECSPEED, 0.4f*Math::PI);
m_physics->SetCirMotionY(MO_ADVACCEL, 2.0f);
m_physics->SetCirMotionY(MO_RECACCEL, 2.0f);
m_physics->SetCirMotionY(MO_STOACCEL, 2.0f);
return true;
}
}

View File

@ -656,6 +656,7 @@ CRobotMain::CRobotMain(CApplication* app)
m_terrainCreate = false;
m_version = 1;
m_controller = nullptr;
m_retroStyle = false;
m_immediatSatCom = false;
m_beginSatCom = false;
@ -1791,6 +1792,23 @@ void CRobotMain::ExecuteCmd(char *cmd)
return;
}
if (strcmp(cmd, "controller") == 0)
{
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();
CObject* prev = DeselectAll();
if (prev != nullptr && prev != m_controller)
m_controller->AddDeselList(prev);
SelectOneObject(m_controller, true);
m_short->UpdateShortcuts();
}
return;
}
if (strcmp(cmd, "photo1") == 0)
{
m_freePhoto = !m_freePhoto;
@ -3839,6 +3857,8 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject)
m_mapImage = false;
m_mapFilename[0] = 0;
m_controller = nullptr;
m_colorRefBot.r = 10.0f/256.0f;
m_colorRefBot.g = 166.0f/256.0f;
m_colorRefBot.b = 254.0f/256.0f; // blue
@ -4358,14 +4378,15 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject)
continue;
}
CObject* obj = CreateObject(Math::Vector(0.0f, 0.0f, 0.0f), 0.0f, 1.0f, 0.0f, OBJECT_CONTROLLER, 100.0f, false, false, 0);
CBrain* brain = obj->GetBrain();
m_controller = CreateObject(Math::Vector(0.0f, 0.0f, 0.0f), 0.0f, 1.0f, 0.0f, OBJECT_CONTROLLER, 100.0f, false, false, 0);
m_controller->SetMagnifyDamage(100.0f);
CBrain* brain = m_controller->GetBrain();
if (brain != nullptr)
{
OpString(line, "script", name);
if (name[0] != 0)
brain->SetScriptName(1, name);
brain->SetScriptRun(1);
brain->SetScriptName(0, name);
brain->SetScriptRun(0);
}
}

View File

@ -469,6 +469,8 @@ protected:
int m_delayWriteMessage;
int m_movieInfoIndex;
CObject* m_controller;
//Level Checker flags
bool m_beginObject;
bool m_terrainGenerate;

View File

@ -1455,7 +1455,7 @@ void CTaskGoto::ComputeRepulse(Math::Point &dir)
// The worm goes everywhere and through everything!
iType = m_object->GetType();
if ( iType == OBJECT_WORM ) return;
if ( iType == OBJECT_WORM || iType == OBJECT_CONTROLLER ) return;
m_object->GetCrashSphere(0, iPos, iRadius);
gDist = Math::Distance(iPos, m_goal);

View File

@ -794,7 +794,8 @@ void CPhysics::MotorUpdate(float aTime, float rTime)
type == OBJECT_BEE ||
type == OBJECT_WORM ||
type == OBJECT_APOLLO2 ||
type == OBJECT_MOBILEdr )
type == OBJECT_MOBILEdr ||
type == OBJECT_CONTROLLER)
{
power = 0;
}

View File

@ -401,6 +401,7 @@ ObjectType GetTypeObject(char *line, int rank, ObjectType def)
if ( Cmd(p, "ApolloAntenna" ) ) return OBJECT_APOLLO5;
if ( Cmd(p, "Me" ) ) return OBJECT_HUMAN;
if ( Cmd(p, "Tech" ) ) return OBJECT_TECH;
if ( Cmd(p, "MissionController" ) ) return OBJECT_CONTROLLER;
return def;
}
@ -647,6 +648,7 @@ const char* GetTypeObject(ObjectType type)
if ( type == OBJECT_APOLLO5 ) return "ApolloAntenna";
if ( type == OBJECT_HUMAN ) return "Me";
if ( type == OBJECT_TECH ) return "Tech";
if ( type == OBJECT_CONTROLLER ) return "MissionController";
return "";
}

View File

@ -668,7 +668,7 @@ bool CScript::rRadar(CBotVar* var, CBotVar* result, int& exception, void* user)
if ( pObj->GetProxyActivate() ) continue;
oType = pObj->GetType();
if ( oType == OBJECT_TOTO ) continue;
if ( oType == OBJECT_TOTO || oType == OBJECT_CONTROLLER ) continue;
if ( oType == OBJECT_RUINmobilew2 ||
oType == OBJECT_RUINmobilet1 ||