Level saving through CLevelParser
parent
1477e72ab4
commit
3dade17f89
|
@ -1799,8 +1799,8 @@ void CApplication::SetLanguage(Language language)
|
||||||
putenv(S_LANGUAGE);
|
putenv(S_LANGUAGE);
|
||||||
GetLogger()->Trace("SetLanguage: Set LANGUAGE=%s in environment\n", locale.c_str());
|
GetLogger()->Trace("SetLanguage: Set LANGUAGE=%s in environment\n", locale.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
setlocale(LC_ALL, "");
|
std::locale::global(std::locale(std::locale(""), "C", std::locale::numeric));
|
||||||
|
|
||||||
bindtextdomain("colobot", m_langPath.c_str());
|
bindtextdomain("colobot", m_langPath.c_str());
|
||||||
bind_textdomain_codeset("colobot", "UTF-8");
|
bind_textdomain_codeset("colobot", "UTF-8");
|
||||||
|
|
|
@ -26,6 +26,9 @@
|
||||||
#include "common/event.h"
|
#include "common/event.h"
|
||||||
#include "common/iman.h"
|
#include "common/iman.h"
|
||||||
|
|
||||||
|
#include "object/level/parserline.h"
|
||||||
|
#include "object/level/parserparam.h"
|
||||||
|
|
||||||
#include "script/cmdtoken.h"
|
#include "script/cmdtoken.h"
|
||||||
|
|
||||||
#include "ui/interface.h"
|
#include "ui/interface.h"
|
||||||
|
@ -424,24 +427,13 @@ void CAuto::SetMotor(bool bMotor)
|
||||||
|
|
||||||
// Saves all parameters of the controller.
|
// Saves all parameters of the controller.
|
||||||
|
|
||||||
bool CAuto::Write(char *line)
|
bool CAuto::Write(CLevelParserLine* line)
|
||||||
{
|
{
|
||||||
char name[100];
|
line->AddParam("aType", new CLevelParserParam(m_type));
|
||||||
|
line->AddParam("aBusy", new CLevelParserParam(m_bBusy));
|
||||||
sprintf(name, " aType=%d", m_type);
|
line->AddParam("aTime", new CLevelParserParam(m_time));
|
||||||
strcat(line, name);
|
line->AddParam("aProgressTime", new CLevelParserParam(m_progressTime));
|
||||||
|
line->AddParam("aProgressTotal", new CLevelParserParam(m_progressTotal));
|
||||||
sprintf(name, " aBusy=%d", m_bBusy);
|
|
||||||
strcat(line, name);
|
|
||||||
|
|
||||||
sprintf(name, " aTime=%.2f", m_time);
|
|
||||||
strcat(line, name);
|
|
||||||
|
|
||||||
sprintf(name, " aProgressTime=%.2f", m_progressTime);
|
|
||||||
strcat(line, name);
|
|
||||||
|
|
||||||
sprintf(name, " aProgressTotal=%.2f", m_progressTotal);
|
|
||||||
strcat(line, name);
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
class CInstanceManager;
|
class CInstanceManager;
|
||||||
class CRobotMain;
|
class CRobotMain;
|
||||||
class CSoundInterface;
|
class CSoundInterface;
|
||||||
|
class CLevelParserLine;
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class CInterface;
|
class CInterface;
|
||||||
|
@ -80,7 +81,7 @@ public:
|
||||||
virtual bool GetMotor();
|
virtual bool GetMotor();
|
||||||
virtual void SetMotor(bool bMotor);
|
virtual void SetMotor(bool bMotor);
|
||||||
|
|
||||||
virtual bool Write(char *line);
|
virtual bool Write(CLevelParserLine* line);
|
||||||
virtual bool Read(char *line);
|
virtual bool Read(char *line);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
|
@ -24,6 +24,9 @@
|
||||||
|
|
||||||
#include "math/geometry.h"
|
#include "math/geometry.h"
|
||||||
|
|
||||||
|
#include "object/level/parserline.h"
|
||||||
|
#include "object/level/parserparam.h"
|
||||||
|
|
||||||
#include "script/cmdtoken.h"
|
#include "script/cmdtoken.h"
|
||||||
|
|
||||||
#include "ui/interface.h"
|
#include "ui/interface.h"
|
||||||
|
@ -361,26 +364,16 @@ bool CAutoConvert::CreateInterface(bool bSelect)
|
||||||
|
|
||||||
// Saves all parameters of the controller.
|
// Saves all parameters of the controller.
|
||||||
|
|
||||||
bool CAutoConvert::Write(char *line)
|
bool CAutoConvert::Write(CLevelParserLine* line)
|
||||||
{
|
{
|
||||||
char name[100];
|
|
||||||
|
|
||||||
if ( m_phase == ACP_STOP ||
|
if ( m_phase == ACP_STOP ||
|
||||||
m_phase == ACP_WAIT ) return false;
|
m_phase == ACP_WAIT ) return false;
|
||||||
|
|
||||||
sprintf(name, " aExist=%d", 1);
|
line->AddParam("aExist", new CLevelParserParam(true));
|
||||||
strcat(line, name);
|
|
||||||
|
|
||||||
CAuto::Write(line);
|
CAuto::Write(line);
|
||||||
|
line->AddParam("aPhase", new CLevelParserParam(static_cast<int>(m_phase)));
|
||||||
sprintf(name, " aPhase=%d", m_phase);
|
line->AddParam("aProgress", new CLevelParserParam(m_progress));
|
||||||
strcat(line, name);
|
line->AddParam("aSpeed", new CLevelParserParam(m_speed));
|
||||||
|
|
||||||
sprintf(name, " aProgress=%.2f", m_progress);
|
|
||||||
strcat(line, name);
|
|
||||||
|
|
||||||
sprintf(name, " aSpeed=%.2f", m_speed);
|
|
||||||
strcat(line, name);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,7 +52,7 @@ public:
|
||||||
|
|
||||||
bool CreateInterface(bool bSelect);
|
bool CreateInterface(bool bSelect);
|
||||||
|
|
||||||
bool Write(char *line);
|
bool Write(CLevelParserLine* line);
|
||||||
bool Read(char *line);
|
bool Read(char *line);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
|
@ -26,6 +26,9 @@
|
||||||
|
|
||||||
#include "math/geometry.h"
|
#include "math/geometry.h"
|
||||||
|
|
||||||
|
#include "object/level/parserline.h"
|
||||||
|
#include "object/level/parserparam.h"
|
||||||
|
|
||||||
#include "script/cmdtoken.h"
|
#include "script/cmdtoken.h"
|
||||||
|
|
||||||
#include "ui/interface.h"
|
#include "ui/interface.h"
|
||||||
|
@ -428,25 +431,15 @@ bool CAutoDerrick::CreateInterface(bool bSelect)
|
||||||
|
|
||||||
// Saves all parameters of the controller.
|
// Saves all parameters of the controller.
|
||||||
|
|
||||||
bool CAutoDerrick::Write(char *line)
|
bool CAutoDerrick::Write(CLevelParserLine* line)
|
||||||
{
|
{
|
||||||
char name[100];
|
|
||||||
|
|
||||||
if ( m_phase == ADP_WAIT ) return false;
|
if ( m_phase == ADP_WAIT ) return false;
|
||||||
|
|
||||||
sprintf(name, " aExist=%d", 1);
|
line->AddParam("aExist", new CLevelParserParam(true));
|
||||||
strcat(line, name);
|
|
||||||
|
|
||||||
CAuto::Write(line);
|
CAuto::Write(line);
|
||||||
|
line->AddParam("aPhase", new CLevelParserParam(static_cast<int>(m_phase)));
|
||||||
sprintf(name, " aPhase=%d", m_phase);
|
line->AddParam("aProgress", new CLevelParserParam(m_progress));
|
||||||
strcat(line, name);
|
line->AddParam("aSpeed", new CLevelParserParam(m_speed));
|
||||||
|
|
||||||
sprintf(name, " aProgress=%.2f", m_progress);
|
|
||||||
strcat(line, name);
|
|
||||||
|
|
||||||
sprintf(name, " aSpeed=%.2f", m_speed);
|
|
||||||
strcat(line, name);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,7 @@ public:
|
||||||
|
|
||||||
bool CreateInterface(bool bSelect);
|
bool CreateInterface(bool bSelect);
|
||||||
|
|
||||||
bool Write(char *line);
|
bool Write(CLevelParserLine* line);
|
||||||
bool Read(char *line);
|
bool Read(char *line);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
|
@ -22,6 +22,9 @@
|
||||||
|
|
||||||
#include "common/iman.h"
|
#include "common/iman.h"
|
||||||
|
|
||||||
|
#include "object/level/parserline.h"
|
||||||
|
#include "object/level/parserparam.h"
|
||||||
|
|
||||||
#include "script/cmdtoken.h"
|
#include "script/cmdtoken.h"
|
||||||
|
|
||||||
#include "ui/interface.h"
|
#include "ui/interface.h"
|
||||||
|
@ -357,25 +360,15 @@ Error CAutoDestroyer::GetError()
|
||||||
|
|
||||||
// Saves all parameters of the controller.
|
// Saves all parameters of the controller.
|
||||||
|
|
||||||
bool CAutoDestroyer::Write(char *line)
|
bool CAutoDestroyer::Write(CLevelParserLine* line)
|
||||||
{
|
{
|
||||||
char name[100];
|
|
||||||
|
|
||||||
if ( m_phase == ADEP_WAIT ) return false;
|
if ( m_phase == ADEP_WAIT ) return false;
|
||||||
|
|
||||||
sprintf(name, " aExist=%d", 1);
|
line->AddParam("aExist", new CLevelParserParam(true));
|
||||||
strcat(line, name);
|
|
||||||
|
|
||||||
CAuto::Write(line);
|
CAuto::Write(line);
|
||||||
|
line->AddParam("aPhase", new CLevelParserParam(static_cast<int>(m_phase)));
|
||||||
sprintf(name, " aPhase=%d", m_phase);
|
line->AddParam("aProgress", new CLevelParserParam(m_progress));
|
||||||
strcat(line, name);
|
line->AddParam("aSpeed", new CLevelParserParam(m_speed));
|
||||||
|
|
||||||
sprintf(name, " aProgress=%.2f", m_progress);
|
|
||||||
strcat(line, name);
|
|
||||||
|
|
||||||
sprintf(name, " aSpeed=%.2f", m_speed);
|
|
||||||
strcat(line, name);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,7 +52,7 @@ public:
|
||||||
|
|
||||||
bool CreateInterface(bool bSelect);
|
bool CreateInterface(bool bSelect);
|
||||||
|
|
||||||
bool Write(char *line);
|
bool Write(CLevelParserLine* line);
|
||||||
bool Read(char *line);
|
bool Read(char *line);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
|
@ -24,6 +24,9 @@
|
||||||
|
|
||||||
#include "math/geometry.h"
|
#include "math/geometry.h"
|
||||||
|
|
||||||
|
#include "object/level/parserline.h"
|
||||||
|
#include "object/level/parserparam.h"
|
||||||
|
|
||||||
#include "script/cmdtoken.h"
|
#include "script/cmdtoken.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -310,34 +313,18 @@ CObject* CAutoEgg::SearchAlien()
|
||||||
|
|
||||||
// Saves all parameters of the controller.
|
// Saves all parameters of the controller.
|
||||||
|
|
||||||
bool CAutoEgg::Write(char *line)
|
bool CAutoEgg::Write(CLevelParserLine* line)
|
||||||
{
|
{
|
||||||
char name[100];
|
|
||||||
|
|
||||||
if ( m_phase == AEP_NULL ) return false;
|
if ( m_phase == AEP_NULL ) return false;
|
||||||
|
|
||||||
sprintf(name, " aExist=%d", 1);
|
line->AddParam("aExist", new CLevelParserParam(true));
|
||||||
strcat(line, name);
|
|
||||||
|
|
||||||
CAuto::Write(line);
|
CAuto::Write(line);
|
||||||
|
line->AddParam("aPhase", new CLevelParserParam(static_cast<int>(m_phase)));
|
||||||
sprintf(name, " aPhase=%d", m_phase);
|
line->AddParam("aProgress", new CLevelParserParam(m_progress));
|
||||||
strcat(line, name);
|
line->AddParam("aSpeed", new CLevelParserParam(m_speed));
|
||||||
|
line->AddParam("aParamType", new CLevelParserParam(m_type));
|
||||||
sprintf(name, " aProgress=%.2f", m_progress);
|
line->AddParam("aParamValue1", new CLevelParserParam(m_value));
|
||||||
strcat(line, name);
|
line->AddParam("aParamString", new CLevelParserParam(m_string));
|
||||||
|
|
||||||
sprintf(name, " aSpeed=%.5f", m_speed);
|
|
||||||
strcat(line, name);
|
|
||||||
|
|
||||||
sprintf(name, " aParamType=%s", GetTypeObject(m_type));
|
|
||||||
strcat(line, name);
|
|
||||||
|
|
||||||
sprintf(name, " aParamValue1=%.2f", m_value);
|
|
||||||
strcat(line, name);
|
|
||||||
|
|
||||||
sprintf(name, " aParamString=\"%s\"", m_string);
|
|
||||||
strcat(line, name);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,7 +54,7 @@ public:
|
||||||
bool SetValue(int rank, float value);
|
bool SetValue(int rank, float value);
|
||||||
bool SetString(char *string);
|
bool SetString(char *string);
|
||||||
|
|
||||||
bool Write(char *line);
|
bool Write(CLevelParserLine* line);
|
||||||
bool Read(char *line);
|
bool Read(char *line);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
|
@ -26,6 +26,9 @@
|
||||||
|
|
||||||
#include "math/geometry.h"
|
#include "math/geometry.h"
|
||||||
|
|
||||||
|
#include "object/level/parserline.h"
|
||||||
|
#include "object/level/parserparam.h"
|
||||||
|
|
||||||
#include "script/cmdtoken.h"
|
#include "script/cmdtoken.h"
|
||||||
|
|
||||||
#include "ui/interface.h"
|
#include "ui/interface.h"
|
||||||
|
@ -609,26 +612,16 @@ void CAutoEnergy::UpdateInterface(float rTime)
|
||||||
|
|
||||||
// Saves all parameters of the controller.
|
// Saves all parameters of the controller.
|
||||||
|
|
||||||
bool CAutoEnergy::Write(char *line)
|
bool CAutoEnergy::Write(CLevelParserLine* line)
|
||||||
{
|
{
|
||||||
char name[100];
|
|
||||||
|
|
||||||
if ( m_phase == AENP_STOP ||
|
if ( m_phase == AENP_STOP ||
|
||||||
m_phase == AENP_WAIT ) return false;
|
m_phase == AENP_WAIT ) return false;
|
||||||
|
|
||||||
sprintf(name, " aExist=%d", 1);
|
line->AddParam("aExist", new CLevelParserParam(true));
|
||||||
strcat(line, name);
|
|
||||||
|
|
||||||
CAuto::Write(line);
|
CAuto::Write(line);
|
||||||
|
line->AddParam("aPhase", new CLevelParserParam(static_cast<int>(m_phase)));
|
||||||
sprintf(name, " aPhase=%d", m_phase);
|
line->AddParam("aProgress", new CLevelParserParam(m_progress));
|
||||||
strcat(line, name);
|
line->AddParam("aSpeed", new CLevelParserParam(m_speed));
|
||||||
|
|
||||||
sprintf(name, " aProgress=%.2f", m_progress);
|
|
||||||
strcat(line, name);
|
|
||||||
|
|
||||||
sprintf(name, " aSpeed=%.2f", m_speed);
|
|
||||||
strcat(line, name);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,7 @@ public:
|
||||||
|
|
||||||
bool CreateInterface(bool bSelect);
|
bool CreateInterface(bool bSelect);
|
||||||
|
|
||||||
bool Write(char *line);
|
bool Write(CLevelParserLine* line);
|
||||||
bool Read(char *line);
|
bool Read(char *line);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
|
@ -27,6 +27,8 @@
|
||||||
|
|
||||||
#include "object/robotmain.h"
|
#include "object/robotmain.h"
|
||||||
#include "object/brain.h"
|
#include "object/brain.h"
|
||||||
|
#include "object/level/parserline.h"
|
||||||
|
#include "object/level/parserparam.h"
|
||||||
|
|
||||||
#include "physics/physics.h"
|
#include "physics/physics.h"
|
||||||
|
|
||||||
|
@ -515,25 +517,15 @@ bool CAutoFactory::EventProcess(const Event &event)
|
||||||
|
|
||||||
// Saves all parameters of the controller.
|
// Saves all parameters of the controller.
|
||||||
|
|
||||||
bool CAutoFactory::Write(char *line)
|
bool CAutoFactory::Write(CLevelParserLine* line)
|
||||||
{
|
{
|
||||||
char name[100];
|
|
||||||
|
|
||||||
if ( m_phase == AFP_WAIT ) return false;
|
if ( m_phase == AFP_WAIT ) return false;
|
||||||
|
|
||||||
sprintf(name, " aExist=%d", 1);
|
line->AddParam("aExist", new CLevelParserParam(true));
|
||||||
strcat(line, name);
|
|
||||||
|
|
||||||
CAuto::Write(line);
|
CAuto::Write(line);
|
||||||
|
line->AddParam("aPhase", new CLevelParserParam(static_cast<int>(m_phase)));
|
||||||
sprintf(name, " aPhase=%d", m_phase);
|
line->AddParam("aProgress", new CLevelParserParam(m_progress));
|
||||||
strcat(line, name);
|
line->AddParam("aSpeed", new CLevelParserParam(m_speed));
|
||||||
|
|
||||||
sprintf(name, " aProgress=%.2f", m_progress);
|
|
||||||
strcat(line, name);
|
|
||||||
|
|
||||||
sprintf(name, " aSpeed=%.2f", m_speed);
|
|
||||||
strcat(line, name);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,7 +55,7 @@ public:
|
||||||
|
|
||||||
bool CreateInterface(bool bSelect);
|
bool CreateInterface(bool bSelect);
|
||||||
|
|
||||||
bool Write(char *line);
|
bool Write(CLevelParserLine* line);
|
||||||
bool Read(char *line);
|
bool Read(char *line);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
|
@ -20,7 +20,12 @@
|
||||||
|
|
||||||
#include "object/auto/autoinfo.h"
|
#include "object/auto/autoinfo.h"
|
||||||
|
|
||||||
|
|
||||||
|
#include "object/level/parserline.h"
|
||||||
|
#include "object/level/parserparam.h"
|
||||||
|
|
||||||
#include "script/cmdtoken.h"
|
#include "script/cmdtoken.h"
|
||||||
|
|
||||||
#include "ui/interface.h"
|
#include "ui/interface.h"
|
||||||
#include "ui/list.h"
|
#include "ui/list.h"
|
||||||
#include "ui/window.h"
|
#include "ui/window.h"
|
||||||
|
@ -475,25 +480,15 @@ void CAutoInfo::UpdateListVirus()
|
||||||
|
|
||||||
// Saves all parameters of the controller.
|
// Saves all parameters of the controller.
|
||||||
|
|
||||||
bool CAutoInfo::Write(char *line)
|
bool CAutoInfo::Write(CLevelParserLine* line)
|
||||||
{
|
{
|
||||||
char name[100];
|
|
||||||
|
|
||||||
if ( m_phase == AIP_WAIT ) return false;
|
if ( m_phase == AIP_WAIT ) return false;
|
||||||
|
|
||||||
sprintf(name, " aExist=%d", 1);
|
line->AddParam("aExist", new CLevelParserParam(true));
|
||||||
strcat(line, name);
|
|
||||||
|
|
||||||
CAuto::Write(line);
|
CAuto::Write(line);
|
||||||
|
line->AddParam("aPhase", new CLevelParserParam(static_cast<int>(m_phase)));
|
||||||
sprintf(name, " aPhase=%d", m_phase);
|
line->AddParam("aProgress", new CLevelParserParam(m_progress));
|
||||||
strcat(line, name);
|
line->AddParam("aSpeed", new CLevelParserParam(m_speed));
|
||||||
|
|
||||||
sprintf(name, " aProgress=%.2f", m_progress);
|
|
||||||
strcat(line, name);
|
|
||||||
|
|
||||||
sprintf(name, " aSpeed=%.2f", m_speed);
|
|
||||||
strcat(line, name);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,7 @@ public:
|
||||||
|
|
||||||
bool CreateInterface(bool bSelect);
|
bool CreateInterface(bool bSelect);
|
||||||
|
|
||||||
bool Write(char *line);
|
bool Write(CLevelParserLine* line);
|
||||||
bool Read(char *line);
|
bool Read(char *line);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
|
@ -26,6 +26,8 @@
|
||||||
#include "math/geometry.h"
|
#include "math/geometry.h"
|
||||||
|
|
||||||
#include "object/robotmain.h"
|
#include "object/robotmain.h"
|
||||||
|
#include "object/level/parserline.h"
|
||||||
|
#include "object/level/parserparam.h"
|
||||||
|
|
||||||
#include "script/cmdtoken.h"
|
#include "script/cmdtoken.h"
|
||||||
|
|
||||||
|
@ -586,29 +588,16 @@ void CAutoLabo::SoundManip(float time, float amplitude, float frequency)
|
||||||
|
|
||||||
// Saves all parameters of the controller.
|
// Saves all parameters of the controller.
|
||||||
|
|
||||||
bool CAutoLabo::Write(char *line)
|
bool CAutoLabo::Write(CLevelParserLine* line)
|
||||||
{
|
{
|
||||||
Math::Vector pos;
|
|
||||||
char name[100];
|
|
||||||
|
|
||||||
if ( m_phase == ALAP_WAIT ) return false;
|
if ( m_phase == ALAP_WAIT ) return false;
|
||||||
|
|
||||||
sprintf(name, " aExist=%d", 1);
|
line->AddParam("aExist", new CLevelParserParam(true));
|
||||||
strcat(line, name);
|
|
||||||
|
|
||||||
CAuto::Write(line);
|
CAuto::Write(line);
|
||||||
|
line->AddParam("aPhase", new CLevelParserParam(static_cast<int>(m_phase)));
|
||||||
sprintf(name, " aPhase=%d", m_phase);
|
line->AddParam("aProgress", new CLevelParserParam(m_progress));
|
||||||
strcat(line, name);
|
line->AddParam("aSpeed", new CLevelParserParam(m_speed));
|
||||||
|
line->AddParam("aResearch", new CLevelParserParam(static_cast<int>(m_research)));
|
||||||
sprintf(name, " aProgress=%.2f", m_progress);
|
|
||||||
strcat(line, name);
|
|
||||||
|
|
||||||
sprintf(name, " aSpeed=%.2f", m_speed);
|
|
||||||
strcat(line, name);
|
|
||||||
|
|
||||||
sprintf(name, " aResearch=%d", m_research);
|
|
||||||
strcat(line, name);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -617,8 +606,6 @@ bool CAutoLabo::Write(char *line)
|
||||||
|
|
||||||
bool CAutoLabo::Read(char *line)
|
bool CAutoLabo::Read(char *line)
|
||||||
{
|
{
|
||||||
Math::Vector pos;
|
|
||||||
|
|
||||||
if ( OpInt(line, "aExist", 0) == 0 ) return false;
|
if ( OpInt(line, "aExist", 0) == 0 ) return false;
|
||||||
|
|
||||||
CAuto::Read(line);
|
CAuto::Read(line);
|
||||||
|
|
|
@ -55,7 +55,7 @@ public:
|
||||||
|
|
||||||
bool CreateInterface(bool bSelect);
|
bool CreateInterface(bool bSelect);
|
||||||
|
|
||||||
bool Write(char *line);
|
bool Write(CLevelParserLine* line);
|
||||||
bool Read(char *line);
|
bool Read(char *line);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
|
@ -22,6 +22,9 @@
|
||||||
|
|
||||||
#include "common/iman.h"
|
#include "common/iman.h"
|
||||||
|
|
||||||
|
#include "object/level/parserline.h"
|
||||||
|
#include "object/level/parserparam.h"
|
||||||
|
|
||||||
#include "script/cmdtoken.h"
|
#include "script/cmdtoken.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -301,26 +304,15 @@ Error CAutoMush::GetError()
|
||||||
|
|
||||||
// Saves all parameters of the controller.
|
// Saves all parameters of the controller.
|
||||||
|
|
||||||
bool CAutoMush::Write(char *line)
|
bool CAutoMush::Write(CLevelParserLine* line)
|
||||||
{
|
{
|
||||||
Math::Vector pos;
|
|
||||||
char name[100];
|
|
||||||
|
|
||||||
if ( m_phase == AMP_WAIT ) return false;
|
if ( m_phase == AMP_WAIT ) return false;
|
||||||
|
|
||||||
sprintf(name, " aExist=%d", 1);
|
line->AddParam("aExist", new CLevelParserParam(true));
|
||||||
strcat(line, name);
|
|
||||||
|
|
||||||
CAuto::Write(line);
|
CAuto::Write(line);
|
||||||
|
line->AddParam("aPhase", new CLevelParserParam(static_cast<int>(m_phase)));
|
||||||
sprintf(name, " aPhase=%d", m_phase);
|
line->AddParam("aProgress", new CLevelParserParam(m_progress));
|
||||||
strcat(line, name);
|
line->AddParam("aSpeed", new CLevelParserParam(m_speed));
|
||||||
|
|
||||||
sprintf(name, " aProgress=%.2f", m_progress);
|
|
||||||
strcat(line, name);
|
|
||||||
|
|
||||||
sprintf(name, " aSpeed=%.2f", m_speed);
|
|
||||||
strcat(line, name);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -329,8 +321,6 @@ bool CAutoMush::Write(char *line)
|
||||||
|
|
||||||
bool CAutoMush::Read(char *line)
|
bool CAutoMush::Read(char *line)
|
||||||
{
|
{
|
||||||
Math::Vector pos;
|
|
||||||
|
|
||||||
if ( OpInt(line, "aExist", 0) == 0 ) return false;
|
if ( OpInt(line, "aExist", 0) == 0 ) return false;
|
||||||
|
|
||||||
CAuto::Read(line);
|
CAuto::Read(line);
|
||||||
|
|
|
@ -49,7 +49,7 @@ public:
|
||||||
bool EventProcess(const Event &event);
|
bool EventProcess(const Event &event);
|
||||||
Error GetError();
|
Error GetError();
|
||||||
|
|
||||||
bool Write(char *line);
|
bool Write(CLevelParserLine* line);
|
||||||
bool Read(char *line);
|
bool Read(char *line);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
|
@ -24,6 +24,9 @@
|
||||||
|
|
||||||
#include "graphics/engine/terrain.h"
|
#include "graphics/engine/terrain.h"
|
||||||
|
|
||||||
|
#include "object/level/parserline.h"
|
||||||
|
#include "object/level/parserparam.h"
|
||||||
|
|
||||||
#include "script/cmdtoken.h"
|
#include "script/cmdtoken.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -232,26 +235,15 @@ Error CAutoNest::GetError()
|
||||||
|
|
||||||
// Saves all parameters of the controller.
|
// Saves all parameters of the controller.
|
||||||
|
|
||||||
bool CAutoNest::Write(char *line)
|
bool CAutoNest::Write(CLevelParserLine* line)
|
||||||
{
|
{
|
||||||
Math::Vector pos;
|
|
||||||
char name[100];
|
|
||||||
|
|
||||||
if ( m_phase == ANP_WAIT ) return false;
|
if ( m_phase == ANP_WAIT ) return false;
|
||||||
|
|
||||||
sprintf(name, " aExist=%d", 1);
|
line->AddParam("aExist", new CLevelParserParam(true));
|
||||||
strcat(line, name);
|
|
||||||
|
|
||||||
CAuto::Write(line);
|
CAuto::Write(line);
|
||||||
|
line->AddParam("aPhase", new CLevelParserParam(static_cast<int>(m_phase)));
|
||||||
sprintf(name, " aPhase=%d", m_phase);
|
line->AddParam("aProgress", new CLevelParserParam(m_progress));
|
||||||
strcat(line, name);
|
line->AddParam("aSpeed", new CLevelParserParam(m_speed));
|
||||||
|
|
||||||
sprintf(name, " aProgress=%.2f", m_progress);
|
|
||||||
strcat(line, name);
|
|
||||||
|
|
||||||
sprintf(name, " aSpeed=%.2f", m_speed);
|
|
||||||
strcat(line, name);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -260,8 +252,6 @@ bool CAutoNest::Write(char *line)
|
||||||
|
|
||||||
bool CAutoNest::Read(char *line)
|
bool CAutoNest::Read(char *line)
|
||||||
{
|
{
|
||||||
Math::Vector pos;
|
|
||||||
|
|
||||||
if ( OpInt(line, "aExist", 0) == 0 ) return false;
|
if ( OpInt(line, "aExist", 0) == 0 ) return false;
|
||||||
|
|
||||||
CAuto::Read(line);
|
CAuto::Read(line);
|
||||||
|
|
|
@ -46,7 +46,7 @@ public:
|
||||||
bool EventProcess(const Event &event);
|
bool EventProcess(const Event &event);
|
||||||
Error GetError();
|
Error GetError();
|
||||||
|
|
||||||
bool Write(char *line);
|
bool Write(CLevelParserLine* line);
|
||||||
bool Read(char *line);
|
bool Read(char *line);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
|
@ -24,6 +24,9 @@
|
||||||
|
|
||||||
#include "math/geometry.h"
|
#include "math/geometry.h"
|
||||||
|
|
||||||
|
#include "object/level/parserline.h"
|
||||||
|
#include "object/level/parserparam.h"
|
||||||
|
|
||||||
#include "script/cmdtoken.h"
|
#include "script/cmdtoken.h"
|
||||||
|
|
||||||
#include "ui/interface.h"
|
#include "ui/interface.h"
|
||||||
|
@ -444,26 +447,16 @@ Error CAutoNuclear::GetError()
|
||||||
|
|
||||||
// Saves all parameters of the controller.
|
// Saves all parameters of the controller.
|
||||||
|
|
||||||
bool CAutoNuclear::Write(char *line)
|
bool CAutoNuclear::Write(CLevelParserLine* line)
|
||||||
{
|
{
|
||||||
char name[100];
|
|
||||||
|
|
||||||
if ( m_phase == ANUP_STOP ||
|
if ( m_phase == ANUP_STOP ||
|
||||||
m_phase == ANUP_WAIT ) return false;
|
m_phase == ANUP_WAIT ) return false;
|
||||||
|
|
||||||
sprintf(name, " aExist=%d", 1);
|
line->AddParam("aExist", new CLevelParserParam(true));
|
||||||
strcat(line, name);
|
|
||||||
|
|
||||||
CAuto::Write(line);
|
CAuto::Write(line);
|
||||||
|
line->AddParam("aPhase", new CLevelParserParam(static_cast<int>(m_phase)));
|
||||||
sprintf(name, " aPhase=%d", m_phase);
|
line->AddParam("aProgress", new CLevelParserParam(m_progress));
|
||||||
strcat(line, name);
|
line->AddParam("aSpeed", new CLevelParserParam(m_speed));
|
||||||
|
|
||||||
sprintf(name, " aProgress=%.2f", m_progress);
|
|
||||||
strcat(line, name);
|
|
||||||
|
|
||||||
sprintf(name, " aSpeed=%.2f", m_speed);
|
|
||||||
strcat(line, name);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,7 @@ public:
|
||||||
|
|
||||||
bool CreateInterface(bool bSelect);
|
bool CreateInterface(bool bSelect);
|
||||||
|
|
||||||
bool Write(char *line);
|
bool Write(CLevelParserLine* line);
|
||||||
bool Read(char *line);
|
bool Read(char *line);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
|
@ -25,6 +25,9 @@
|
||||||
|
|
||||||
#include "math/geometry.h"
|
#include "math/geometry.h"
|
||||||
|
|
||||||
|
#include "object/level/parserline.h"
|
||||||
|
#include "object/level/parserparam.h"
|
||||||
|
|
||||||
#include "script/cmdtoken.h"
|
#include "script/cmdtoken.h"
|
||||||
|
|
||||||
#include "ui/interface.h"
|
#include "ui/interface.h"
|
||||||
|
@ -289,25 +292,15 @@ void CAutoPara::ChargeObject(float rTime)
|
||||||
|
|
||||||
// Saves all parameters of the controller.
|
// Saves all parameters of the controller.
|
||||||
|
|
||||||
bool CAutoPara::Write(char *line)
|
bool CAutoPara::Write(CLevelParserLine* line)
|
||||||
{
|
{
|
||||||
char name[100];
|
|
||||||
|
|
||||||
if ( m_phase == APAP_WAIT ) return false;
|
if ( m_phase == APAP_WAIT ) return false;
|
||||||
|
|
||||||
sprintf(name, " aExist=%d", 1);
|
line->AddParam("aExist", new CLevelParserParam(true));
|
||||||
strcat(line, name);
|
|
||||||
|
|
||||||
CAuto::Write(line);
|
CAuto::Write(line);
|
||||||
|
line->AddParam("aPhase", new CLevelParserParam(static_cast<int>(m_phase)));
|
||||||
sprintf(name, " aPhase=%d", m_phase);
|
line->AddParam("aProgress", new CLevelParserParam(m_progress));
|
||||||
strcat(line, name);
|
line->AddParam("aSpeed", new CLevelParserParam(m_speed));
|
||||||
|
|
||||||
sprintf(name, " aProgress=%.2f", m_progress);
|
|
||||||
strcat(line, name);
|
|
||||||
|
|
||||||
sprintf(name, " aSpeed=%.2f", m_speed);
|
|
||||||
strcat(line, name);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,7 +50,7 @@ public:
|
||||||
|
|
||||||
bool CreateInterface(bool bSelect);
|
bool CreateInterface(bool bSelect);
|
||||||
|
|
||||||
bool Write(char *line);
|
bool Write(CLevelParserLine* line);
|
||||||
bool Read(char *line);
|
bool Read(char *line);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
|
@ -22,6 +22,9 @@
|
||||||
|
|
||||||
#include "common/iman.h"
|
#include "common/iman.h"
|
||||||
|
|
||||||
|
#include "object/level/parserline.h"
|
||||||
|
#include "object/level/parserparam.h"
|
||||||
|
|
||||||
#include "physics/physics.h"
|
#include "physics/physics.h"
|
||||||
|
|
||||||
#include "script/cmdtoken.h"
|
#include "script/cmdtoken.h"
|
||||||
|
@ -302,25 +305,15 @@ Error CAutoRepair::GetError()
|
||||||
|
|
||||||
// Saves all parameters of the controller.
|
// Saves all parameters of the controller.
|
||||||
|
|
||||||
bool CAutoRepair::Write(char *line)
|
bool CAutoRepair::Write(CLevelParserLine* line)
|
||||||
{
|
{
|
||||||
char name[100];
|
|
||||||
|
|
||||||
if ( m_phase == ARP_WAIT ) return false;
|
if ( m_phase == ARP_WAIT ) return false;
|
||||||
|
|
||||||
sprintf(name, " aExist=%d", 1);
|
line->AddParam("aExist", new CLevelParserParam(true));
|
||||||
strcat(line, name);
|
|
||||||
|
|
||||||
CAuto::Write(line);
|
CAuto::Write(line);
|
||||||
|
line->AddParam("aPhase", new CLevelParserParam(static_cast<int>(m_phase)));
|
||||||
sprintf(name, " aPhase=%d", m_phase);
|
line->AddParam("aProgress", new CLevelParserParam(m_progress));
|
||||||
strcat(line, name);
|
line->AddParam("aSpeed", new CLevelParserParam(m_speed));
|
||||||
|
|
||||||
sprintf(name, " aProgress=%.2f", m_progress);
|
|
||||||
strcat(line, name);
|
|
||||||
|
|
||||||
sprintf(name, " aSpeed=%.2f", m_speed);
|
|
||||||
strcat(line, name);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,7 @@ public:
|
||||||
|
|
||||||
bool CreateInterface(bool bSelect);
|
bool CreateInterface(bool bSelect);
|
||||||
|
|
||||||
bool Write(char *line);
|
bool Write(CLevelParserLine* line);
|
||||||
bool Read(char *line);
|
bool Read(char *line);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
|
@ -25,6 +25,8 @@
|
||||||
#include "math/geometry.h"
|
#include "math/geometry.h"
|
||||||
|
|
||||||
#include "object/robotmain.h"
|
#include "object/robotmain.h"
|
||||||
|
#include "object/level/parserline.h"
|
||||||
|
#include "object/level/parserparam.h"
|
||||||
|
|
||||||
#include "script/cmdtoken.h"
|
#include "script/cmdtoken.h"
|
||||||
|
|
||||||
|
@ -563,28 +565,16 @@ void CAutoResearch::FireStopUpdate(float progress, bool bLightOn)
|
||||||
|
|
||||||
// Saves all parameters of the controller.
|
// Saves all parameters of the controller.
|
||||||
|
|
||||||
bool CAutoResearch::Write(char *line)
|
bool CAutoResearch::Write(CLevelParserLine* line)
|
||||||
{
|
{
|
||||||
char name[100];
|
|
||||||
|
|
||||||
if ( m_phase == ALP_WAIT ) return false;
|
if ( m_phase == ALP_WAIT ) return false;
|
||||||
|
|
||||||
sprintf(name, " aExist=%d", 1);
|
line->AddParam("aExist", new CLevelParserParam(true));
|
||||||
strcat(line, name);
|
|
||||||
|
|
||||||
CAuto::Write(line);
|
CAuto::Write(line);
|
||||||
|
line->AddParam("aPhase", new CLevelParserParam(static_cast<int>(m_phase)));
|
||||||
sprintf(name, " aPhase=%d", m_phase);
|
line->AddParam("aProgress", new CLevelParserParam(m_progress));
|
||||||
strcat(line, name);
|
line->AddParam("aSpeed", new CLevelParserParam(m_speed));
|
||||||
|
line->AddParam("aResearch", new CLevelParserParam(static_cast<int>(m_research)));
|
||||||
sprintf(name, " aProgress=%.2f", m_progress);
|
|
||||||
strcat(line, name);
|
|
||||||
|
|
||||||
sprintf(name, " aSpeed=%.2f", m_speed);
|
|
||||||
strcat(line, name);
|
|
||||||
|
|
||||||
sprintf(name, " aResearch=%d", m_research);
|
|
||||||
strcat(line, name);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,7 @@ public:
|
||||||
|
|
||||||
bool CreateInterface(bool bSelect);
|
bool CreateInterface(bool bSelect);
|
||||||
|
|
||||||
bool Write(char *line);
|
bool Write(CLevelParserLine* line);
|
||||||
bool Read(char *line);
|
bool Read(char *line);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
|
@ -25,6 +25,8 @@
|
||||||
#include "math/geometry.h"
|
#include "math/geometry.h"
|
||||||
|
|
||||||
#include "object/robotmain.h"
|
#include "object/robotmain.h"
|
||||||
|
#include "object/level/parserline.h"
|
||||||
|
#include "object/level/parserparam.h"
|
||||||
|
|
||||||
#include "script/cmdtoken.h"
|
#include "script/cmdtoken.h"
|
||||||
|
|
||||||
|
@ -353,25 +355,15 @@ Error CAutoSafe::GetError()
|
||||||
|
|
||||||
// Saves all parameters of the controller.
|
// Saves all parameters of the controller.
|
||||||
|
|
||||||
bool CAutoSafe::Write(char *line)
|
bool CAutoSafe::Write(CLevelParserLine* line)
|
||||||
{
|
{
|
||||||
char name[100];
|
|
||||||
|
|
||||||
if ( m_phase == ASAP_WAIT ) return false;
|
if ( m_phase == ASAP_WAIT ) return false;
|
||||||
|
|
||||||
sprintf(name, " aExist=%d", 1);
|
line->AddParam("aExist", new CLevelParserParam(true));
|
||||||
strcat(line, name);
|
|
||||||
|
|
||||||
CAuto::Write(line);
|
CAuto::Write(line);
|
||||||
|
line->AddParam("aPhase", new CLevelParserParam(static_cast<int>(m_phase)));
|
||||||
sprintf(name, " aPhase=%d", m_phase);
|
line->AddParam("aProgress", new CLevelParserParam(m_progress));
|
||||||
strcat(line, name);
|
line->AddParam("aSpeed", new CLevelParserParam(m_speed));
|
||||||
|
|
||||||
sprintf(name, " aProgress=%.2f", m_progress);
|
|
||||||
strcat(line, name);
|
|
||||||
|
|
||||||
sprintf(name, " aSpeed=%.2f", m_speed);
|
|
||||||
strcat(line, name);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,7 @@ public:
|
||||||
|
|
||||||
bool CreateInterface(bool bSelect);
|
bool CreateInterface(bool bSelect);
|
||||||
|
|
||||||
bool Write(char *line);
|
bool Write(CLevelParserLine* line);
|
||||||
bool Read(char *line);
|
bool Read(char *line);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
|
@ -24,6 +24,9 @@
|
||||||
|
|
||||||
#include "math/geometry.h"
|
#include "math/geometry.h"
|
||||||
|
|
||||||
|
#include "object/level/parserline.h"
|
||||||
|
#include "object/level/parserparam.h"
|
||||||
|
|
||||||
#include "physics/physics.h"
|
#include "physics/physics.h"
|
||||||
|
|
||||||
#include "script/cmdtoken.h"
|
#include "script/cmdtoken.h"
|
||||||
|
@ -485,40 +488,20 @@ void CAutoTower::UpdateInterface(float rTime)
|
||||||
|
|
||||||
// Saves all parameters of the controller.
|
// Saves all parameters of the controller.
|
||||||
|
|
||||||
bool CAutoTower::Write(char *line)
|
bool CAutoTower::Write(CLevelParserLine* line)
|
||||||
{
|
{
|
||||||
char name[100];
|
|
||||||
|
|
||||||
if ( m_phase == ATP_WAIT ) return false;
|
if ( m_phase == ATP_WAIT ) return false;
|
||||||
|
|
||||||
sprintf(name, " aExist=%d", 1);
|
line->AddParam("aExist", new CLevelParserParam(true));
|
||||||
strcat(line, name);
|
|
||||||
|
|
||||||
CAuto::Write(line);
|
CAuto::Write(line);
|
||||||
|
line->AddParam("aPhase", new CLevelParserParam(static_cast<int>(m_phase)));
|
||||||
sprintf(name, " aPhase=%d", m_phase);
|
line->AddParam("aProgress", new CLevelParserParam(m_progress));
|
||||||
strcat(line, name);
|
line->AddParam("aSpeed", new CLevelParserParam(m_speed));
|
||||||
|
line->AddParam("aTargetPos", new CLevelParserParam(m_targetPos));
|
||||||
sprintf(name, " aProgress=%.2f", m_progress);
|
line->AddParam("aAngleYactual", new CLevelParserParam(m_angleYactual));
|
||||||
strcat(line, name);
|
line->AddParam("aAngleZactual", new CLevelParserParam(m_angleZactual));
|
||||||
|
line->AddParam("aAngleYfinal", new CLevelParserParam(m_angleYfinal));
|
||||||
sprintf(name, " aSpeed=%.2f", m_speed);
|
line->AddParam("aAngleZfinal", new CLevelParserParam(m_angleZfinal));
|
||||||
strcat(line, name);
|
|
||||||
|
|
||||||
sprintf(name, " aTargetPos=%.2f;%.2f;%.2f", m_targetPos.x, m_targetPos.y, m_targetPos.z);
|
|
||||||
strcat(line, name);
|
|
||||||
|
|
||||||
sprintf(name, " aAngleYactual=%.2f", m_angleYactual);
|
|
||||||
strcat(line, name);
|
|
||||||
|
|
||||||
sprintf(name, " aAngleZactual=%.2f", m_angleZactual);
|
|
||||||
strcat(line, name);
|
|
||||||
|
|
||||||
sprintf(name, " aAngleYfinal=%.2f", m_angleYfinal);
|
|
||||||
strcat(line, name);
|
|
||||||
|
|
||||||
sprintf(name, " aAngleZfinal=%.2f", m_angleZfinal);
|
|
||||||
strcat(line, name);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,7 @@ public:
|
||||||
|
|
||||||
bool CreateInterface(bool bSelect);
|
bool CreateInterface(bool bSelect);
|
||||||
|
|
||||||
bool Write(char *line);
|
bool Write(CLevelParserLine* line);
|
||||||
bool Read(char *line);
|
bool Read(char *line);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
|
@ -30,6 +30,8 @@
|
||||||
|
|
||||||
#include "object/motion/motion.h"
|
#include "object/motion/motion.h"
|
||||||
#include "object/task/taskmanager.h"
|
#include "object/task/taskmanager.h"
|
||||||
|
#include "object/level/parserline.h"
|
||||||
|
#include "object/level/parserparam.h"
|
||||||
|
|
||||||
#include "physics/physics.h"
|
#include "physics/physics.h"
|
||||||
|
|
||||||
|
@ -169,12 +171,9 @@ void CBrain::SetMotion(CMotion* motion)
|
||||||
|
|
||||||
// Saves all parameters of the object.
|
// Saves all parameters of the object.
|
||||||
|
|
||||||
bool CBrain::Write(char *line)
|
bool CBrain::Write(CLevelParserLine* line)
|
||||||
{
|
{
|
||||||
char name[100];
|
line->AddParam("bVirusActive", new CLevelParserParam(m_bActiveVirus));
|
||||||
|
|
||||||
sprintf(name, " bVirusActive=%d", m_bActiveVirus);
|
|
||||||
strcat(line, name);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,6 +41,7 @@ class CTaskManager;
|
||||||
class CScript;
|
class CScript;
|
||||||
class CRobotMain;
|
class CRobotMain;
|
||||||
class CSoundInterface;
|
class CSoundInterface;
|
||||||
|
class CLevelParserLine;
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class CStudio;
|
class CStudio;
|
||||||
|
@ -92,7 +93,7 @@ public:
|
||||||
bool EventProcess(const Event &event);
|
bool EventProcess(const Event &event);
|
||||||
bool CreateInterface(bool bSelect);
|
bool CreateInterface(bool bSelect);
|
||||||
|
|
||||||
bool Write(char *line);
|
bool Write(CLevelParserLine* line);
|
||||||
bool Read(char *line);
|
bool Read(char *line);
|
||||||
|
|
||||||
bool IsBusy();
|
bool IsBusy();
|
||||||
|
|
|
@ -236,7 +236,6 @@ void CLevelParser::Save()
|
||||||
}
|
}
|
||||||
|
|
||||||
file.close();
|
file.close();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string& CLevelParser::GetFilename()
|
const std::string& CLevelParser::GetFilename()
|
||||||
|
|
|
@ -65,7 +65,6 @@ public:
|
||||||
CLevelParserLine* Get(std::string command);
|
CLevelParserLine* Get(std::string command);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
std::string m_filename;
|
std::string m_filename;
|
||||||
std::vector<CLevelParserLine*> m_lines;
|
std::vector<CLevelParserLine*> m_lines;
|
||||||
};
|
};
|
|
@ -975,7 +975,7 @@ CLevelParserParam::CLevelParserParam(std::string value)
|
||||||
}
|
}
|
||||||
CLevelParserParam::CLevelParserParam(bool value)
|
CLevelParserParam::CLevelParserParam(bool value)
|
||||||
{
|
{
|
||||||
m_value = value ? "true" : "false";
|
m_value = value ? "1" : "0";
|
||||||
}
|
}
|
||||||
CLevelParserParam::CLevelParserParam(Gfx::Color value)
|
CLevelParserParam::CLevelParserParam(Gfx::Color value)
|
||||||
{
|
{
|
||||||
|
|
|
@ -23,6 +23,8 @@
|
||||||
#include "app/app.h"
|
#include "app/app.h"
|
||||||
|
|
||||||
#include "object/robotmain.h"
|
#include "object/robotmain.h"
|
||||||
|
#include "object/level/parserline.h"
|
||||||
|
#include "object/level/parserparam.h"
|
||||||
|
|
||||||
#include "script/cmdtoken.h"
|
#include "script/cmdtoken.h"
|
||||||
|
|
||||||
|
@ -171,20 +173,13 @@ float CMotion::GetParam(int rank)
|
||||||
|
|
||||||
// Saves all parameters of the object.
|
// Saves all parameters of the object.
|
||||||
|
|
||||||
bool CMotion::Write(char *line)
|
bool CMotion::Write(CLevelParserLine* line)
|
||||||
{
|
{
|
||||||
char name[100];
|
|
||||||
|
|
||||||
if ( m_actionType == -1 ) return false;
|
if ( m_actionType == -1 ) return false;
|
||||||
|
|
||||||
sprintf(name, " mType=%d", m_actionType);
|
line->AddParam("mType", new CLevelParserParam(m_actionType));
|
||||||
strcat(line, name);
|
line->AddParam("mTime", new CLevelParserParam(m_actionTime));
|
||||||
|
line->AddParam("mProgress", new CLevelParserParam(m_progress));
|
||||||
sprintf(name, " mTime=%.2f", m_actionTime);
|
|
||||||
strcat(line, name);
|
|
||||||
|
|
||||||
sprintf(name, " mProgress=%.2f", m_progress);
|
|
||||||
strcat(line, name);
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,6 +42,7 @@ class CPhysics;
|
||||||
class CObject;
|
class CObject;
|
||||||
class CRobotMain;
|
class CRobotMain;
|
||||||
class CSoundInterface;
|
class CSoundInterface;
|
||||||
|
class CLevelParserLine;
|
||||||
|
|
||||||
|
|
||||||
class CMotion
|
class CMotion
|
||||||
|
@ -62,7 +63,7 @@ public:
|
||||||
virtual bool SetParam(int rank, float value);
|
virtual bool SetParam(int rank, float value);
|
||||||
virtual float GetParam(int rank);
|
virtual float GetParam(int rank);
|
||||||
|
|
||||||
virtual bool Write(char *line);
|
virtual bool Write(CLevelParserLine* line);
|
||||||
virtual bool Read(char *line);
|
virtual bool Read(char *line);
|
||||||
|
|
||||||
virtual void SetLinVibration(Math::Vector dir);
|
virtual void SetLinVibration(Math::Vector dir);
|
||||||
|
|
|
@ -76,12 +76,16 @@
|
||||||
#include "object/motion/motionworm.h"
|
#include "object/motion/motionworm.h"
|
||||||
#include "object/robotmain.h"
|
#include "object/robotmain.h"
|
||||||
#include "object/objman.h"
|
#include "object/objman.h"
|
||||||
|
#include "object/level/parserline.h"
|
||||||
|
#include "object/level/parserparam.h"
|
||||||
|
|
||||||
#include "physics/physics.h"
|
#include "physics/physics.h"
|
||||||
|
|
||||||
#include "script/cbottoken.h"
|
#include "script/cbottoken.h"
|
||||||
#include "script/cmdtoken.h"
|
#include "script/cmdtoken.h"
|
||||||
|
|
||||||
|
#include <boost/lexical_cast.hpp>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define ADJUST_ONBOARD false // true -> adjusts the camera ONBOARD
|
#define ADJUST_ONBOARD false // true -> adjusts the camera ONBOARD
|
||||||
|
@ -995,137 +999,76 @@ int CObject::GetID()
|
||||||
|
|
||||||
// Saves all the parameters of the object.
|
// Saves all the parameters of the object.
|
||||||
|
|
||||||
bool CObject::Write(char *line)
|
bool CObject::Write(CLevelParserLine* line)
|
||||||
{
|
{
|
||||||
Math::Vector pos;
|
Math::Vector pos;
|
||||||
Info info;
|
Info info;
|
||||||
char name[100];
|
|
||||||
float value;
|
float value;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
sprintf(name, " camera=%s", GetCamera(GetCameraType()));
|
line->AddParam("camera", new CLevelParserParam(GetCameraType()));
|
||||||
strcat(line, name);
|
|
||||||
|
|
||||||
if ( GetCameraLock() != 0 )
|
if ( GetCameraLock() )
|
||||||
{
|
line->AddParam("cameraLock", new CLevelParserParam(GetCameraLock()));
|
||||||
sprintf(name, " cameraLock=%d", GetCameraLock());
|
|
||||||
strcat(line, name);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( GetEnergy() != 0.0f )
|
if ( GetEnergy() != 0.0f )
|
||||||
{
|
line->AddParam("energy", new CLevelParserParam(GetEnergy()));
|
||||||
sprintf(name, " energy=%.2f", GetEnergy());
|
|
||||||
strcat(line, name);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( GetCapacity() != 1.0f )
|
if ( GetCapacity() != 1.0f )
|
||||||
{
|
line->AddParam("capacity", new CLevelParserParam(GetCapacity()));
|
||||||
sprintf(name, " capacity=%.2f", GetCapacity());
|
|
||||||
strcat(line, name);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( GetShield() != 1.0f )
|
if ( GetShield() != 1.0f )
|
||||||
{
|
line->AddParam("shield", new CLevelParserParam(GetShield()));
|
||||||
sprintf(name, " shield=%.2f", GetShield());
|
|
||||||
strcat(line, name);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( GetRange() != 1.0f )
|
if ( GetRange() != 1.0f )
|
||||||
{
|
line->AddParam("range", new CLevelParserParam(GetRange()));
|
||||||
sprintf(name, " range=%.2f", GetRange());
|
|
||||||
strcat(line, name);
|
if ( !GetSelectable() )
|
||||||
}
|
line->AddParam("selectable", new CLevelParserParam(GetSelectable()));
|
||||||
|
|
||||||
if ( GetSelectable() != 1 )
|
if ( !GetEnable() )
|
||||||
{
|
line->AddParam("enable", new CLevelParserParam(GetEnable()));
|
||||||
sprintf(name, " selectable=%d", GetSelectable());
|
|
||||||
strcat(line, name);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( GetEnable() != 1 )
|
if ( GetFixed() )
|
||||||
{
|
line->AddParam("fixed", new CLevelParserParam(GetFixed()));
|
||||||
sprintf(name, " enable=%d", GetEnable());
|
|
||||||
strcat(line, name);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( GetFixed() != 0 )
|
if ( !GetClip() )
|
||||||
{
|
line->AddParam("clip", new CLevelParserParam(GetClip()));
|
||||||
sprintf(name, " fixed=%d", GetFixed());
|
|
||||||
strcat(line, name);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( GetClip() != 1 )
|
if ( GetLock() )
|
||||||
{
|
line->AddParam("lock", new CLevelParserParam(GetLock()));
|
||||||
sprintf(name, " clip=%d", GetClip());
|
|
||||||
strcat(line, name);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( GetLock() != 0 )
|
if ( GetProxyActivate() )
|
||||||
{
|
{
|
||||||
sprintf(name, " lock=%d", GetLock());
|
line->AddParam("proxyActivate", new CLevelParserParam(GetProxyActivate()));
|
||||||
strcat(line, name);
|
line->AddParam("proxyActivate", new CLevelParserParam(GetProxyDistance()/g_unit));
|
||||||
}
|
|
||||||
|
|
||||||
if ( GetProxyActivate() != 0 )
|
|
||||||
{
|
|
||||||
sprintf(name, " proxyActivate=%d", GetProxyActivate());
|
|
||||||
strcat(line, name);
|
|
||||||
|
|
||||||
sprintf(name, " proxyDistance=%.2f", GetProxyDistance()/g_unit);
|
|
||||||
strcat(line, name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( GetMagnifyDamage() != 1.0f )
|
if ( GetMagnifyDamage() != 1.0f )
|
||||||
{
|
line->AddParam("magnifyDamage", new CLevelParserParam(GetMagnifyDamage()));
|
||||||
sprintf(name, " magnifyDamage=%.2f", GetMagnifyDamage());
|
|
||||||
strcat(line, name);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( GetGunGoalV() != 0.0f )
|
if ( GetGunGoalV() != 0.0f )
|
||||||
{
|
line->AddParam("aimV", new CLevelParserParam(GetGunGoalV()));
|
||||||
sprintf(name, " aimV=%.2f", GetGunGoalV());
|
|
||||||
strcat(line, name);
|
|
||||||
}
|
|
||||||
if ( GetGunGoalH() != 0.0f )
|
if ( GetGunGoalH() != 0.0f )
|
||||||
{
|
line->AddParam("aimH", new CLevelParserParam(GetGunGoalH()));
|
||||||
sprintf(name, " aimH=%.2f", GetGunGoalH());
|
|
||||||
strcat(line, name);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( GetParam() != 0.0f )
|
if ( GetParam() != 0.0f )
|
||||||
{
|
line->AddParam("param", new CLevelParserParam(GetParam()));
|
||||||
sprintf(name, " param=%.2f", GetParam());
|
|
||||||
strcat(line, name);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( GetResetCap() != 0 )
|
if ( GetResetCap() != 0 )
|
||||||
{
|
{
|
||||||
sprintf(name, " resetCap=%d", GetResetCap());
|
line->AddParam("resetCap", new CLevelParserParam(static_cast<int>(GetResetCap())));
|
||||||
strcat(line, name);
|
line->AddParam("resetPos", new CLevelParserParam(GetResetPosition()/g_unit));
|
||||||
|
line->AddParam("resetAngle", new CLevelParserParam(GetResetAngle()/(Math::PI/180.0f)));
|
||||||
pos = GetResetPosition()/g_unit;
|
line->AddParam("resetRun", new CLevelParserParam(GetResetRun()));
|
||||||
sprintf(name, " resetPos=%.2f;%.2f;%.2f", pos.x, pos.y, pos.z);
|
|
||||||
strcat(line, name);
|
|
||||||
|
|
||||||
pos = GetResetAngle()/(Math::PI/180.0f);
|
|
||||||
sprintf(name, " resetAngle=%.2f;%.2f;%.2f", pos.x, pos.y, pos.z);
|
|
||||||
strcat(line, name);
|
|
||||||
|
|
||||||
sprintf(name, " resetRun=%d", GetResetRun());
|
|
||||||
strcat(line, name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( m_bVirusMode != 0 )
|
if ( m_bVirusMode )
|
||||||
{
|
line->AddParam("virusMode", new CLevelParserParam(m_bVirusMode));
|
||||||
sprintf(name, " virusMode=%d", m_bVirusMode);
|
|
||||||
strcat(line, name);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( m_virusTime != 0.0f )
|
if ( m_virusTime != 0.0f )
|
||||||
{
|
line->AddParam("virusTime", new CLevelParserParam(m_virusTime));
|
||||||
sprintf(name, " virusTime=%.2f", m_virusTime);
|
|
||||||
strcat(line, name);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Puts information in terminal (OBJECT_INFO).
|
// Puts information in terminal (OBJECT_INFO).
|
||||||
for ( i=0 ; i<m_infoTotal ; i++ )
|
for ( i=0 ; i<m_infoTotal ; i++ )
|
||||||
|
@ -1133,20 +1076,20 @@ bool CObject::Write(char *line)
|
||||||
info = GetInfo(i);
|
info = GetInfo(i);
|
||||||
if ( info.name[0] == 0 ) break;
|
if ( info.name[0] == 0 ) break;
|
||||||
|
|
||||||
sprintf(name, " info%d=\"%s=%.2f\"", i+1, info.name, info.value);
|
line->AddParam("info"+boost::lexical_cast<std::string>(i+1), new CLevelParserParam(std::string(info.name)+"="+boost::lexical_cast<std::string>(info.value)));
|
||||||
strcat(line, name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sets the parameters of the command line.
|
// Sets the parameters of the command line.
|
||||||
|
std::vector<CLevelParserParam*> cmdline;
|
||||||
for ( i=0 ; i<OBJECTMAXCMDLINE ; i++ )
|
for ( i=0 ; i<OBJECTMAXCMDLINE ; i++ )
|
||||||
{
|
{
|
||||||
value = GetCmdLine(i);
|
value = GetCmdLine(i);
|
||||||
if ( value == NAN ) break;
|
if ( value == NAN ) break;
|
||||||
|
|
||||||
if ( i == 0 ) sprintf(name, " cmdline=%.2f", value);
|
cmdline.push_back(new CLevelParserParam(value));
|
||||||
else sprintf(name, ";%.2f", value);
|
|
||||||
strcat(line, name);
|
|
||||||
}
|
}
|
||||||
|
if(cmdline.size() > 0)
|
||||||
|
line->AddParam("cmdline", new CLevelParserParam(cmdline));
|
||||||
|
|
||||||
if ( m_motion != 0 )
|
if ( m_motion != 0 )
|
||||||
{
|
{
|
||||||
|
|
|
@ -40,6 +40,7 @@ class CDisplayText;
|
||||||
class CRobotMain;
|
class CRobotMain;
|
||||||
class CBotVar;
|
class CBotVar;
|
||||||
class CScript;
|
class CScript;
|
||||||
|
class CLevelParserLine;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -379,7 +380,7 @@ public:
|
||||||
void SetID(int id);
|
void SetID(int id);
|
||||||
int GetID();
|
int GetID();
|
||||||
|
|
||||||
bool Write(char *line);
|
bool Write(CLevelParserLine* line);
|
||||||
bool Read(char *line);
|
bool Read(char *line);
|
||||||
|
|
||||||
void SetDrawWorld(bool bDraw);
|
void SetDrawWorld(bool bDraw);
|
||||||
|
|
|
@ -3781,8 +3781,6 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject)
|
||||||
int rankGadget = 0;
|
int rankGadget = 0;
|
||||||
CObject* sel = 0;
|
CObject* sel = 0;
|
||||||
|
|
||||||
SetNumericLocale();
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* NOTE: Moving frequently used lines to the top
|
* NOTE: Moving frequently used lines to the top
|
||||||
* may speed up loading
|
* may speed up loading
|
||||||
|
@ -4774,8 +4772,6 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject)
|
||||||
}
|
}
|
||||||
m_dialog->SetSceneRead("");
|
m_dialog->SetSceneRead("");
|
||||||
m_dialog->SetStackRead("");
|
m_dialog->SetStackRead("");
|
||||||
|
|
||||||
RestoreNumericLocale();
|
|
||||||
|
|
||||||
if(m_app->GetSceneTestMode())
|
if(m_app->GetSceneTestMode())
|
||||||
m_eventQueue->AddEvent(Event(EVENT_WIN));
|
m_eventQueue->AddEvent(Event(EVENT_WIN));
|
||||||
|
@ -5665,37 +5661,17 @@ bool CRobotMain::IsBusy()
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Writes an object into the backup file
|
//! Writes an object into the backup file
|
||||||
void CRobotMain::IOWriteObject(FILE *file, CObject* obj, const char *cmd)
|
void CRobotMain::IOWriteObject(CLevelParserLine* line, CObject* obj)
|
||||||
{
|
{
|
||||||
if (obj->GetType() == OBJECT_FIX) return;
|
if (obj->GetType() == OBJECT_FIX) return;
|
||||||
|
|
||||||
SetNumericLocale();
|
line->AddParam("type", new CLevelParserParam(obj->GetType()));
|
||||||
|
line->AddParam("id", new CLevelParserParam(obj->GetID()));
|
||||||
char line[3000];
|
line->AddParam("pos", new CLevelParserParam(obj->GetPosition(0)/g_unit));
|
||||||
char name[100];
|
line->AddParam("angle", new CLevelParserParam(obj->GetAngle(0)/(Math::PI/180.0f)));
|
||||||
|
line->AddParam("zoom", new CLevelParserParam(obj->GetZoom(0)));
|
||||||
strcpy(line, cmd);
|
|
||||||
|
|
||||||
sprintf(name, " type=%s", GetTypeObject(obj->GetType()));
|
|
||||||
strcat(line, name);
|
|
||||||
|
|
||||||
sprintf(name, " id=%d", obj->GetID());
|
|
||||||
strcat(line, name);
|
|
||||||
|
|
||||||
Math::Vector pos;
|
Math::Vector pos;
|
||||||
|
|
||||||
pos = obj->GetPosition(0)/g_unit;
|
|
||||||
sprintf(name, " pos=%.2f;%.2f;%.2f", pos.x, pos.y, pos.z);
|
|
||||||
strcat(line, name);
|
|
||||||
|
|
||||||
pos = obj->GetAngle(0)/(Math::PI/180.0f);
|
|
||||||
sprintf(name, " angle=%.2f;%.2f;%.2f", pos.x, pos.y, pos.z);
|
|
||||||
strcat(line, name);
|
|
||||||
|
|
||||||
pos = obj->GetZoom(0);
|
|
||||||
sprintf(name, " zoom=%.2f;%.2f;%.2f", pos.x, pos.y, pos.z);
|
|
||||||
strcat(line, name);
|
|
||||||
|
|
||||||
for (int i = 1; i < OBJECTMAXPART; i++)
|
for (int i = 1; i < OBJECTMAXPART; i++)
|
||||||
{
|
{
|
||||||
if (obj->GetObjectRank(i) == -1) continue;
|
if (obj->GetObjectRank(i) == -1) continue;
|
||||||
|
@ -5704,64 +5680,43 @@ void CRobotMain::IOWriteObject(FILE *file, CObject* obj, const char *cmd)
|
||||||
if (pos.x != 0.0f || pos.y != 0.0f || pos.z != 0.0f)
|
if (pos.x != 0.0f || pos.y != 0.0f || pos.z != 0.0f)
|
||||||
{
|
{
|
||||||
pos /= g_unit;
|
pos /= g_unit;
|
||||||
sprintf(name, " p%d=%.2f;%.2f;%.2f", i, pos.x, pos.y, pos.z);
|
line->AddParam("p"+boost::lexical_cast<std::string>(i), new CLevelParserParam(pos));
|
||||||
strcat(line, name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pos = obj->GetAngle(i);
|
pos = obj->GetAngle(i);
|
||||||
if (pos.x != 0.0f || pos.y != 0.0f || pos.z != 0.0f)
|
if (pos.x != 0.0f || pos.y != 0.0f || pos.z != 0.0f)
|
||||||
{
|
{
|
||||||
pos /= (Math::PI/180.0f);
|
pos /= (Math::PI/180.0f);
|
||||||
sprintf(name, " a%d=%.2f;%.2f;%.2f", i, pos.x, pos.y, pos.z);
|
line->AddParam("a"+boost::lexical_cast<std::string>(i), new CLevelParserParam(pos));
|
||||||
strcat(line, name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pos = obj->GetZoom(i);
|
pos = obj->GetZoom(i);
|
||||||
if (pos.x != 1.0f || pos.y != 1.0f || pos.z != 1.0f)
|
if (pos.x != 1.0f || pos.y != 1.0f || pos.z != 1.0f)
|
||||||
{
|
{
|
||||||
sprintf(name, " z%d=%.2f;%.2f;%.2f", i, pos.x, pos.y, pos.z);
|
line->AddParam("z"+boost::lexical_cast<std::string>(i), new CLevelParserParam(pos));
|
||||||
strcat(line, name);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sprintf(name, " trainer=%d", obj->GetTrainer());
|
line->AddParam("trainer", new CLevelParserParam(obj->GetTrainer()));
|
||||||
strcat(line, name);
|
line->AddParam("ignoreBuildCheck", new CLevelParserParam(obj->GetIgnoreBuildCheck()));
|
||||||
|
line->AddParam("option", new CLevelParserParam(obj->GetOption()));
|
||||||
|
if (obj == m_infoObject)
|
||||||
|
line->AddParam("select", new CLevelParserParam(1));
|
||||||
|
|
||||||
sprintf(name, " ignoreBuildCheck=%d", obj->GetIgnoreBuildCheck());
|
|
||||||
strcat(line, name);
|
|
||||||
|
|
||||||
sprintf(name, " option=%d", obj->GetOption());
|
|
||||||
strcat(line, name);
|
|
||||||
|
|
||||||
if (obj == m_infoObject) // selects object?
|
|
||||||
{
|
|
||||||
sprintf(name, " select=1");
|
|
||||||
strcat(line, name);
|
|
||||||
}
|
|
||||||
|
|
||||||
obj->Write(line);
|
obj->Write(line);
|
||||||
|
|
||||||
if (obj->GetType() == OBJECT_BASE)
|
if(obj->GetType() == OBJECT_BASE)
|
||||||
{
|
line->AddParam("run", new CLevelParserParam(3)); // stops and open (PARAM_FIXSCENE)
|
||||||
sprintf(name, " run=3"); // stops and open (PARAM_FIXSCENE)
|
|
||||||
strcat(line, name);
|
|
||||||
}
|
|
||||||
|
|
||||||
CBrain* brain = obj->GetBrain();
|
CBrain* brain = obj->GetBrain();
|
||||||
if (brain != nullptr)
|
if (brain != nullptr)
|
||||||
{
|
{
|
||||||
int run = brain->GetProgram();
|
int run = brain->GetProgram();
|
||||||
if (run != -1)
|
if (run != -1)
|
||||||
{
|
{
|
||||||
sprintf(name, " run=%d", run+1);
|
line->AddParam("run", new CLevelParserParam(run+1));
|
||||||
strcat(line, name);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
strcat(line, "\n");
|
|
||||||
fputs(line, file);
|
|
||||||
|
|
||||||
RestoreNumericLocale();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Saves the current game
|
//! Saves the current game
|
||||||
|
@ -5773,53 +5728,46 @@ bool CRobotMain::IOWriteScene(const char *filename, const char *filecbot, char *
|
||||||
boost::replace_all(savedir, "\\", "/");
|
boost::replace_all(savedir, "\\", "/");
|
||||||
boost::replace_all(fnstr, savedir, ""); //TODO: Refactor to get physfs path here
|
boost::replace_all(fnstr, savedir, ""); //TODO: Refactor to get physfs path here
|
||||||
|
|
||||||
/*CLevelParser* level = new CLevelParser(fnstr);
|
CLevelParser* level = new CLevelParser(fnstr);
|
||||||
CLevelParserLine* line1 = new CLevelParserLine("TestCommand");
|
CLevelParserLine* line;
|
||||||
line1->AddParam("test", new CLevelParserParam(1.0f));
|
|
||||||
level->AddLine(line1);
|
line = new CLevelParserLine("Title");
|
||||||
CLevelParserLine* line2 = new CLevelParserLine("TestCommand2");
|
line->AddParam("text", new CLevelParserParam(std::string(info)));
|
||||||
line2->AddParam("testStr", new CLevelParserParam("12345"));
|
level->AddLine(line);
|
||||||
line2->AddParam("testBool", new CLevelParserParam(true));
|
|
||||||
level->AddLine(line2);
|
|
||||||
level->Save();
|
|
||||||
delete level;
|
|
||||||
return true;*/
|
|
||||||
|
|
||||||
FILE* file = fopen(filename, "w");
|
//TODO: Do we need that? It's not used anyway
|
||||||
if (file == NULL) return false;
|
line = new CLevelParserLine("Version");
|
||||||
|
line->AddParam("maj", new CLevelParserParam(0));
|
||||||
SetNumericLocale();
|
line->AddParam("min", new CLevelParserParam(1));
|
||||||
|
level->AddLine(line);
|
||||||
char line[500];
|
|
||||||
|
|
||||||
sprintf(line, "Title text=\"%s\"\n", info);
|
|
||||||
fputs(line, file);
|
|
||||||
|
|
||||||
sprintf(line, "Version maj=%d min=%d\n", 0, 1);
|
|
||||||
fputs(line, file);
|
|
||||||
|
|
||||||
char* name = m_dialog->GetSceneName();
|
char* name = m_dialog->GetSceneName();
|
||||||
if (strcmp(name, "user") == 0)
|
line = new CLevelParserLine("Mission");
|
||||||
|
line->AddParam("base", new CLevelParserParam(std::string(name)));
|
||||||
|
line->AddParam("rank", new CLevelParserParam(m_dialog->GetSceneRank()));
|
||||||
|
if (std::string(name) == "custom")
|
||||||
{
|
{
|
||||||
sprintf(line, "Mission base=\"%s\" rank=%.3d dir=\"%s\"\n", name, m_dialog->GetSceneRank(), m_dialog->GetSceneDir());
|
line->AddParam("dir", new CLevelParserParam(std::string(m_dialog->GetSceneDir())));
|
||||||
}
|
}
|
||||||
else
|
level->AddLine(line);
|
||||||
{
|
|
||||||
sprintf(line, "Mission base=\"%s\" rank=%.3d\n", name, m_dialog->GetSceneRank());
|
|
||||||
}
|
|
||||||
fputs(line, file);
|
|
||||||
|
|
||||||
sprintf(line, "Map zoom=%.2f\n", m_map->GetZoomMap());
|
line = new CLevelParserLine("Map");
|
||||||
fputs(line, file);
|
line->AddParam("zoom", new CLevelParserParam(m_map->GetZoomMap()));
|
||||||
|
level->AddLine(line);
|
||||||
|
|
||||||
sprintf(line, "DoneResearch bits=%d\n", static_cast<int>(g_researchDone));
|
line = new CLevelParserLine("DoneResearch");
|
||||||
fputs(line, file);
|
line->AddParam("bits", new CLevelParserParam(static_cast<int>(g_researchDone)));
|
||||||
|
level->AddLine(line);
|
||||||
|
|
||||||
float sleep, delay, magnetic, progress;
|
float sleep, delay, magnetic, progress;
|
||||||
if (m_lightning->GetStatus(sleep, delay, magnetic, progress))
|
if (m_lightning->GetStatus(sleep, delay, magnetic, progress))
|
||||||
{
|
{
|
||||||
sprintf(line, "BlitzMode sleep=%.2f delay=%.2f magnetic=%.2f progress=%.2f\n", sleep, delay, magnetic/g_unit, progress);
|
line = new CLevelParserLine("BlitzMode");
|
||||||
fputs(line, file);
|
line->AddParam("sleep", new CLevelParserParam(sleep));
|
||||||
|
line->AddParam("delay", new CLevelParserParam(delay));
|
||||||
|
line->AddParam("magnetic", new CLevelParserParam(magnetic/g_unit));
|
||||||
|
line->AddParam("progress", new CLevelParserParam(progress));
|
||||||
|
level->AddLine(line);
|
||||||
}
|
}
|
||||||
|
|
||||||
CInstanceManager* iMan = CInstanceManager::GetInstancePointer();
|
CInstanceManager* iMan = CInstanceManager::GetInstancePointer();
|
||||||
|
@ -5840,23 +5788,36 @@ bool CRobotMain::IOWriteScene(const char *filename, const char *filecbot, char *
|
||||||
CObject* power = obj->GetPower();
|
CObject* power = obj->GetPower();
|
||||||
CObject* fret = obj->GetFret();
|
CObject* fret = obj->GetFret();
|
||||||
|
|
||||||
if (fret != nullptr) // object transported?
|
if (fret != nullptr){ // object transported?
|
||||||
IOWriteObject(file, fret, "CreateFret");
|
line = new CLevelParserLine("CreateFret");
|
||||||
|
IOWriteObject(line, fret);
|
||||||
|
level->AddLine(line);
|
||||||
|
}
|
||||||
|
|
||||||
if (power != nullptr) // battery transported?
|
if (power != nullptr) { // battery transported?
|
||||||
IOWriteObject(file, power, "CreatePower");
|
line = new CLevelParserLine("CreatePower");
|
||||||
|
IOWriteObject(line, power);
|
||||||
IOWriteObject(file, obj, "CreateObject");
|
level->AddLine(line);
|
||||||
|
}
|
||||||
|
|
||||||
|
line = new CLevelParserLine("CreateObject");
|
||||||
|
IOWriteObject(line, obj);
|
||||||
|
level->AddLine(line);
|
||||||
|
|
||||||
SaveFileScript(obj, filename, objRank++);
|
SaveFileScript(obj, filename, objRank++);
|
||||||
}
|
}
|
||||||
fclose(file);
|
try {
|
||||||
|
level->Save();
|
||||||
RestoreNumericLocale();
|
} catch(CLevelParserException& e) {
|
||||||
|
CLogger::GetInstancePointer()->Error("Failed to save level state - %s\n", e.what());
|
||||||
|
delete level;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
delete level;
|
||||||
|
|
||||||
#if CBOT_STACK
|
#if CBOT_STACK
|
||||||
// Writes the file of stacks of execution.
|
// Writes the file of stacks of execution.
|
||||||
file = fOpen(filecbot, "wb");
|
FILE* file = fOpen(filecbot, "wb");
|
||||||
if (file == NULL) return false;
|
if (file == NULL) return false;
|
||||||
|
|
||||||
long version = 1;
|
long version = 1;
|
||||||
|
@ -5898,8 +5859,6 @@ CObject* CRobotMain::IOReadObject(char *line, const char* filename, int objRank)
|
||||||
if (type == OBJECT_NULL)
|
if (type == OBJECT_NULL)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
SetNumericLocale();
|
|
||||||
|
|
||||||
int trainer = OpInt(line, "trainer", 0);
|
int trainer = OpInt(line, "trainer", 0);
|
||||||
int toy = OpInt(line, "toy", 0);
|
int toy = OpInt(line, "toy", 0);
|
||||||
int option = OpInt(line, "option", 0);
|
int option = OpInt(line, "option", 0);
|
||||||
|
@ -5966,8 +5925,6 @@ CObject* CRobotMain::IOReadObject(char *line, const char* filename, int objRank)
|
||||||
automat->Start(run); // starts the film
|
automat->Start(run); // starts the film
|
||||||
}
|
}
|
||||||
|
|
||||||
RestoreNumericLocale();
|
|
||||||
|
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5979,8 +5936,6 @@ CObject* CRobotMain::IOReadScene(const char *filename, const char *filecbot)
|
||||||
FILE* file = fopen(filename, "r");
|
FILE* file = fopen(filename, "r");
|
||||||
if (file == NULL) return 0;
|
if (file == NULL) return 0;
|
||||||
|
|
||||||
SetNumericLocale();
|
|
||||||
|
|
||||||
CObject* fret = nullptr;
|
CObject* fret = nullptr;
|
||||||
CObject* power = nullptr;
|
CObject* power = nullptr;
|
||||||
CObject* sel = nullptr;
|
CObject* sel = nullptr;
|
||||||
|
@ -6102,8 +6057,6 @@ CObject* CRobotMain::IOReadScene(const char *filename, const char *filecbot)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
RestoreNumericLocale();
|
|
||||||
|
|
||||||
return sel;
|
return sel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7004,20 +6957,6 @@ void CRobotMain::ClearInterface()
|
||||||
m_tooltipName.clear(); // really removes the tooltip
|
m_tooltipName.clear(); // really removes the tooltip
|
||||||
}
|
}
|
||||||
|
|
||||||
void CRobotMain::SetNumericLocale()
|
|
||||||
{
|
|
||||||
char *locale = setlocale(LC_NUMERIC, nullptr);
|
|
||||||
if (locale != nullptr)
|
|
||||||
m_oldLocale = locale;
|
|
||||||
|
|
||||||
setlocale(LC_NUMERIC, "C");
|
|
||||||
}
|
|
||||||
|
|
||||||
void CRobotMain::RestoreNumericLocale()
|
|
||||||
{
|
|
||||||
setlocale(LC_NUMERIC, m_oldLocale.c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
void CRobotMain::DisplayError(Error err, CObject* pObj, float time)
|
void CRobotMain::DisplayError(Error err, CObject* pObj, float time)
|
||||||
{
|
{
|
||||||
m_displayText->DisplayError(err, pObj, time);
|
m_displayText->DisplayError(err, pObj, time);
|
||||||
|
|
|
@ -76,6 +76,7 @@ enum Phase
|
||||||
|
|
||||||
class CEventQueue;
|
class CEventQueue;
|
||||||
class CSoundInterface;
|
class CSoundInterface;
|
||||||
|
class CLevelParserLine;
|
||||||
|
|
||||||
namespace Gfx {
|
namespace Gfx {
|
||||||
class CEngine;
|
class CEngine;
|
||||||
|
@ -383,14 +384,11 @@ public:
|
||||||
bool IsBusy();
|
bool IsBusy();
|
||||||
bool IOWriteScene(const char *filename, const char *filecbot, char *info);
|
bool IOWriteScene(const char *filename, const char *filecbot, char *info);
|
||||||
CObject* IOReadScene(const char *filename, const char *filecbot);
|
CObject* IOReadScene(const char *filename, const char *filecbot);
|
||||||
void IOWriteObject(FILE *file, CObject* pObj, const char *cmd);
|
void IOWriteObject(CLevelParserLine *file, CObject* pObj);
|
||||||
CObject* IOReadObject(char *line, const char* filename, int objRank);
|
CObject* IOReadObject(char *line, const char* filename, int objRank);
|
||||||
|
|
||||||
int CreateSpot(Math::Vector pos, Gfx::Color color);
|
int CreateSpot(Math::Vector pos, Gfx::Color color);
|
||||||
|
|
||||||
void SetNumericLocale();
|
|
||||||
void RestoreNumericLocale();
|
|
||||||
|
|
||||||
CObject* GetSelect();
|
CObject* GetSelect();
|
||||||
|
|
||||||
void DisplayError(Error err, CObject* pObj, float time=10.0f);
|
void DisplayError(Error err, CObject* pObj, float time=10.0f);
|
||||||
|
@ -588,8 +586,6 @@ protected:
|
||||||
Gfx::Color m_colorRefWater;
|
Gfx::Color m_colorRefWater;
|
||||||
Gfx::Color m_colorNewWater;
|
Gfx::Color m_colorNewWater;
|
||||||
float m_colorShiftWater;
|
float m_colorShiftWater;
|
||||||
|
|
||||||
std::string m_oldLocale;
|
|
||||||
|
|
||||||
bool m_missionTimerEnabled;
|
bool m_missionTimerEnabled;
|
||||||
bool m_missionTimerStarted;
|
bool m_missionTimerStarted;
|
||||||
|
|
|
@ -40,6 +40,8 @@
|
||||||
#include "object/motion/motion.h"
|
#include "object/motion/motion.h"
|
||||||
#include "object/motion/motionhuman.h"
|
#include "object/motion/motionhuman.h"
|
||||||
#include "object/task/task.h"
|
#include "object/task/task.h"
|
||||||
|
#include "object/level/parserline.h"
|
||||||
|
#include "object/level/parserparam.h"
|
||||||
|
|
||||||
#include "script/cmdtoken.h"
|
#include "script/cmdtoken.h"
|
||||||
|
|
||||||
|
@ -171,20 +173,14 @@ PhysicsType CPhysics::GetType()
|
||||||
|
|
||||||
// Saves all parameters of the object.
|
// Saves all parameters of the object.
|
||||||
|
|
||||||
bool CPhysics::Write(char *line)
|
bool CPhysics::Write(CLevelParserLine* line)
|
||||||
{
|
{
|
||||||
char name[100];
|
line->AddParam("motor", new CLevelParserParam(m_motorSpeed));
|
||||||
|
|
||||||
sprintf(name, " motor=%.2f;%.2f;%.2f", m_motorSpeed.x, m_motorSpeed.y, m_motorSpeed.z);
|
|
||||||
strcat(line, name);
|
|
||||||
|
|
||||||
if ( m_type == TYPE_FLYING )
|
if ( m_type == TYPE_FLYING )
|
||||||
{
|
{
|
||||||
sprintf(name, " reactorRange=%.2f", GetReactorRange());
|
line->AddParam("reactorRange", new CLevelParserParam(GetReactorRange()));
|
||||||
strcat(line, name);
|
line->AddParam("land", new CLevelParserParam(GetLand()));
|
||||||
|
|
||||||
sprintf(name, " land=%d", GetLand());
|
|
||||||
strcat(line, name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -36,6 +36,7 @@ class CObject;
|
||||||
class CBrain;
|
class CBrain;
|
||||||
class CMotion;
|
class CMotion;
|
||||||
class CSoundInterface;
|
class CSoundInterface;
|
||||||
|
class CLevelParserLine;
|
||||||
|
|
||||||
namespace Gfx {
|
namespace Gfx {
|
||||||
class CCamera;
|
class CCamera;
|
||||||
|
@ -110,7 +111,7 @@ public:
|
||||||
void SetType(PhysicsType type);
|
void SetType(PhysicsType type);
|
||||||
PhysicsType GetType();
|
PhysicsType GetType();
|
||||||
|
|
||||||
bool Write(char *line);
|
bool Write(CLevelParserLine* line);
|
||||||
bool Read(char *line);
|
bool Read(char *line);
|
||||||
|
|
||||||
void SetGravity(float value);
|
void SetGravity(float value);
|
||||||
|
|
|
@ -6070,8 +6070,6 @@ void CMainDialog::WriteGamerPerso(char *gamer)
|
||||||
file = fopen(filename, "w");
|
file = fopen(filename, "w");
|
||||||
if ( file == NULL ) return;
|
if ( file == NULL ) return;
|
||||||
|
|
||||||
m_main->SetNumericLocale();
|
|
||||||
|
|
||||||
sprintf(line, "Head face=%d glasses=%d hair=%.2f;%.2f;%.2f;%.2f\n",
|
sprintf(line, "Head face=%d glasses=%d hair=%.2f;%.2f;%.2f;%.2f\n",
|
||||||
m_perso.face, m_perso.glasses,
|
m_perso.face, m_perso.glasses,
|
||||||
m_perso.colorHair.r, m_perso.colorHair.g, m_perso.colorHair.b, m_perso.colorHair.a);
|
m_perso.colorHair.r, m_perso.colorHair.g, m_perso.colorHair.b, m_perso.colorHair.a);
|
||||||
|
@ -6083,8 +6081,6 @@ void CMainDialog::WriteGamerPerso(char *gamer)
|
||||||
fputs(line, file);
|
fputs(line, file);
|
||||||
|
|
||||||
fclose(file);
|
fclose(file);
|
||||||
|
|
||||||
m_main->RestoreNumericLocale();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reads the personalized player.
|
// Reads the personalized player.
|
||||||
|
@ -6103,8 +6099,6 @@ void CMainDialog::ReadGamerPerso(char *gamer)
|
||||||
file = fopen(filename, "r");
|
file = fopen(filename, "r");
|
||||||
if ( file == NULL ) return;
|
if ( file == NULL ) return;
|
||||||
|
|
||||||
m_main->SetNumericLocale();
|
|
||||||
|
|
||||||
while ( fgets(line, 100, file) != NULL )
|
while ( fgets(line, 100, file) != NULL )
|
||||||
{
|
{
|
||||||
if ( Cmd(line, "Head") )
|
if ( Cmd(line, "Head") )
|
||||||
|
@ -6136,8 +6130,6 @@ void CMainDialog::ReadGamerPerso(char *gamer)
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose(file);
|
fclose(file);
|
||||||
|
|
||||||
m_main->RestoreNumericLocale();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Specifies the face of the player.
|
// Specifies the face of the player.
|
||||||
|
|
Loading…
Reference in New Issue