parent
fc28a8e840
commit
c7d289c00b
|
@ -2145,8 +2145,10 @@ bool CObject::CreateVehicle(Math::Vector pos, float angle, ObjectType type,
|
||||||
{
|
{
|
||||||
m_motion = new CMotionHuman(this);
|
m_motion = new CMotionHuman(this);
|
||||||
}
|
}
|
||||||
else
|
else if ( type == OBJECT_CONTROLLER ) {
|
||||||
{
|
m_motion = new CMotion(this); //dummy object
|
||||||
|
}
|
||||||
|
else {
|
||||||
m_motion = new CMotionVehicle(this);
|
m_motion = new CMotionVehicle(this);
|
||||||
}
|
}
|
||||||
if ( m_motion == 0 ) return false;
|
if ( m_motion == 0 ) return false;
|
||||||
|
|
|
@ -156,6 +156,7 @@ enum ObjectType
|
||||||
OBJECT_MOBILEsa = 210, //! < submarine
|
OBJECT_MOBILEsa = 210, //! < submarine
|
||||||
OBJECT_MOBILEtg = 211, //! < training target
|
OBJECT_MOBILEtg = 211, //! < training target
|
||||||
OBJECT_MOBILEdr = 212, //! < robot drawing
|
OBJECT_MOBILEdr = 212, //! < robot drawing
|
||||||
|
OBJECT_CONTROLLER = 213, //! < mission controller
|
||||||
OBJECT_WAYPOINT = 250, //! < waypoint
|
OBJECT_WAYPOINT = 250, //! < waypoint
|
||||||
OBJECT_FLAGb = 260, //! < blue flag
|
OBJECT_FLAGb = 260, //! < blue flag
|
||||||
OBJECT_FLAGr = 261, //! < red flag
|
OBJECT_FLAGr = 261, //! < red flag
|
||||||
|
|
|
@ -4351,6 +4351,24 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject)
|
||||||
m_beginObject = true;
|
m_beginObject = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Cmd(line, "MissionController") && read[0] == 0 && m_version == 3)
|
||||||
|
{
|
||||||
|
if (!m_beginObject) {
|
||||||
|
GetLogger()->Error("Syntax error in file '%s' (line %d): MissionController before BeginObject\n", filename, lineNum);
|
||||||
|
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();
|
||||||
|
if (brain != nullptr)
|
||||||
|
{
|
||||||
|
OpString(line, "script", name);
|
||||||
|
if (name[0] != 0)
|
||||||
|
brain->SetScriptName(1, name);
|
||||||
|
brain->SetScriptRun(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (Cmd(line, "CreateObject") && read[0] == 0)
|
if (Cmd(line, "CreateObject") && read[0] == 0)
|
||||||
{
|
{
|
||||||
if (!m_beginObject) {
|
if (!m_beginObject) {
|
||||||
|
@ -4672,7 +4690,7 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject)
|
||||||
m_camera->SetFixDirection(OpFloat(line, "fixDirection", 0.25f)*Math::PI);
|
m_camera->SetFixDirection(OpFloat(line, "fixDirection", 0.25f)*Math::PI);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Cmd(line, "EndMissionTake") && !resetObject)
|
if (Cmd(line, "EndMissionTake") && !resetObject && m_version<3)
|
||||||
{
|
{
|
||||||
int i = m_endTakeTotal;
|
int i = m_endTakeTotal;
|
||||||
if (i < 10)
|
if (i < 10)
|
||||||
|
@ -4695,16 +4713,16 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject)
|
||||||
m_endTakeTotal ++;
|
m_endTakeTotal ++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (Cmd(line, "EndMissionDelay") && !resetObject)
|
if (Cmd(line, "EndMissionDelay") && !resetObject && m_version<3)
|
||||||
{
|
{
|
||||||
m_endTakeWinDelay = OpFloat(line, "win", 2.0f);
|
m_endTakeWinDelay = OpFloat(line, "win", 2.0f);
|
||||||
m_endTakeLostDelay = OpFloat(line, "lost", 2.0f);
|
m_endTakeLostDelay = OpFloat(line, "lost", 2.0f);
|
||||||
}
|
}
|
||||||
if (Cmd(line, "EndMissionResearch") && !resetObject)
|
if (Cmd(line, "EndMissionResearch") && !resetObject && m_version<3)
|
||||||
{
|
{
|
||||||
m_endTakeResearch |= OpResearch(line, "type");
|
m_endTakeResearch |= OpResearch(line, "type");
|
||||||
}
|
}
|
||||||
if (Cmd(line, "EndMissionNever") && !resetObject && m_version >= 2)
|
if (Cmd(line, "EndMissionNever") && !resetObject && m_version == 2)
|
||||||
{
|
{
|
||||||
m_endTakeNever = true;
|
m_endTakeNever = true;
|
||||||
}
|
}
|
||||||
|
@ -5134,7 +5152,8 @@ CObject* CRobotMain::CreateObject(Math::Vector pos, float angle, float zoom, flo
|
||||||
type == OBJECT_MOBILEwt ||
|
type == OBJECT_MOBILEwt ||
|
||||||
type == OBJECT_MOBILEit ||
|
type == OBJECT_MOBILEit ||
|
||||||
type == OBJECT_MOBILEdr ||
|
type == OBJECT_MOBILEdr ||
|
||||||
type == OBJECT_APOLLO2 )
|
type == OBJECT_APOLLO2 ||
|
||||||
|
type == OBJECT_CONTROLLER )
|
||||||
{
|
{
|
||||||
object = new CObject();
|
object = new CObject();
|
||||||
object->SetOption(option);
|
object->SetOption(option);
|
||||||
|
@ -6690,6 +6709,8 @@ void CRobotMain::UpdateAudio(bool frame)
|
||||||
//! Checks if the mission is over
|
//! Checks if the mission is over
|
||||||
Error CRobotMain::CheckEndMission(bool frame)
|
Error CRobotMain::CheckEndMission(bool frame)
|
||||||
{
|
{
|
||||||
|
if (m_version >= 3) return ERR_MISSION_NOTERM; //disabled. TODO: Control from program
|
||||||
|
|
||||||
CInstanceManager* iMan = CInstanceManager::GetInstancePointer();
|
CInstanceManager* iMan = CInstanceManager::GetInstancePointer();
|
||||||
|
|
||||||
for (int t = 0; t < m_endTakeTotal; t++)
|
for (int t = 0; t < m_endTakeTotal; t++)
|
||||||
|
@ -6769,7 +6790,7 @@ Error CRobotMain::CheckEndMission(bool frame)
|
||||||
}
|
}
|
||||||
if (nb < m_endTake[t].min ||
|
if (nb < m_endTake[t].min ||
|
||||||
nb > m_endTake[t].max ||
|
nb > m_endTake[t].max ||
|
||||||
m_endTakeNever)
|
m_endTakeNever )
|
||||||
{
|
{
|
||||||
m_displayText->SetEnable(true);
|
m_displayText->SetEnable(true);
|
||||||
return ERR_MISSION_NOTERM;
|
return ERR_MISSION_NOTERM;
|
||||||
|
|
Loading…
Reference in New Issue