Merge pull request #125 from PaweX/dev

dev-ui
krzys-h 2013-02-13 11:26:17 -08:00
commit 59a40088a5
5 changed files with 28 additions and 8 deletions

View File

@ -328,8 +328,8 @@ void CCamera::SetType(CameraType type)
if ( oType == OBJECT_HUSTON ) m_backMin = 80.0f; if ( oType == OBJECT_HUSTON ) m_backMin = 80.0f;
} }
if ( type != CAM_TYPE_ONBOARD && m_cameraObj != 0 ) //if ( type != CAM_TYPE_ONBOARD && m_cameraObj != 0 )
m_cameraObj->SetGunGoalH(0.0f); // puts the cannon right // m_cameraObj->SetGunGoalH(0.0f); // puts the cannon right
if ( type == CAM_TYPE_ONBOARD ) if ( type == CAM_TYPE_ONBOARD )
m_focus = 1.50f; // Wide m_focus = 1.50f; // Wide

View File

@ -6617,7 +6617,7 @@ void CObject::SetSelect(bool bMode, bool bDisplayError)
if ( !m_bSelect ) if ( !m_bSelect )
{ {
SetGunGoalH(0.0f); // puts the cannon right //SetGunGoalH(0.0f); // puts the cannon right
return; // selects if not finished return; // selects if not finished
} }

View File

@ -476,7 +476,7 @@ const char* GetHelpText(const char *token)
if ( strcmp(token, "shield" ) == 0 ) return "shield ( oper, radius );"; if ( strcmp(token, "shield" ) == 0 ) return "shield ( oper, radius );";
if ( strcmp(token, "fire" ) == 0 ) return "fire ( time );"; if ( strcmp(token, "fire" ) == 0 ) return "fire ( time );";
if ( strcmp(token, "antfire" ) == 0 ) return "antfire ( );"; if ( strcmp(token, "antfire" ) == 0 ) return "antfire ( );";
if ( strcmp(token, "aim" ) == 0 ) return "aim ( angle );"; if ( strcmp(token, "aim" ) == 0 ) return "aim ( angle, angle );";
if ( strcmp(token, "motor" ) == 0 ) return "motor ( left, right );"; if ( strcmp(token, "motor" ) == 0 ) return "motor ( left, right );";
if ( strcmp(token, "jet" ) == 0 ) return "jet ( power );"; if ( strcmp(token, "jet" ) == 0 ) return "jet ( power );";
if ( strcmp(token, "topo" ) == 0 ) return "topo ( position );"; if ( strcmp(token, "topo" ) == 0 ) return "topo ( position );";

View File

@ -2186,12 +2186,29 @@ bool CScript::rFire(CBotVar* var, CBotVar* result, int& exception, void* user)
return Process(script, result, exception); return Process(script, result, exception);
} }
// Compilation of the instruction "aim(x, y)".
CBotTypResult CScript::cAim(CBotVar* &var, void* user)
{
if ( var == 0 ) return CBotTypResult(CBotErrLowParam);
if ( var->GetType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
var = var->GetNext();
if ( var == 0 ) return CBotTypResult(CBotTypFloat);
if ( var->GetType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
var = var->GetNext();
if ( var != 0 ) return CBotTypResult(CBotErrOverParam);
return CBotTypResult(CBotTypFloat);
}
// Instruction "aim(dir)". // Instruction "aim(dir)".
bool CScript::rAim(CBotVar* var, CBotVar* result, int& exception, void* user) bool CScript::rAim(CBotVar* var, CBotVar* result, int& exception, void* user)
{ {
CScript* script = (static_cast<CObject *>(user))->GetRunScript(); CScript* script = (static_cast<CObject *>(user))->GetRunScript();
float value; float x, y;
Error err; Error err;
exception = 0; exception = 0;
@ -2199,8 +2216,10 @@ bool CScript::rAim(CBotVar* var, CBotVar* result, int& exception, void* user)
if ( script->m_primaryTask == 0 ) // no task in progress? if ( script->m_primaryTask == 0 ) // no task in progress?
{ {
script->m_primaryTask = new CTaskManager(script->m_iMan, script->m_object); script->m_primaryTask = new CTaskManager(script->m_iMan, script->m_object);
value = var->GetValFloat(); x = var->GetValFloat();
err = script->m_primaryTask->StartTaskGunGoal(value*Math::PI/180.0f, 0.0f); var = var->GetNext();
var == 0 ? y=0.0f : y=var->GetValFloat();
err = script->m_primaryTask->StartTaskGunGoal(x*Math::PI/180.0f, y*Math::PI/180.0f);
if ( err != ERR_OK ) if ( err != ERR_OK )
{ {
delete script->m_primaryTask; delete script->m_primaryTask;
@ -2731,7 +2750,7 @@ void CScript::InitFonctions()
CBotProgram::AddFunction("recycle", rRecycle, CScript::cNull); CBotProgram::AddFunction("recycle", rRecycle, CScript::cNull);
CBotProgram::AddFunction("shield", rShield, CScript::cShield); CBotProgram::AddFunction("shield", rShield, CScript::cShield);
CBotProgram::AddFunction("fire", rFire, CScript::cFire); CBotProgram::AddFunction("fire", rFire, CScript::cFire);
CBotProgram::AddFunction("aim", rAim, CScript::cOneFloat); CBotProgram::AddFunction("aim", rAim, CScript::cAim);
CBotProgram::AddFunction("motor", rMotor, CScript::cMotor); CBotProgram::AddFunction("motor", rMotor, CScript::cMotor);
CBotProgram::AddFunction("jet", rJet, CScript::cOneFloat); CBotProgram::AddFunction("jet", rJet, CScript::cOneFloat);
CBotProgram::AddFunction("topo", rTopo, CScript::cTopo); CBotProgram::AddFunction("topo", rTopo, CScript::cTopo);

View File

@ -117,6 +117,7 @@ private:
static CBotTypResult cTestInfo(CBotVar* &var, void* user); static CBotTypResult cTestInfo(CBotVar* &var, void* user);
static CBotTypResult cShield(CBotVar* &var, void* user); static CBotTypResult cShield(CBotVar* &var, void* user);
static CBotTypResult cFire(CBotVar* &var, void* user); static CBotTypResult cFire(CBotVar* &var, void* user);
static CBotTypResult cAim(CBotVar* &var, void* user);
static CBotTypResult cMotor(CBotVar* &var, void* user); static CBotTypResult cMotor(CBotVar* &var, void* user);
static CBotTypResult cTopo(CBotVar* &var, void* user); static CBotTypResult cTopo(CBotVar* &var, void* user);
static CBotTypResult cMessage(CBotVar* &var, void* user); static CBotTypResult cMessage(CBotVar* &var, void* user);