Merge pull request #125 from PaweX/dev
commit
59a40088a5
|
@ -328,8 +328,8 @@ void CCamera::SetType(CameraType type)
|
|||
if ( oType == OBJECT_HUSTON ) m_backMin = 80.0f;
|
||||
}
|
||||
|
||||
if ( type != CAM_TYPE_ONBOARD && m_cameraObj != 0 )
|
||||
m_cameraObj->SetGunGoalH(0.0f); // puts the cannon right
|
||||
//if ( type != CAM_TYPE_ONBOARD && m_cameraObj != 0 )
|
||||
// m_cameraObj->SetGunGoalH(0.0f); // puts the cannon right
|
||||
|
||||
if ( type == CAM_TYPE_ONBOARD )
|
||||
m_focus = 1.50f; // Wide
|
||||
|
|
|
@ -6617,7 +6617,7 @@ void CObject::SetSelect(bool bMode, bool bDisplayError)
|
|||
|
||||
if ( !m_bSelect )
|
||||
{
|
||||
SetGunGoalH(0.0f); // puts the cannon right
|
||||
//SetGunGoalH(0.0f); // puts the cannon right
|
||||
return; // selects if not finished
|
||||
}
|
||||
|
||||
|
|
|
@ -476,7 +476,7 @@ const char* GetHelpText(const char *token)
|
|||
if ( strcmp(token, "shield" ) == 0 ) return "shield ( oper, radius );";
|
||||
if ( strcmp(token, "fire" ) == 0 ) return "fire ( time );";
|
||||
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, "jet" ) == 0 ) return "jet ( power );";
|
||||
if ( strcmp(token, "topo" ) == 0 ) return "topo ( position );";
|
||||
|
|
|
@ -2186,12 +2186,29 @@ bool CScript::rFire(CBotVar* var, CBotVar* result, int& exception, void* user)
|
|||
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)".
|
||||
|
||||
bool CScript::rAim(CBotVar* var, CBotVar* result, int& exception, void* user)
|
||||
{
|
||||
CScript* script = (static_cast<CObject *>(user))->GetRunScript();
|
||||
float value;
|
||||
float x, y;
|
||||
Error err;
|
||||
|
||||
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?
|
||||
{
|
||||
script->m_primaryTask = new CTaskManager(script->m_iMan, script->m_object);
|
||||
value = var->GetValFloat();
|
||||
err = script->m_primaryTask->StartTaskGunGoal(value*Math::PI/180.0f, 0.0f);
|
||||
x = var->GetValFloat();
|
||||
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 )
|
||||
{
|
||||
delete script->m_primaryTask;
|
||||
|
@ -2731,7 +2750,7 @@ void CScript::InitFonctions()
|
|||
CBotProgram::AddFunction("recycle", rRecycle, CScript::cNull);
|
||||
CBotProgram::AddFunction("shield", rShield, CScript::cShield);
|
||||
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("jet", rJet, CScript::cOneFloat);
|
||||
CBotProgram::AddFunction("topo", rTopo, CScript::cTopo);
|
||||
|
|
|
@ -117,6 +117,7 @@ private:
|
|||
static CBotTypResult cTestInfo(CBotVar* &var, void* user);
|
||||
static CBotTypResult cShield(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 cTopo(CBotVar* &var, void* user);
|
||||
static CBotTypResult cMessage(CBotVar* &var, void* user);
|
||||
|
|
Loading…
Reference in New Issue