Make Sniffers able to plant flags
parent
e63afb3461
commit
a92fa950e2
|
@ -61,6 +61,24 @@ bool CTaskFlag::EventProcess(const Event &event)
|
|||
|
||||
m_time += event.rTime;
|
||||
|
||||
ObjectType type = m_object->GetType();
|
||||
if ( type == OBJECT_MOBILEfs ||
|
||||
type == OBJECT_MOBILEts ||
|
||||
type == OBJECT_MOBILEws ||
|
||||
type == OBJECT_MOBILEis )
|
||||
{
|
||||
float angle = 110.0f*Math::PI/180.0f;
|
||||
float diff = -10.0f*Math::PI/180.0f;
|
||||
if ( m_time <= 0.5f )
|
||||
{
|
||||
m_object->SetPartRotationZ(1, angle+diff*m_time*2.0f);
|
||||
}
|
||||
else if ( m_time >= 1.5f && m_time < 2.0f )
|
||||
{
|
||||
m_object->SetPartRotationZ(1, angle+diff*(2.0f-m_time)*2.0f);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -104,7 +122,32 @@ Error CTaskFlag::Start(TaskFlagOrder order, int rank)
|
|||
|
||||
m_bError = false;
|
||||
|
||||
m_motion->SetAction(MHS_FLAG); // sets/removes flag
|
||||
switch ( m_object->GetType() ) // sets/removes flag
|
||||
{
|
||||
case OBJECT_HUMAN:
|
||||
case OBJECT_TECH:
|
||||
m_motion->SetAction(MHS_FLAG);
|
||||
break;
|
||||
|
||||
case OBJECT_MOBILEws:
|
||||
case OBJECT_MOBILEts:
|
||||
case OBJECT_MOBILEfs:
|
||||
case OBJECT_MOBILEis:
|
||||
{
|
||||
int i = m_sound->Play(SOUND_MANIP, m_object->GetPosition(), 0.0f, 0.3f, true);
|
||||
m_sound->AddEnvelope(i, 0.5f, 1.0f, 0.1f, SOPER_CONTINUE);
|
||||
m_sound->AddEnvelope(i, 0.5f, 1.0f, 0.3f, SOPER_CONTINUE);
|
||||
m_sound->AddEnvelope(i, 0.0f, 0.3f, 0.1f, SOPER_CONTINUE);
|
||||
m_sound->AddEnvelope(i, 0.0f, 0.3f, 1.0f, SOPER_CONTINUE);
|
||||
m_sound->AddEnvelope(i, 0.5f, 1.0f, 0.1f, SOPER_CONTINUE);
|
||||
m_sound->AddEnvelope(i, 0.5f, 1.0f, 0.3f, SOPER_CONTINUE);
|
||||
m_sound->AddEnvelope(i, 0.0f, 0.3f, 0.1f, SOPER_STOP);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
m_camera->StartCentering(m_object, Math::PI*0.3f, 99.9f, 0.0f, 0.5f);
|
||||
|
||||
return ERR_OK;
|
||||
|
@ -127,7 +170,23 @@ Error CTaskFlag::IsEnded()
|
|||
|
||||
bool CTaskFlag::Abort()
|
||||
{
|
||||
m_motion->SetAction(-1);
|
||||
switch ( m_object->GetType() )
|
||||
{
|
||||
case OBJECT_HUMAN:
|
||||
case OBJECT_TECH:
|
||||
m_motion->SetAction(-1);
|
||||
break;
|
||||
|
||||
case OBJECT_MOBILEws:
|
||||
case OBJECT_MOBILEts:
|
||||
case OBJECT_MOBILEfs:
|
||||
case OBJECT_MOBILEis:
|
||||
m_object->SetPartRotationZ(1, 110.0f*Math::PI/180.0f);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
m_camera->StopCentering(m_object, 2.0f);
|
||||
return true;
|
||||
}
|
||||
|
@ -190,7 +249,18 @@ Error CTaskFlag::CreateFlag(int rank)
|
|||
};
|
||||
|
||||
Math::Matrix* mat = m_object->GetWorldMatrix(0);
|
||||
Math::Vector pos = Transform(*mat, Math::Vector(4.0f, 0.0f, 0.0f));
|
||||
Math::Vector pos;
|
||||
switch ( m_object->GetType() )
|
||||
{
|
||||
case OBJECT_HUMAN:
|
||||
case OBJECT_TECH:
|
||||
pos = Transform(*mat, Math::Vector(4.0f, 0.0f, 0.0f));
|
||||
break;
|
||||
|
||||
default:
|
||||
pos = Transform(*mat, Math::Vector(6.0f, 0.0f, 0.0f));
|
||||
break;
|
||||
}
|
||||
|
||||
CObject* pObj = SearchNearest(pos, OBJECT_NULL);
|
||||
if ( pObj != nullptr )
|
||||
|
|
|
@ -1120,6 +1120,36 @@ bool CObjectInterface::CreateInterface(bool bSelect)
|
|||
pos.x = ox+sx*9.0f;
|
||||
pos.y = oy+sy*0.5f;
|
||||
pw->CreateButton(pos, dim, 11, EVENT_OBJECT_DELSEARCH);
|
||||
|
||||
if ( m_main->IsBuildingEnabled(BUILD_FLAG) )
|
||||
{
|
||||
pos.x = ox+sx*10.1f;
|
||||
pos.y = oy+sy*0.5f;
|
||||
pw->CreateButton(pos, dim, 64+54, EVENT_OBJECT_FCREATE);
|
||||
|
||||
pos.x = ox+sx*11.1f;
|
||||
pos.y = oy+sy*0.5f;
|
||||
pw->CreateButton(pos, dim, 64+55, EVENT_OBJECT_FDELETE);
|
||||
|
||||
ddim.x = dim.x*0.4f;
|
||||
ddim.y = dim.y*0.4f;
|
||||
pos.x = ox+sx*10.1f;
|
||||
pos.y = oy+sy*2.0f-ddim.y;
|
||||
pc = pw->CreateColor(pos, ddim, -1, EVENT_OBJECT_FCOLORb);
|
||||
pc->SetColor(Gfx::Color(0.28f, 0.56f, 1.0f, 0.0f));
|
||||
pos.x += ddim.x;
|
||||
pc = pw->CreateColor(pos, ddim, -1, EVENT_OBJECT_FCOLORr);
|
||||
pc->SetColor(Gfx::Color(1.0f, 0.0f, 0.0f, 0.0f));
|
||||
pos.x += ddim.x;
|
||||
pc = pw->CreateColor(pos, ddim, -1, EVENT_OBJECT_FCOLORg);
|
||||
pc->SetColor(Gfx::Color(0.0f, 0.8f, 0.0f, 0.0f));
|
||||
pos.x += ddim.x;
|
||||
pc = pw->CreateColor(pos, ddim, -1, EVENT_OBJECT_FCOLORy);
|
||||
pc->SetColor(Gfx::Color(1.0f, 0.93f, 0.0f, 0.0f)); //0x00ffec00
|
||||
pos.x += ddim.x;
|
||||
pc = pw->CreateColor(pos, ddim, -1, EVENT_OBJECT_FCOLORv);
|
||||
pc->SetColor(Gfx::Color(0.82f, 0.004f, 0.99f, 0.0f)); //0x00d101fe
|
||||
}
|
||||
}
|
||||
|
||||
if ( type == OBJECT_MOBILErt && // Terraformer?
|
||||
|
@ -1796,8 +1826,12 @@ void CObjectInterface::UpdateInterface()
|
|||
EnableInterface(pw, EVENT_OBJECT_BDESTROYER,bEnable);
|
||||
}
|
||||
|
||||
if ( type == OBJECT_HUMAN || // builder?
|
||||
type == OBJECT_TECH )
|
||||
if ( type == OBJECT_HUMAN || // can create flags?
|
||||
type == OBJECT_TECH ||
|
||||
type == OBJECT_MOBILEfs ||
|
||||
type == OBJECT_MOBILEts ||
|
||||
type == OBJECT_MOBILEws ||
|
||||
type == OBJECT_MOBILEis )
|
||||
{
|
||||
CheckInterface(pw, EVENT_OBJECT_FCOLORb, m_flagColor==0);
|
||||
CheckInterface(pw, EVENT_OBJECT_FCOLORr, m_flagColor==1);
|
||||
|
|
Loading…
Reference in New Issue