Removed some old, unused code

master
krzys-h 2015-08-12 17:25:41 +02:00
parent f7d2f501bb
commit 60797f72d3
39 changed files with 6 additions and 1143 deletions

View File

@ -219,7 +219,6 @@ set(BASE_SOURCES
ui/controls/button.cpp
ui/controls/check.cpp
ui/controls/color.cpp
ui/controls/compass.cpp
ui/controls/control.cpp
ui/controls/edit.cpp
ui/controls/editvalue.cpp

View File

@ -450,7 +450,6 @@ void InitializeEventTypeTexts()
EVENT_TYPE_TEXT[EVENT_OBJECT_GENERGY] = "EVENT_OBJECT_GENERGY";
EVENT_TYPE_TEXT[EVENT_OBJECT_GSHIELD] = "EVENT_OBJECT_GSHIELD";
EVENT_TYPE_TEXT[EVENT_OBJECT_GRANGE] = "EVENT_OBJECT_GRANGE";
EVENT_TYPE_TEXT[EVENT_OBJECT_COMPASS] = "EVENT_OBJECT_COMPASS";
EVENT_TYPE_TEXT[EVENT_OBJECT_MAP] = "EVENT_OBJECT_MAP";
EVENT_TYPE_TEXT[EVENT_OBJECT_MAPZOOM] = "EVENT_OBJECT_MAPZOOM";
EVENT_TYPE_TEXT[EVENT_OBJECT_GPROGRESS] = "EVENT_OBJECT_GPROGRESS";

View File

@ -478,7 +478,6 @@ enum EventType
EVENT_OBJECT_GENERGY = 1360,
EVENT_OBJECT_GSHIELD = 1361,
EVENT_OBJECT_GRANGE = 1362,
EVENT_OBJECT_COMPASS = 1363,
EVENT_OBJECT_MAP = 1364,
EVENT_OBJECT_MAPZOOM = 1365,
EVENT_OBJECT_GPROGRESS = 1366,

View File

@ -157,7 +157,7 @@ bool CResourceManager::RemoveDirectory(const std::string& directory)
try
{
std::string path = writeDir + "/" + CleanPath(directory);
#ifdef PLATFORM_WINDOWS
#if PLATFORM_WINDOWS
fs::remove_all(CSystemUtilsWindows::UTF8_Decode(path));
#else
fs::remove_all(path);
@ -247,7 +247,7 @@ bool CResourceManager::Move(const std::string& from, const std::string& to)
{
std::string path_from = writeDir + "/" + CleanPath(from);
std::string path_to = writeDir + "/" + CleanPath(to);
#ifdef PLATFORM_WINDOWS
#if PLATFORM_WINDOWS
fs::rename(CSystemUtilsWindows::UTF8_Decode(path_from), CSystemUtilsWindows::UTF8_Decode(path_to));
#else
fs::rename(path_from, path_to);

View File

@ -408,7 +408,6 @@ void InitializeRestext()
stringsEvent[EVENT_OBJECT_GPROGRESS] = TR("Still working ...");
stringsEvent[EVENT_OBJECT_GRADAR] = TR("Number of insects detected");
stringsEvent[EVENT_OBJECT_GINFO] = TR("Transmitted information");
stringsEvent[EVENT_OBJECT_COMPASS] = TR("Compass");
stringsEvent[EVENT_OBJECT_MAPZOOM] = TR("Zoom mini-map");
stringsEvent[EVENT_OBJECT_CAMERA] = TR("Camera (\\key camera;)");
stringsEvent[EVENT_OBJECT_CAMERAleft] = TR("Camera to left");

View File

@ -222,26 +222,6 @@ bool CAuto::CreateInterface(bool bSelect)
pw->CreateButton(pos, ddim, 12, EVENT_OBJECT_DELETE);
}
#if 0
pos.x = ox+sx*12.4f;
pos.y = oy+sy*1;
pw->CreateButton(pos, dim, 63, EVENT_OBJECT_BHELP);
pos.x = ox+sx*12.4f;
pos.y = oy+sy*0;
pw->CreateButton(pos, dim, 19, EVENT_OBJECT_HELP);
if ( m_main->GetSceneSoluce() )
{
pos.x = ox+sx*13.4f;
pos.y = oy+sy*1;
pw->CreateButton(pos, dim, 20, EVENT_OBJECT_SOLUCE);
}
pos.x = ox+sx*13.4f;
pos.y = oy+sy*0;
pw->CreateButton(pos, dim, 10, EVENT_OBJECT_DESELECT);
#else
pos.x = ox+sx*12.3f;
pos.y = oy+sy*-0.1f;
ddim.x = dim.x*1.0f;
@ -263,7 +243,6 @@ bool CAuto::CreateInterface(bool bSelect)
pos.x = ox+sx*13.4f;
pos.y = oy+sy*0;
pw->CreateButton(pos, dim, 10, EVENT_OBJECT_DESELECT);
#endif
pos.x = ox+sx*14.9f;
pos.y = oy+sy*0;

View File

@ -359,18 +359,6 @@ bool CAutoFactory::EventProcess(const Event &event)
{
m_lastParticle = m_time;
#if 0
pos = m_cargoPos;
pos.x += (Math::Rand()-0.5f)*20.0f;
pos.z += (Math::Rand()-0.5f)*20.0f;
pos.y += 1.0f;
speed.x = (Math::Rand()-0.5f)*12.0f;
speed.z = (Math::Rand()-0.5f)*12.0f;
speed.y = Math::Rand()*12.0f;
dim.x = Math::Rand()*12.0f+10.0f;
dim.y = dim.x;
m_particle->CreateParticle(pos, speed, dim, PARTIBLUE, 1.0f, 0.0f, 0.0f);
#else
mat = m_object->GetWorldMatrix(0);
pos = Math::Vector(-12.0f, 20.0f, -4.0f); // position of chimney
pos = Math::Transform(*mat, pos);
@ -383,7 +371,6 @@ bool CAutoFactory::EventProcess(const Event &event)
dim.x = Math::Rand()*1.5f+1.0f;
dim.y = dim.x;
m_particle->CreateParticle(pos, speed, dim, Gfx::PARTISMOKE3, 4.0f);
#endif
}
}
else

View File

@ -27,17 +27,6 @@
#include "object/old_object.h"
#define ADJUST_ANGLE 0 // 1 -> adjusts the angles of the members
#if ADJUST_ANGLE
static float g_flag1 = 6.00f;
static float g_flag2 = 0.10f;
static float g_flag3 = 2.00f;
#endif
// Object's constructor.
CAutoFlag::CAutoFlag(COldObject* object) : CAuto(object)
@ -100,18 +89,6 @@ bool CAutoFlag::EventProcess(const Event &event)
CAuto::EventProcess(event);
#if ADJUST_ANGLE
if ( event.type == EVENT_KEYDOWN )
{
if ( event.param == 'E' ) g_flag1 += 0.1f;
if ( event.param == 'D' ) g_flag1 -= 0.1f;
if ( event.param == 'R' ) g_flag2 += 0.1f;
if ( event.param == 'F' ) g_flag2 -= 0.1f;
if ( event.param == 'T' ) g_flag3 += 0.1f;
if ( event.param == 'G' ) g_flag3 -= 0.1f;
}
#endif
if ( m_engine->GetPause() ) return true;
if ( event.type != EVENT_FRAME ) return true;
@ -138,19 +115,10 @@ bool CAutoFlag::EventProcess(const Event &event)
for ( i=0 ; i<4 ; i++ )
{
#if ADJUST_ANGLE
angle = sinf(m_time*g_flag1+i*2.0f)*((i+g_flag3)*g_flag2);
#else
angle = sinf(m_time*6.0f+i*2.0f)*((i+2.0f)*0.1f);
#endif
m_object->SetPartRotationY(1+i, angle);
}
#if ADJUST_ANGLE
char s[100];
sprintf(s, "a=%.2f b=%.2f c=%.2f", g_flag1, g_flag2, g_flag3);
m_engine->SetInfoText(4, s);
#endif
return true;
}
@ -161,4 +129,3 @@ Error CAutoFlag::GetError()
{
return ERR_OK;
}

View File

@ -217,18 +217,6 @@ bool CAutoPowerStation::EventProcess(const Event &event)
dim.y = 1.5f;
m_particle->CreateParticle(ppos, speed, dim, Gfx::PARTIBLITZ, 1.0f, 0.0f, 0.0f);
#if 0
ppos = pos;
ppos.y += 1.0f;
ppos.x += (Math::Rand()-0.5f)*3.0f;
ppos.z += (Math::Rand()-0.5f)*3.0f;
speed.x = 0.0f;
speed.z = 0.0f;
speed.y = 2.5f+Math::Rand()*6.0f;
dim.x = Math::Rand()*1.5f+1.0f;
dim.y = dim.x;
m_particle->CreateParticle(ppos, speed, dim, Gfx::PARTISMOKE3, 4.0f);
#else
ppos = pos;
ppos.y += 1.0f;
ppos.x += (Math::Rand()-0.5f)*3.0f;
@ -239,7 +227,6 @@ bool CAutoPowerStation::EventProcess(const Event &event)
dim.x = Math::Rand()*1.0f+0.6f;
dim.y = dim.x;
m_particle->CreateParticle(ppos, speed, dim, Gfx::PARTIVAPOR, 3.0f);
#endif
}
if ( big < 0.0f ) big = 0.0f;

View File

@ -33,7 +33,6 @@
#include <stdio.h>
#define ADJUST_ANGLE 0 // 1 -> adjusts the angles of the members
const float START_TIME = 1000.0f; // beginning of the relative time
@ -46,11 +45,6 @@ CMotionAnt::CMotionAnt(COldObject* object) : CMotion(object)
m_armTimeAbs = START_TIME;
m_armTimeMarch = START_TIME;
m_armTimeAction = START_TIME;
m_armTimeIndex = 0;
m_armPartIndex = 0;
m_armMemberIndex = 0;
m_armLastAction = -1;
m_bArmStop = false;
m_lastParticle = 0.0f;
}
@ -388,36 +382,6 @@ bool CMotionAnt::EventProcess(const Event &event)
return EventFrame(event);
}
if ( event.type == EVENT_KEY_DOWN )
{
#if ADJUST_ANGLE
int i;
if ( event.param == 'A' ) m_armTimeIndex++;
if ( m_armTimeIndex >= 3 ) m_armTimeIndex = 0;
if ( event.param == 'Q' ) m_armPartIndex++;
if ( m_armPartIndex >= 3 ) m_armPartIndex = 0;
if ( event.param == 'W' ) m_armMemberIndex++;
if ( m_armMemberIndex >= 3 ) m_armMemberIndex = 0;
i = m_armMemberIndex*3;
i += m_armPartIndex*3*3;
i += m_armTimeIndex*3*3*3;
//? i += 3*3*3*3;
if ( event.param == 'E' ) m_armAngles[i+0] += 5;
if ( event.param == 'D' ) m_armAngles[i+0] -= 5;
if ( event.param == 'R' ) m_armAngles[i+1] += 5;
if ( event.param == 'F' ) m_armAngles[i+1] -= 5;
if ( event.param == 'T' ) m_armAngles[i+2] += 5;
if ( event.param == 'G' ) m_armAngles[i+2] -= 5;
if ( event.param == 'Y' ) m_bArmStop = !m_bArmStop;
#endif
}
return true;
}
@ -489,10 +453,6 @@ bool CMotionAnt::EventFrame(const Event &event)
{
if ( i < 3 ) prog = Math::Mod(m_armMember+(2.0f-(i%3))*0.33f+0.0f, 1.0f);
else prog = Math::Mod(m_armMember+(2.0f-(i%3))*0.33f+0.3f, 1.0f);
if ( m_bArmStop )
{
prog = static_cast< float >(m_armTimeIndex/3.0f);
}
if ( prog < 0.33f ) // t0..t1 ?
{
prog = prog/0.33f; // 0..1
@ -575,15 +535,6 @@ bool CMotionAnt::EventFrame(const Event &event)
}
}
#if ADJUST_ANGLE
if ( m_object->GetSelect() )
{
char s[100];
sprintf(s, "A:time=%d Q:part=%d W:member=%d", m_armTimeIndex, m_armPartIndex, m_armMemberIndex);
m_engine->SetInfoText(4, s);
}
#endif
if ( m_actionType == MAS_PREPARE ) // prepares the shooting?
{
prog = m_progress;
@ -832,4 +783,3 @@ bool CMotionAnt::EventFrame(const Event &event)
return true;
}

View File

@ -66,11 +66,5 @@ protected:
float m_armTimeMarch;
float m_armTimeAction;
short m_armAngles[3*3*3*3*3 + 3*3*3*8];
int m_armTimeIndex;
int m_armPartIndex;
int m_armMemberIndex;
int m_armLastAction;
bool m_bArmStop;
float m_lastParticle;
};

View File

@ -32,7 +32,6 @@
#include <stdio.h>
#define ADJUST_ANGLE 0 // 1 -> adjusts the angles of the members
const float START_TIME = 1000.0f; // beginning of the relative time
@ -44,12 +43,6 @@ CMotionBee::CMotionBee(COldObject* object) : CMotion(object)
m_armMember = START_TIME;
m_armTimeAbs = START_TIME;
m_armTimeMarch = START_TIME;
m_armTimeAction = START_TIME;
m_armTimeIndex = 0;
m_armPartIndex = 0;
m_armMemberIndex = 0;
m_armLastAction = -1;
m_bArmStop = false;
}
// Object's destructor.
@ -370,36 +363,6 @@ bool CMotionBee::EventProcess(const Event &event)
return EventFrame(event);
}
if ( event.type == EVENT_KEY_DOWN )
{
#if ADJUST_ANGLE
int i;
if ( event.param == 'A' ) m_armTimeIndex++;
if ( m_armTimeIndex >= 3 ) m_armTimeIndex = 0;
if ( event.param == 'Q' ) m_armPartIndex++;
if ( m_armPartIndex >= 3 ) m_armPartIndex = 0;
if ( event.param == 'W' ) m_armMemberIndex++;
if ( m_armMemberIndex >= 3 ) m_armMemberIndex = 0;
i = m_armMemberIndex*3;
i += m_armPartIndex*3*3;
i += m_armTimeIndex*3*3*3;
//? i += 3*3*3*3;
if ( event.param == 'E' ) m_armAngles[i+0] += 5;
if ( event.param == 'D' ) m_armAngles[i+0] -= 5;
if ( event.param == 'R' ) m_armAngles[i+1] += 5;
if ( event.param == 'F' ) m_armAngles[i+1] -= 5;
if ( event.param == 'T' ) m_armAngles[i+2] += 5;
if ( event.param == 'G' ) m_armAngles[i+2] -= 5;
if ( event.param == 'Y' ) m_bArmStop = !m_bArmStop;
#endif
}
return true;
}
@ -460,10 +423,6 @@ bool CMotionBee::EventFrame(const Event &event)
{
if ( i < 3 ) prog = Math::Mod(m_armMember+(2.0f-(i%3))*0.33f+0.0f, 1.0f);
else prog = Math::Mod(m_armMember+(2.0f-(i%3))*0.33f+0.3f, 1.0f);
if ( m_bArmStop )
{
prog = static_cast< float >(m_armTimeIndex/3.0f);
}
if ( prog < 0.33f ) // t0..t1 ?
{
prog = prog/0.33f; // 0..1
@ -512,15 +471,6 @@ bool CMotionBee::EventFrame(const Event &event)
}
}
#if ADJUST_ANGLE
if ( m_object->GetSelect() )
{
char s[100];
sprintf(s, "A:time=%d Q:part=%d W:member=%d", m_armTimeIndex, m_armPartIndex, m_armMemberIndex);
m_engine->SetInfoText(4, s);
}
#endif
if ( m_physics->GetLand() ) // on the ground?
{
if ( m_object->GetRuin() )
@ -576,39 +526,15 @@ bool CMotionBee::EventFrame(const Event &event)
prog = 1.00f;
}
#if 0
a = Math::Rand()*Math::PI/2.0f*prog;
m_object->SetPartRotationX(21, a); // right wing
a = -Math::Rand()*Math::PI/4.0f*prog;
m_object->SetPartRotationY(21, a);
a = -Math::Rand()*Math::PI/2.0f*prog;
m_object->SetPartRotationX(22, a); // left wing
a = Math::Rand()*Math::PI/4.0f*prog;
m_object->SetPartRotationY(22, a);
#else
m_object->SetPartRotationX(21, (sinf(m_armTimeAbs*30.0f)+1.0f)*(Math::PI/4.0f)*prog);
m_object->SetPartRotationY(21, -Math::Rand()*Math::PI/6.0f*prog);
m_object->SetPartRotationX(22, -(sinf(m_armTimeAbs*30.0f)+1.0f)*(Math::PI/4.0f)*prog);
m_object->SetPartRotationY(22, Math::Rand()*Math::PI/6.0f*prog);
#endif
m_object->SetPartRotationZ(1, sinf(m_armTimeAbs*1.4f)*0.20f); // head
m_object->SetPartRotationX(1, sinf(m_armTimeAbs*1.9f)*0.10f); // head
m_object->SetPartRotationY(1, sinf(m_armTimeAbs*2.1f)*0.50f); // head
#if 0
h = m_terrain->GetFloorHeight(GetPosition());
radius = 4.0f+h/4.0f;
color.r = 0.3f+h/80.0f;
color.g = color.r;
color.b = color.r;
color.a = color.r;
m_engine->SetObjectShadowRadius(m_objectPart[0].object, radius);
m_engine->SetObjectShadowColor(m_objectPart[0].object, color);
#endif
return true;
}

View File

@ -58,12 +58,5 @@ protected:
float m_armMember;
float m_armTimeAbs;
float m_armTimeMarch;
float m_armTimeAction;
short m_armAngles[3*3*3*3*2];
int m_armTimeIndex;
int m_armPartIndex;
int m_armMemberIndex;
int m_armLastAction;
bool m_bArmStop;
};

View File

@ -41,7 +41,6 @@
#define ADJUST_ANGLE 0 // 1 -> adjusts the angles of the members
const int ADJUST_ACTION = (3*3*3*3*MH_SPEC+3*3*3*MHS_SATCOM);
const float START_TIME = 1000.0f; // beginning of the relative time
@ -421,7 +420,6 @@ void CMotionHuman::CreatePhysics(ObjectType type)
int member_swim[] =
{
// x1,y1,z1, x2,y2,z2, x3,y3,z3,
#if 1
130,-70,200, 10,20,55, 0,0,0, // arms/thighs/-
115,-125,0, -5,0,-110, 0,0,0, // forearm/legs/-
0,0,0, -5,10,-5, 0,0,0, // hands/feet/-
@ -433,33 +431,6 @@ void CMotionHuman::CreatePhysics(ObjectType type)
130,-100,220,5,0,0, 0,0,0, // arms/thighs/-
150,5,0, -5,0,-15, 0,0,0, // forearm/legs/-
0,0,0, -5,30,-20, 0,0,0, // hands/feet/-
#endif
#if 0
130,-70,200,5,0,0, 0,0,0, // arms/thighs/-
115,-125,0, -5,0,-15, 0,0,0, // forearm/legs/-
0,0,0, -5,30,-20, 0,0,0, // hands/feet/-
//
130,-95,115, 10,20,55, 0,0,0, // arms/thighs/-
75,-50,25, -5,0,-110, 0,0,0, // forearm/legs/-
0,0,0, -5,10,-5, 0,0,0, // hands/feet/-
//
130,-100,220, 55,5,5, 0,0,0, // arms/thighs/-
150,5,0, -5,0,-15, 0,0,0, // forearm/legs/-
0,0,0, -5,5,-30, 0,0,0, // hands/feet/-
#endif
#if 0
130,-70,200, 55,5,5, 0,0,0, // arms/thighs/-
115,-125,0, -5,0,-15, 0,0,0, // forearm/legs/-
0,0,0, -5,5,-30, 0,0,0, // hands/feet/-
//
130,-95,115, 5,0,0, 0,0,0, // arms/thighs/-
75,-50,25, -5,0,-15, 0,0,0, // forearm/legs/-
0,0,0, -5,30,-20, 0,0,0, // hands/feet/-
//
130,-100,220, 10,20,55, 0,0,0, // arms/thighs/-
150,5,0, -5,0,-110, 0,0,0, // forearm/legs/-
0,0,0, -5,10,-5, 0,0,0, // hands/feet/-
#endif
};
int member_spec[] =
@ -630,43 +601,6 @@ bool CMotionHuman::EventProcess(const Event &event)
return EventFrame(event);
}
if ( event.type == EVENT_KEY_DOWN )
{
#if ADJUST_ANGLE
int i;
if ( event.param == 'A' ) m_armTimeIndex++;
if ( m_armTimeIndex >= 3 ) m_armTimeIndex = 0;
if ( event.param == 'Q' ) m_armPartIndex++;
if ( m_armPartIndex >= 3 ) m_armPartIndex = 0;
if ( event.param == 'W' ) m_armMemberIndex++;
if ( m_armMemberIndex >= 3 ) m_armMemberIndex = 0;
i = m_armMemberIndex*3;
i += m_armPartIndex*3*3;
i += m_armTimeIndex*3*3*3;
i += ADJUST_ACTION;
if ( event.param == 'E' ) m_armAngles[i+0] += 5;
if ( event.param == 'D' ) m_armAngles[i+0] -= 5;
if ( event.param == 'R' ) m_armAngles[i+1] += 5;
if ( event.param == 'F' ) m_armAngles[i+1] -= 5;
if ( event.param == 'T' ) m_armAngles[i+2] += 5;
if ( event.param == 'G' ) m_armAngles[i+2] -= 5;
if ( event.param == 'Y' ) m_bArmStop = !m_bArmStop;
if ( event.param == 'Y' )
{
char s[100];
sprintf(s, "index dans table = %d %d %d\n", i, i+9, i+18);
OutputDebugString(s);
}
#endif
}
return true;
}
@ -722,40 +656,10 @@ bool CMotionHuman::EventFrame(const Event &event)
bSwim = m_physics->GetSwim();
#if 0
rot = m_physics->GetCirMotionY(MO_MOTSPEED);
s = m_physics->GetLinMotionX(MO_REASPEED)*2.0f;
a = m_physics->GetLinMotionX(MO_TERSPEED);
if ( a < 0.0f ) // rises?
{
if ( s > 0.0f && s < 20.0f ) s = 20.0f; // moving slowly?
//? if ( s < 0.0f && s > -10.0f ) s = 0.0f; // falling slowly?
}
if ( a > 0.0f && !bSwim ) // falls?
{
if ( s > 0.0f && s < 10.0f ) s = 0.0f; // moving slowly?
//? if ( s < 0.0f && s > -5.0f ) s = -5.0f; // falling slowly?
}
a = fabs(rot*12.0f);
if ( !m_physics->GetLand() && !bSwim ) // in flight?
{
s = 0.0f;
}
if (IsObjectCarryingCargo(m_object)) // carries something?
{
s *= 1.3f;
}
#else
rot = m_physics->GetCirMotionY(MO_MOTSPEED);
#if 0
s = m_physics->GetLinMotionX(MO_REASPEED);
#else
a = m_physics->GetLinMotionX(MO_REASPEED);
s = m_physics->GetLinMotionX(MO_MOTSPEED)*0.2f;
if ( fabs(a) > fabs(s) ) s = a; // the highest value
#endif
a = m_physics->GetLinMotionX(MO_TERSPEED);
if ( a < 0.0f ) // rises?
{
@ -779,7 +683,6 @@ bool CMotionHuman::EventFrame(const Event &event)
{
s *= 1.3f;
}
#endif
m_time += event.rTime;
m_armTimeAbs += event.rTime;
@ -1028,7 +931,6 @@ bool CMotionHuman::EventFrame(const Event &event)
bb = sinf(m_time*3.1f)*aa; tSt[8] += bb; tNd[8] += bb;
}
#if 1
if ( i%2 == 1 && // leg?
m_actionType == -1 ) // no special action?
{
@ -1093,7 +995,6 @@ bool CMotionHuman::EventFrame(const Event &event)
tSt[8] -= aa;
tNd[8] -= aa; // increases the angle Z of the foot
}
#endif
if ( m_actionType == MHS_DEADw ) // drowned?
{
@ -1142,15 +1043,6 @@ bool CMotionHuman::EventFrame(const Event &event)
}
}
#if ADJUST_ANGLE
if ( m_object->GetSelect() )
{
char s[100];
sprintf(s, "A:time=%d Q:part=%d W:member=%d", m_armTimeIndex, m_armPartIndex, m_armMemberIndex);
m_engine->SetInfoText(4, s);
}
#endif
// calculates the height lowering as a function
// of the position of the legs.
hr = 1.5f*(1.0f-cosf(m_object->GetPartRotationZ(5))) +

View File

@ -32,7 +32,6 @@
#include <stdio.h>
#define ADJUST_ANGLE 0 // 1 -> adjusts the angles of the members
const float START_TIME = 1000.0f; // beginning of the relative time
@ -44,13 +43,6 @@ CMotionQueen::CMotionQueen(COldObject* object) : CMotion(object)
m_armMember = START_TIME;
m_armTimeAbs = START_TIME;
m_armTimeMarch = START_TIME;
m_armTimeAction = START_TIME;
m_armTimeIndex = 0;
m_armPartIndex = 0;
m_armMemberIndex = 0;
m_armLastAction = -1;
m_specAction = -1;
m_bArmStop = false;
}
// Object's destructor.
@ -322,36 +314,6 @@ bool CMotionQueen::EventProcess(const Event &event)
return EventFrame(event);
}
if ( event.type == EVENT_KEY_DOWN )
{
#if ADJUST_ANGLE
int i;
if ( event.param == 'A' ) m_armTimeIndex++;
if ( m_armTimeIndex >= 3 ) m_armTimeIndex = 0;
if ( event.param == 'Q' ) m_armPartIndex++;
if ( m_armPartIndex >= 3 ) m_armPartIndex = 0;
if ( event.param == 'W' ) m_armMemberIndex++;
if ( m_armMemberIndex >= 3 ) m_armMemberIndex = 0;
i = m_armMemberIndex*3;
i += m_armPartIndex*3*3;
i += m_armTimeIndex*3*3*3;
//? i += 3*3*3*3;
if ( event.param == 'E' ) m_armAngles[i+0] += 5;
if ( event.param == 'D' ) m_armAngles[i+0] -= 5;
if ( event.param == 'R' ) m_armAngles[i+1] += 5;
if ( event.param == 'F' ) m_armAngles[i+1] -= 5;
if ( event.param == 'T' ) m_armAngles[i+2] += 5;
if ( event.param == 'G' ) m_armAngles[i+2] -= 5;
if ( event.param == 'Y' ) m_bArmStop = !m_bArmStop;
#endif
}
return true;
}
@ -390,10 +352,6 @@ bool CMotionQueen::EventFrame(const Event &event)
{
if ( i < 3 ) prog = Math::Mod(m_armMember+(2.0f-(i%3))*0.33f+0.0f, 1.0f);
else prog = Math::Mod(m_armMember+(2.0f-(i%3))*0.33f+0.3f, 1.0f);
if ( m_bArmStop )
{
prog = static_cast< float >(m_armTimeIndex/3.0f);
}
if ( prog < 0.33f ) // t0..t1 ?
{
prog = prog/0.33f; // 0..1
@ -434,15 +392,6 @@ bool CMotionQueen::EventFrame(const Event &event)
}
}
#if ADJUST_ANGLE
if ( m_object->GetSelect() )
{
char s[100];
sprintf(s, "A:time=%d Q:part=%d W:member=%d", m_armTimeIndex, m_armPartIndex, m_armMemberIndex);
m_engine->SetInfoText(4, s);
}
#endif
if ( !bStop && !m_object->GetRuin() )
{
a = Math::Mod(m_armTimeMarch, 1.0f);
@ -494,4 +443,3 @@ bool CMotionQueen::EventFrame(const Event &event)
return true;
}

View File

@ -44,14 +44,5 @@ protected:
float m_armMember;
float m_armTimeAbs;
float m_armTimeMarch;
float m_armTimeAction;
short m_armAngles[3*3*3*3*10];
int m_armTimeIndex;
int m_armPartIndex;
int m_armMemberIndex;
int m_armLastAction;
int m_specAction;
float m_specTime;
bool m_bArmStop;
};

View File

@ -33,7 +33,6 @@
#define ADJUST_ANGLE 0 // 1 -> adjusts the angles of the members
const float START_TIME = 1000.0f; // beginning of the relative time
@ -44,13 +43,7 @@ CMotionSpider::CMotionSpider(COldObject* object) : CMotion(object)
{
m_armMember = START_TIME;
m_armTimeAbs = START_TIME;
m_armTimeMarch = START_TIME;
m_armTimeAction = START_TIME;
m_armTimeIndex = 0;
m_armPartIndex = 0;
m_armMemberIndex = 0;
m_armLastAction = -1;
m_bArmStop = false;
m_lastParticle = 0.0f;
}
@ -324,37 +317,6 @@ bool CMotionSpider::EventProcess(const Event &event)
return EventFrame(event);
}
if ( event.type == EVENT_KEY_DOWN )
{
#if ADJUST_ANGLE
int i;
if ( event.param == 'A' ) m_armTimeIndex++;
if ( m_armTimeIndex >= 3 ) m_armTimeIndex = 0;
if ( event.param == 'Q' ) m_armPartIndex++;
if ( m_armPartIndex >= 4 ) m_armPartIndex = 0;
if ( event.param == 'W' ) m_armMemberIndex++;
if ( m_armMemberIndex >= 4 ) m_armMemberIndex = 0;
i = m_armMemberIndex*3;
i += m_armPartIndex*3*4;
i += m_armTimeIndex*3*4*4;
if ( event.param == 'E' ) m_armAngles[i+0] += 5;
if ( event.param == 'D' ) m_armAngles[i+0] -= 5;
if ( event.param == 'R' ) m_armAngles[i+1] += 5;
if ( event.param == 'F' ) m_armAngles[i+1] -= 5;
if ( event.param == 'T' ) m_armAngles[i+2] += 5;
if ( event.param == 'G' ) m_armAngles[i+2] -= 5;
if ( event.param == 'Z' ) m_armAngles[i+3] += 5;
if ( event.param == 'H' ) m_armAngles[i+3] -= 5;
if ( event.param == 'Y' ) m_bArmStop = !m_bArmStop;
#endif
}
return true;
}
@ -379,7 +341,6 @@ bool CMotionSpider::EventFrame(const Event &event)
m_armTimeAbs += event.rTime;
m_armTimeAction += event.rTime;
m_armTimeMarch += (s)*event.rTime*0.15f;
m_armMember += (s+a)*event.rTime*0.15f;
bStop = ( a == 0.0f && s == 0.0f ); // stop?
@ -429,11 +390,6 @@ bool CMotionSpider::EventFrame(const Event &event)
//? else prog = Math::Mod(m_armMember+(2.0f-(i%4))*0.25f+0.3f, 1.0f);
if ( i < 4 ) prog = Math::Mod(m_armMember+(2.0f-(i%4))*0.25f+0.0f, 1.0f);
else prog = Math::Mod(m_armMember+(2.0f-(i%4))*0.25f+0.5f, 1.0f);
if ( m_bArmStop )
{
prog = static_cast< float >(m_armTimeIndex/3.0f);
action = MS_MARCH;
}
if ( prog < 0.33f ) // t0..t1 ?
{
prog = prog/0.33f; // 0..1
@ -529,15 +485,6 @@ bool CMotionSpider::EventFrame(const Event &event)
}
}
#if ADJUST_ANGLE
if ( m_object->GetSelect() )
{
char s[100];
sprintf(s, "A:time=%d Q:part=%d W:member=%d", m_armTimeIndex, m_armPartIndex, m_armMemberIndex);
m_engine->SetInfoText(4, s);
}
#endif
if ( m_actionType == MSS_BURN ) // burning?
{
dir = Math::Vector(Math::PI, 0.0f, 0.0f);
@ -743,4 +690,3 @@ bool CMotionSpider::EventFrame(const Event &event)
return true;
}

View File

@ -61,14 +61,7 @@ protected:
protected:
float m_armMember;
float m_armTimeAbs;
float m_armTimeMarch;
float m_armTimeAction;
short m_armAngles[3*4*4*3*3 + 3*4*4*6];
int m_armTimeIndex;
int m_armPartIndex;
int m_armMemberIndex;
int m_armLastAction;
bool m_bArmStop;
float m_lastParticle;
};

View File

@ -326,15 +326,9 @@ bool CMotionToto::EventFrame(const Event &event)
}
else
{
#if 0
distance = 30.0f-progress*24.5f; // remoteness
shift = 18.0f-progress*15.4f; // shift is left
verti = 10.0f-progress* 9.6f; // shift at the top
#else
distance = 30.0f-progress*18.0f; // remoteness
shift = 18.0f-progress*11.0f; // shift is left
verti = 10.0f-progress* 8.0f; // shift at the top
#endif
if ( m_actionType == -1 &&
(m_type == OBJECT_HUMAN ||
@ -481,7 +475,6 @@ bool CMotionToto::EventFrame(const Event &event)
aAntenna.z -= angle; // leans forward
// Calculates the residual motion.
#if 1
vibLin.y += (sinf(m_time*2.00f)*0.5f+
sinf(m_time*2.11f)*0.2f)*(1.0f-progress);
@ -496,7 +489,6 @@ bool CMotionToto::EventFrame(const Event &event)
vibCir.y += (sinf(m_time*Math::PI* 1.07f)*(Math::PI/ 10.0f)+
sinf(m_time*Math::PI* 1.19f)*(Math::PI/ 17.0f)+
sinf(m_time*Math::PI* 1.57f)*(Math::PI/ 31.0f))*(1.0f-progress);
#endif
// Calculates the animations in action.
if ( m_actionType == MT_ERROR ) // no-no?
@ -851,4 +843,3 @@ void CMotionToto::SetLinkType(ObjectType type)
{
m_type = type;
}

View File

@ -64,7 +64,6 @@ CMotionVehicle::CMotionVehicle(COldObject* object) : CMotion(object)
m_armTimeAbs = 1000.0f;
m_armMember = 1000.0f;
m_canonTime = 0.0f;
m_lastTimeCanon = 0.0f;
m_wheelLastPos = Math::Vector(0.0f, 0.0f, 0.0f);
m_wheelLastAngle = Math::Vector(0.0f, 0.0f, 0.0f);
m_posKey = Math::Vector(0.0f, 0.0f, 0.0f);
@ -1839,27 +1838,6 @@ bool CMotionVehicle::EventFrameCanoni(const Event &event)
sinf(m_canonTime*2.7f)*0.05f;
m_object->SetPartRotationX(2, angle);
#if 0
m_lastTimeCanon -= event.rTime;
if ( m_lastTimeCanon <= 0.0f )
{
m_lastTimeCanon = m_engine->ParticuleAdapt(0.5f+Math::Rand()*0.5f);
pos = m_object->GetPosition();
pos.y += 8.0f;
speed.y = 7.0f+Math::Rand()*3.0f;
speed.x = (Math::Rand()-0.5f)*2.0f;
speed.z = 2.0f+Math::Rand()*2.0f;
if ( Math::Rand() < 0.5f ) speed.z = -speed.z;
mat = m_object->GetRotateMatrix(0);
speed = Transform(*mat, speed);
dim.x = Math::Rand()*0.1f+0.1f;
if ( bOnBoard ) dim.x *= 0.4f;
dim.y = dim.x;
m_particule->CreateParticule(pos, speed, dim, PARTIORGANIC2, 2.0f, 10.0f);
}
#endif
return true;
}

View File

@ -60,7 +60,6 @@ protected:
float m_armTimeAbs;
float m_armMember;
float m_canonTime;
float m_lastTimeCanon;
Math::Vector m_wheelLastPos;
Math::Vector m_wheelLastAngle;
Math::Vector m_posKey;

View File

@ -1046,33 +1046,6 @@ CObjectUPtr CObjectFactory::CreateBuilding(const ObjectCreateParams& params)
m_terrain->AddBuildingLevel(pos, 7.0f, 9.0f, 1.0f, 0.5f);
}
#if 0
if ( power > 0.0f ) // creates a battery?
{
CObject* pPower;
pPower = new CObject();
pPower->obj->SetType(power<=1.0f?OBJECT_POWER:OBJECT_ATOMIC);
rank = m_engine->CreateObject();
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
pPower->obj->SetObjectRank(0, rank);
if ( power <= 1.0f ) m_oldModelManager->AddModelReference("power.mod", false, rank, obj->GetTeam());
else m_oldModelManager->AddModelReference("atomic.mod", false, rank, obj->GetTeam());
pPower->obj->SetPosition(GetCharacter()->posPower);
pPower->obj->AddCrashSphere(CrashSphere(Math::Vector(0.0f, 1.0f, 0.0f), 1.0f, SOUND_BOUMm, 0.45f));
pPower->obj->SetCameraCollisionSphere(Math::Sphere(Math::Vector(0.0f, 1.0f, 0.0f), 1.5f));
pPower->SetTransporter(obj.get());
SetPower(pPower);
if ( power <= 1.0f ) pPower->obj->SetEnergyLevel(power);
else pPower->obj->SetEnergyLevel(power/100.0f);
}
#endif
pos = obj->GetPosition();
pos.y += height;
obj->SetPosition(pos); // to display the shadows immediately
@ -2600,30 +2573,6 @@ CObjectUPtr CObjectFactory::CreateVehicle(const ObjectCreateParams& params)
obj->SetToy(toy);
float showLimitRadius = 0.0f;
#if 0
if ( type == OBJECT_MOBILEfc ||
type == OBJECT_MOBILEtc ||
type == OBJECT_MOBILEwc ||
type == OBJECT_MOBILEic ) // fireball cannon?
{
showLimitRadius = 160.0f;
}
if ( type == OBJECT_MOBILEfi ||
type == OBJECT_MOBILEti ||
type == OBJECT_MOBILEwi ||
type == OBJECT_MOBILEii ) // orgaball cannon?
{
showLimitRadius = 160.0f;
}
if ( type == OBJECT_MOBILErc ) // phazer cannon?
{
showLimitRadius = 160.0f;
}
if ( type == OBJECT_MOBILErs ) // robot shield?
{
showLimitRadius = 50.0f;
}
#endif
if ( type == OBJECT_MOBILErt ) // robot thumper?
{
showLimitRadius = 400.0f;

View File

@ -66,27 +66,11 @@
#include <iomanip>
#define ADJUST_ONBOARD 0 // 1 -> adjusts the camera ONBOARD
#define ADJUST_ARM 0 // 1 -> adjusts the manipulator arm
const float VIRUS_DELAY = 60.0f; // duration of virus infection
const float LOSS_SHIELD = 0.24f; // loss of the shield by shot
const float LOSS_SHIELD_H = 0.10f; // loss of the shield for humans
const float LOSS_SHIELD_M = 0.02f; // loss of the shield for the laying
#if ADJUST_ONBOARD
static float debug_x = 0.0f;
static float debug_y = 0.0f;
static float debug_z = 0.0f;
#endif
#if ADJUST_ARM
static float debug_arm1 = 0.0f;
static float debug_arm2 = 0.0f;
static float debug_arm3 = 0.0f;
#endif
// Object's constructor.
COldObject::COldObject(int id)
@ -213,27 +197,6 @@ void COldObject::DeleteObject(bool bAll)
if ( !bAll )
{
#if 0
type = m_camera->GetType();
if ( (type == Gfx::CAM_TYPE_BACK ||
type == Gfx::CAM_TYPE_FIX ||
type == Gfx::CAM_TYPE_EXPLO ||
type == Gfx::CAM_TYPE_ONBOARD) &&
m_camera->GetControllingObject() == this )
{
obj = m_main->SearchNearest(GetPosition(), this);
if ( obj == 0 )
{
m_camera->SetControllingObject(0);
m_camera->SetType(Gfx::CAM_TYPE_FREE);
}
else
{
m_camera->SetControllingObject(obj);
m_camera->SetType(Gfx::CAM_TYPE_BACK);
}
}
#endif
m_engine->GetPyroManager()->CutObjectLink(this);
if ( m_bSelect )
@ -1018,16 +981,10 @@ void COldObject::FloorAdjust()
pos = GetPosition();
if ( m_terrain->GetNormal(n, pos) )
{
#if 0
SetRotationX( sinf(n.z));
SetRotationZ(-sinf(n.x));
SetRotationY(0.0f);
#else
a = GetRotationY();
nn = Math::RotatePoint(-a, Math::Point(n.z, n.x));
SetRotationX( sinf(nn.x));
SetRotationZ(-sinf(nn.y));
#endif
}
}
@ -1745,46 +1702,6 @@ void COldObject::UpdateEnergyMapping()
bool COldObject::EventProcess(const Event &event)
{
if ( event.type == EVENT_KEY_DOWN )
{
#if ADJUST_ONBOARD
if ( m_bSelect )
{
if ( event.param == 'E' ) debug_x += 0.1f;
if ( event.param == 'D' ) debug_x -= 0.1f;
if ( event.param == 'R' ) debug_y += 0.1f;
if ( event.param == 'F' ) debug_y -= 0.1f;
if ( event.param == 'T' ) debug_z += 0.1f;
if ( event.param == 'G' ) debug_z -= 0.1f;
}
#endif
#if ADJUST_ARM
if ( m_bSelect )
{
if ( event.param == 'X' ) debug_arm1 += 5.0f*Math::PI/180.0f;
if ( event.param == 'C' ) debug_arm1 -= 5.0f*Math::PI/180.0f;
if ( event.param == 'V' ) debug_arm2 += 5.0f*Math::PI/180.0f;
if ( event.param == 'B' ) debug_arm2 -= 5.0f*Math::PI/180.0f;
if ( event.param == 'N' ) debug_arm3 += 5.0f*Math::PI/180.0f;
if ( event.param == 'M' ) debug_arm3 -= 5.0f*Math::PI/180.0f;
if ( event.param == 'X' ||
event.param == 'C' ||
event.param == 'V' ||
event.param == 'B' ||
event.param == 'N' ||
event.param == 'M' )
{
SetPartRotationZ(1, debug_arm1);
SetPartRotationZ(2, debug_arm2);
SetPartRotationZ(3, debug_arm3);
char s[100];
sprintf(s, "a=%.2f b=%.2f c=%.2f", debug_arm1*180.0f/Math::PI, debug_arm2*180.0f/Math::PI, debug_arm3*180.0f/Math::PI);
m_engine->SetInfoText(5, s);
}
}
#endif
}
// NOTE: This should be called befoce CProgrammableObjectImpl::EventProcess, see the other note inside this function
if (!CTaskExecutorObjectImpl::EventProcess(event)) return true;
@ -2153,14 +2070,6 @@ void COldObject::SetViewFromHere(Math::Vector &eye, float &dirH, float &dirV,
eye.y = 4.8f;
eye.z = 0.0f;
}
#if ADJUST_ONBOARD
eye.x += debug_x;
eye.y += debug_y;
eye.z += debug_z;
char s[100];
sprintf(s, "x=%.2f y=%.2f z=%.2f", eye.x, eye.y, eye.z);
m_engine->SetInfoText(4, s);
#endif
if ( type == Gfx::CAM_TYPE_BACK )
{

View File

@ -380,23 +380,6 @@ bool CTaskGoto::EventProcess(const Event &event)
return true;
}
#if 0
pos = m_object->GetPosition();
a = m_object->GetRotationY();
g = Math::RotateAngle(m_goal.x-pos.x, pos.z-m_goal.z); // CW !
cirSpeed = Math::Direction(a, g)*1.0f;
if ( cirSpeed > 1.0f ) cirSpeed = 1.0f;
if ( cirSpeed < -1.0f ) cirSpeed = -1.0f;
dist = Math::DistanceProjected(m_goal, pos);
linSpeed = dist/(m_physics->GetLinStopLength()*1.5f);
if ( linSpeed > 1.0f ) linSpeed = 1.0f;
if ( dist < 20.0f && fabs(cirSpeed) >= 0.5f )
{
linSpeed = 0.0f; // turns first, then advance
}
#else
pos = m_object->GetPosition();
rot.x = m_goal.x-pos.x;
@ -435,7 +418,6 @@ bool CTaskGoto::EventProcess(const Event &event)
{
linSpeed = 0.0f; // turns first, then advance
}
#endif
m_physics->SetMotorSpeedZ(cirSpeed); // turns left / right
m_physics->SetMotorSpeedX(linSpeed); // advance
@ -1343,51 +1325,6 @@ bool CTaskGoto::LeakSearch(Math::Vector &pos, float &delay)
void CTaskGoto::ComputeRepulse(Math::Point &dir)
{
#if 0
Math::Vector iPos, oPos;
Math::Point repulse;
CObject *pObj;
float dist, iRadius, oRadius;
int i;
dir.x = 0.0f;
dir.y = 0.0f;
m_object->GetCrashSphere(0, iPos, iRadius);
for ( i=0 ; i<1000000 ; i++ )
{
pObj = static_cast<CObject*>(iMan->SearchInstance(CLASS_OBJECT, i));
if ( pObj == 0 ) break;
if ( pObj == m_object ) continue;
if (IsObjectBeingTransported(pObj)) continue;
oPos = pObj->GetPosition();
dist = Math::Distance(oPos, m_goalObject);
if ( dist <= 1.0f ) continue;
pObj->GetGlobalSphere(oPos, oRadius);
oRadius += iRadius+m_physics->GetLinStopLength()*1.1f;
dist = Math::DistanceProjected(oPos, iPos);
if ( dist <= oRadius )
{
repulse.x = iPos.x-oPos.x;
repulse.y = iPos.z-oPos.z;
//? dist = 0.2f-(0.2f*dist/oRadius);
dist = powf(dist/oRadius, 2.0f);
dist = 0.2f-0.2f*dist;
repulse.x *= dist;
repulse.y *= dist;
//? repulse.x /= dist;
//? repulse.y /= dist;
dir.x += repulse.x;
dir.y += repulse.y;
}
}
#else
ObjectType iType, oType;
Math::Point repulse;
float gDist, add, addi, fac, dist;
@ -1549,7 +1486,6 @@ void CTaskGoto::ComputeRepulse(Math::Point &dir)
}
}
}
#endif
}
// Calculates the force of vertical repulsion according to barriers.
@ -2167,4 +2103,3 @@ bool CTaskGoto::BitmapTestDot(int rank, int x, int y)
return m_bmArray[rank*m_bmLine*m_bmSize + m_bmLine*y + x/8] & (1<<x%8);
}

View File

@ -1504,13 +1504,13 @@ bool CPhysics::EventFrame(const Event &event)
}
FloorAngle(pos, tAngle); // calculates the angle with the ground
}
#if 1
if ( pos.y < m_water->GetLevel(m_object) ) // underwater?
{
h *= 0.5f;
m_fallingHeight = 0.0f; // can't fall underwater
}
#endif
//? m_linMotion.terrainSpeed.x = -tAngle.z*m_linMotion.terrainForce.x*h;
//? m_linMotion.terrainSpeed.z = tAngle.x*m_linMotion.terrainForce.z*h;
//? m_linMotion.terrainSpeed.x = -sinf(tAngle.z)*Math::PI*0.5f*m_linMotion.terrainForce.x*h;
@ -3341,7 +3341,6 @@ void CPhysics::MotorParticle(float aTime, float rTime)
m_particle->CreateParticle(pos, speed, dim, Gfx::PARTISCRAPS, 2.0f, 10.0f);
#if 1
pos = Math::Vector(-1.6f, -0.5f, 0.0f);
pos = Transform(*mat, pos);
@ -3369,7 +3368,6 @@ void CPhysics::MotorParticle(float aTime, float rTime)
dim.y = dim.x;
m_particle->CreateParticle(pos, speed, dim, Gfx::PARTIEJECT, 0.3f, 10.0f);
#endif
}
}
@ -3464,7 +3462,6 @@ void CPhysics::MotorParticle(float aTime, float rTime)
m_particle->CreateParticle(pos, speed, dim, Gfx::PARTISCRAPS, 2.0f, 10.0f);
#if 1
pos = Math::Vector(0.0f, 1.0f, 0.0f);
pos = Transform(*mat, pos);
@ -3492,7 +3489,6 @@ void CPhysics::MotorParticle(float aTime, float rTime)
dim.y = dim.x;
m_particle->CreateParticle(pos, speed, dim, Gfx::PARTIEJECT, 0.5f, 10.0f);
#endif
}
}

View File

@ -142,9 +142,7 @@ bool CButton::EventProcess(const Event &event)
void CButton::Draw()
{
Math::Point pos, dim, uv1, uv2;
#if !_NEWLOOK
float dp;
#endif
if ( (m_state & STATE_VISIBLE) == 0 ) return;
@ -168,7 +166,6 @@ void CButton::Draw()
CControl::Draw();
#if !_NEWLOOK
if ( m_name[0] != 0 && // button with the name?
(m_state & STATE_CARD ) == 0 &&
(m_state & STATE_SIMPLY) == 0 )
@ -205,7 +202,6 @@ void CButton::Draw()
pos.x = m_pos.x + m_dim.x - 5.0f / 640.0f - 3.0f / 640.0f;
DrawIcon(pos, dim, uv1, uv2, 0.0f);
}
#endif
}
@ -237,4 +233,3 @@ bool CButton::GetRepeat()
}
}

View File

@ -1,174 +0,0 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsiteс.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see http://gnu.org/licenses
*/
#include "ui/controls/compass.h"
#include "common/event.h"
#include "common/misc.h"
#include "graphics/core/device.h"
#include "graphics/engine/engine.h"
#include "math/geometry.h"
namespace Ui
{
// Object's constructor.
CCompass::CCompass() : CControl()
{
m_dir = 0.0f;
}
// Object's destructor.
CCompass::~CCompass()
{
}
// Creates a new button.
bool CCompass::Create(Math::Point pos, Math::Point dim, int icon, EventType eventType)
{
if ( eventType == EVENT_NULL ) eventType = GetUniqueEventType();
CControl::Create(pos, dim, icon, eventType);
return true;
}
// Management of an event.
bool CCompass::EventProcess(const Event &event)
{
CControl::EventProcess(event);
if (event.type == EVENT_MOUSE_BUTTON_DOWN &&
event.GetData<MouseButtonEventData>()->button == MOUSE_BUTTON_LEFT &&
Detect(event.mousePos))
{
m_event->AddEvent(Event(m_eventType));
return false;
}
return true;
}
// Draw button.
void CCompass::Draw()
{
Gfx::CDevice* device;
Gfx::Vertex vertex[4]; // 2 triangles
Math::Point p1, p2, p3, c, uv1, uv2;
Math::Vector n;
float dp;
if ( (m_state & STATE_VISIBLE) == 0 ) return;
device = m_engine->GetDevice();
m_engine->SetTexture("textures/interface/button2.png");
m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
p1.x = m_pos.x;
p1.y = m_pos.y;
p2.x = m_pos.x + m_dim.x;
p2.y = m_pos.y + m_dim.y;
c.x = (p1.x + p2.x) / 2.0f;
c.y = (p1.y + p2.y) / 2.0f; // center
uv1.x = 64.0f / 256.0f;
uv1.y = 32.0f / 256.0f;
uv2.x = 96.0f / 256.0f;
uv2.y = 64.0f / 256.0f;
dp = 0.5f / 256.0f;
uv1.x += dp;
uv1.y += dp;
uv2.x -= dp;
uv2.y -= dp;
n = Math::Vector(0.0f, 0.0f, -1.0f); // normal
vertex[0] = Gfx::Vertex(Math::Vector(p1.x, p1.y, 0.0f), n, Math::Point(uv1.x, uv2.y));
vertex[1] = Gfx::Vertex(Math::Vector(p1.x, p2.y, 0.0f), n, Math::Point(uv1.x, uv1.y));
vertex[2] = Gfx::Vertex(Math::Vector(p2.x, p1.y, 0.0f), n, Math::Point(uv2.x, uv2.y));
vertex[3] = Gfx::Vertex(Math::Vector(p2.x, p2.y, 0.0f), n, Math::Point(uv2.x, uv1.y));
device->DrawPrimitive(Gfx::PRIMITIVE_TRIANGLE_STRIP, vertex, 4);
m_engine->AddStatisticTriangle(2);
if ( m_state & STATE_ENABLE )
{
p1.x = c.x;
p1.y = c.y + m_dim.x * 0.40f;
p1 = Math::RotatePoint(c, m_dir, p1);
p1.x = c.x + (p1.x - c.x) * (m_dim.x / m_dim.y);
p2.x = c.x + m_dim.x * 0.20f;
p2.y = c.y - m_dim.x * 0.40f;
p2 = Math::RotatePoint(c, m_dir, p2);
p2.x = c.x + (p2.x - c.x) * (m_dim.x / m_dim.y);
p3.x = c.x - m_dim.x * 0.20f;
p3.y = c.y - m_dim.x * 0.40f;
p3 = Math::RotatePoint(c, m_dir, p3);
p3.x = c.x + (p3.x - c.x) * (m_dim.x / m_dim.y);
uv1.x = 96.0f / 256.0f;
uv1.y = 32.0f / 256.0f;
uv2.x = 104.0f / 256.0f;
uv2.y = 64.0f / 256.0f;
uv1.x += dp;
uv1.y += dp;
uv2.x -= dp;
uv2.y -= dp;
vertex[0] = Gfx::Vertex(Math::Vector(p1.x, p1.y, 0.0f), n, Math::Point(uv1.x, uv1.y));
vertex[1] = Gfx::Vertex(Math::Vector(p2.x, p2.y, 0.0f), n, Math::Point(uv1.x, uv2.y));
vertex[2] = Gfx::Vertex(Math::Vector(p3.x, p3.y, 0.0f), n, Math::Point(uv2.x, uv2.y));
device->DrawPrimitive(Gfx::PRIMITIVE_TRIANGLES, vertex, 3);
m_engine->AddStatisticTriangle(1);
}
}
// Management directions of the compass.
void CCompass::SetDirection(float dir)
{
m_dir = dir;
}
float CCompass::GetDirection()
{
return m_dir;
}
}

View File

@ -1,56 +0,0 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsiteс.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see http://gnu.org/licenses
*/
// compass.h
#pragma once
#include "ui/controls/control.h"
namespace Gfx
{
class CEngine;
}
namespace Ui
{
class CCompass : public CControl
{
public:
CCompass();
virtual ~CCompass();
bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventType);
bool EventProcess(const Event &event);
void Draw();
void SetDirection(float dir);
float GetDirection();
protected:
float m_dir;
};
}

View File

@ -2662,20 +2662,6 @@ void CEdit::Insert(char character)
MoveChar(-1, false, false);
MoveChar(-1, false, false);
}
#if 0
else if ( character == '(' )
{
InsertOne(character);
InsertOne(')');
MoveChar(-1, false, false);
}
else if ( character == '[' )
{
InsertOne(character);
InsertOne(']');
MoveChar(-1, false, false);
}
#endif
else if ( character == '\t' )
{
for ( i=0 ; i<m_engine->GetEditIndentValue() ; i++ )

View File

@ -230,13 +230,6 @@ CShortcut* CInterface::CreateShortcut(Math::Point pos, Math::Point dim, int icon
return CreateControl<CShortcut>(pos, dim, icon, eventMsg);
}
// Creates a new compass.
CCompass* CInterface::CreateCompass(Math::Point pos, Math::Point dim, int icon, EventType eventMsg)
{
return CreateControl<CCompass>(pos, dim, icon, eventMsg);
}
// Creates a new target.
CTarget* CInterface::CreateTarget(Math::Point pos, Math::Point dim, int icon, EventType eventMsg)

View File

@ -32,7 +32,6 @@
#include "ui/controls/button.h"
#include "ui/controls/check.h"
#include "ui/controls/color.h"
#include "ui/controls/compass.h"
#include "ui/controls/control.h"
#include "ui/controls/edit.h"
#include "ui/controls/editvalue.h"
@ -80,7 +79,6 @@ public:
CSlider* CreateSlider(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
CEnumSlider* CreateEnumSlider(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
CShortcut* CreateShortcut(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
CCompass* CreateCompass(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
CTarget* CreateTarget(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
CMap* CreateMap(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);

View File

@ -944,7 +944,6 @@ void CMap::DrawPenta(Math::Point p1, Math::Point p2, Math::Point p3, Math::Point
n = Math::Vector(0.0f, 0.0f, -1.0f); // normal
#if 1
vertex[0] = Gfx::VertexTex2(Math::Vector(p1.x, p1.y, 0.0f), n, Math::Point(uv1.x,uv1.y));
vertex[1] = Gfx::VertexTex2(Math::Vector(p2.x, p2.y, 0.0f), n, Math::Point(uv1.x,uv2.y));
vertex[2] = Gfx::VertexTex2(Math::Vector(p5.x, p5.y, 0.0f), n, Math::Point(uv2.x,uv2.y));
@ -952,13 +951,6 @@ void CMap::DrawPenta(Math::Point p1, Math::Point p2, Math::Point p3, Math::Point
vertex[4] = Gfx::VertexTex2(Math::Vector(p4.x, p4.y, 0.0f), n, Math::Point(uv2.x,uv2.y));
device->DrawPrimitive(Gfx::PRIMITIVE_TRIANGLE_STRIP, vertex, 5);
#else
vertex[0] = Gfx::VertexTex2(Math::Vector(p2.x, p2.y, 0.0f), n, Math::Point(uv1.x,uv1.y));
vertex[1] = Gfx::VertexTex2(Math::Vector(p3.x, p3.y, 0.0f), n, Math::Point(uv1.x,uv2.y));
vertex[2] = Gfx::VertexTex2(Math::Vector(p4.x, p4.y, 0.0f), n, Math::Point(uv2.x,uv2.y));
device->DrawPrimitive(Gfx::PRIMITIVE_TRIANGLES, vertex, 3);
#endif
m_engine->AddStatisticTriangle(3);
}

View File

@ -55,40 +55,6 @@ bool CTarget::Create(Math::Point pos, Math::Point dim, int icon, EventType event
bool CTarget::EventProcess(const Event &event)
{
#if 0
if ( (m_state & STATE_VISIBLE) == 0 ) return true;
if ( m_state & STATE_DEAD ) return true;
CControl::EventProcess(event);
if ( event.type == EVENT_MOUSE_MOVE )
{
if ( CControl::Detect(event.mousePos) )
{
m_engine->SetMouseType(Gfx::ENG_MOUSE_TARGET);
Event newEvent = event;
newEvent.type = m_eventType;
m_event->AddEvent(newEvent);
return false;
}
}
if ( event.type == EVENT_MOUSE_BUTTON_DOWN &&
event.GetData<MouseButtonEventData>()->button == MOUSE_BUTTON_LEFT &&
(m_state & STATE_VISIBLE) &&
(m_state & STATE_ENABLE) )
{
if ( CControl::Detect(event.mousePos) )
{
Event newEvent = event;
newEvent.type = EVENT_OBJECT_FIRE;
m_event->AddEvent(newEvent);
return false;
}
}
return true;
#else
CObject* pObj;
if ( (m_state & STATE_VISIBLE) == 0 ) return true;
@ -134,7 +100,6 @@ bool CTarget::EventProcess(const Event &event)
}
return true;
#endif
}
@ -150,32 +115,18 @@ void CTarget::Draw()
bool CTarget::GetTooltip(Math::Point pos, std::string &name)
{
#if 0
if ( (m_state&STATE_VISIBLE) && Detect(pos) ) // in the window?
{
strcpy(name, m_tooltip);
return true; // does not detect objects below!
}
return false;
#else
//? CObject* pObj;
if ( (m_state & STATE_VISIBLE) == 0 ) return false;
if ( (m_state&STATE_VISIBLE) && Detect(pos) ) // in the window?
{
//? pObj = DetectFriendObject(pos);
//? if ( pObj == 0 )
if ( !m_main->GetFriendAim() )
{
m_tooltip = name;
m_tooltip = name;
return true; // does not detect objects below!
}
}
return false;
#endif
}

View File

@ -233,16 +233,6 @@ CGauge* CWindow::CreateGauge(Math::Point pos, Math::Point dim, int icon, EventTy
return CreateControl<CGauge>(pos, dim, icon, eventMsg);
}
// Creates a new compass.
CCompass* CWindow::CreateCompass(Math::Point pos, Math::Point dim, int icon, EventType eventMsg)
{
if (eventMsg == EVENT_NULL)
eventMsg = GetUniqueEventType();
return CreateControl<CCompass>(pos, dim, icon, eventMsg);
}
// Creates a new target.
CTarget* CWindow::CreateTarget(Math::Point pos, Math::Point dim, int icon, EventType eventMsg)

View File

@ -26,7 +26,6 @@
#include "ui/controls/button.h"
#include "ui/controls/check.h"
#include "ui/controls/color.h"
#include "ui/controls/compass.h"
#include "ui/controls/control.h"
#include "ui/controls/edit.h"
#include "ui/controls/editvalue.h"
@ -74,7 +73,6 @@ public:
CShortcut* CreateShortcut(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
CMap* CreateMap(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
CGauge* CreateGauge(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
CCompass* CreateCompass(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
CTarget* CreateTarget(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
bool DeleteControl(EventType eventMsg);
CControl* SearchControl(EventType eventMsg);

View File

@ -774,14 +774,6 @@ void CDisplayInfo::UpdateIndexButton()
}
}
#if 0
button = (CButton*)pw->SearchControl(EVENT_HYPER_COPY);
if ( button != 0 )
{
button->SetState(STATE_VISIBLE, m_index==SATCOM_LOADING);
}
#endif
edit = static_cast<Ui::CEdit*>(pw->SearchControl(EVENT_EDIT1));
if ( edit != 0 )
{

View File

@ -130,22 +130,6 @@ void CDisplayText::DisplayError(Error err, Math::Vector goal, float height,
{
if ( err == ERR_OK ) return;
#if 0
type = TT_INFO;
if ( err < INFO_FIRST )
{
type = TT_ERROR;
}
if ( err == ERR_TOWER_POWER ||
err == ERR_RESEARCH_POWER ||
err == ERR_ENERGY_EMPTY ||
err == ERR_LABO_NULL ||
err == ERR_NUCLEAR_EMPTY ||
err == ERR_CONVERT_EMPTY )
{
type = TT_WARNING;
}
#else
TextType type = TT_WARNING;
if ( err >= INFO_FIRST )
{
@ -160,7 +144,6 @@ void CDisplayText::DisplayError(Error err, Math::Vector goal, float height,
{
type = TT_ERROR;
}
#endif
std::string text;
GetResource(RES_ERR, err, text);
@ -572,4 +555,3 @@ CObject* CDisplayText::SearchToto()
}
} // namespace Ui

View File

@ -677,35 +677,6 @@ bool CObjectInterface::EventProcess(const Event &event)
m_main->ResetObject(); // reset all objects
UpdateInterface();
}
#if 0
if ( event.param == 'T' )
{
Math::Vector p1, p2;
float h;
p1 = m_object->GetPosition();
h = m_terrain->GetFloorLevel(p1);
p2 = p1;
p1.x -= 20.0f;
p1.z -= 20.0f;
p2.x += 20.0f;
p2.z += 20.0f;
m_terrain->Terraform(p1, p2, h+1.0f);
}
if ( event.param == 'R' )
{
Math::Vector p1, p2;
float h;
p1 = m_object->GetPosition();
h = m_terrain->GetFloorLevel(p1);
p2 = p1;
p1.x -= 20.0f;
p1.z -= 20.0f;
p2.x += 20.0f;
p2.z += 20.0f;
m_terrain->Terraform(p1, p2, h-1.0f);
}
#endif
}
if ( err != ERR_OK )
@ -1343,26 +1314,6 @@ bool CObjectInterface::CreateInterface(bool bSelect)
if ( m_object->GetToy() && !m_object->GetManual() )
{
#if 0
ddim.x = dim.x*0.66f;
ddim.y = dim.y*0.66f;
pos.x = ox+sx*10.0f;
pos.y = oy+sy*0.66f;
pb = pw->CreateButton(pos, ddim, 55, EVENT_OBJECT_CAMERAleft);
pb->SetImmediat(true);
pos.x = ox+sx*(10.0f+0.66f*2.0f);
pos.y = oy+sy*0.66f;
pb = pw->CreateButton(pos, ddim, 48, EVENT_OBJECT_CAMERAright);
pb->SetImmediat(true);
pos.x = ox+sx*(10.0f+0.66f);
pos.y = oy+sy*(0.66f*2.0f);
pb = pw->CreateButton(pos, ddim, 49, EVENT_OBJECT_CAMERAnear);
pb->SetImmediat(true);
pos.x = ox+sx*(10.0f+0.66f);
pos.y = oy+sy*0.0f;
pb = pw->CreateButton(pos, ddim, 50, EVENT_OBJECT_CAMERAaway);
pb->SetImmediat(true);
#else
pos.x = ox+sx*9.0f;
pos.y = oy+sy*0;
pb = pw->CreateButton(pos, dim, 55, EVENT_OBJECT_CAMERAleft);
@ -1379,7 +1330,6 @@ bool CObjectInterface::CreateInterface(bool bSelect)
pos.y = oy+sy*0;
pb = pw->CreateButton(pos, dim, 50, EVENT_OBJECT_CAMERAaway);
pb->SetImmediat(true);
#endif
}
pos.x = ox+sx*13.4f;
@ -1462,23 +1412,6 @@ bool CObjectInterface::CreateInterface(bool bSelect)
pw->CreateGauge(pos, ddim, 3, EVENT_OBJECT_GSHIELD);
}
#if 0
if ( false )
{
pos.x = 505.0f/640.0f;
pos.y = 3.0f/480.0f;
ddim.x = 33.0f/640.0f;
ddim.y = 33.0f/480.0f;
pw->CreateCompass(pos, ddim, 0, EVENT_OBJECT_COMPASS);
pc = (CCompass*)pw->SearchControl(EVENT_OBJECT_COMPASS);
if ( pc != 0 )
{
pc->SetState(STATE_VISIBLE, m_main->GetShowMap());
}
}
#endif
if ( type == OBJECT_MOBILEfc ||
type == OBJECT_MOBILEtc ||
type == OBJECT_MOBILEwc ||
@ -1541,12 +1474,11 @@ void CObjectInterface::UpdateInterface(float rTime)
{
CWindow* pw;
CButton* pb;
CCompass* pc;
CGroup* pgr;
CTarget* ptg;
Math::Vector pos, hPos;
Math::Point ppos;
float angle, range;
float range;
int icon;
bool bOnBoard;
@ -1643,15 +1575,6 @@ void CObjectInterface::UpdateInterface(float rTime)
pg->SetIcon(icon);
}
pc = static_cast< CCompass* >(pw->SearchControl(EVENT_OBJECT_COMPASS));
if ( pc != 0 )
{
angle = -(m_object->GetRotationY()+Math::PI/2.0f);
pc->SetDirection(angle);
pc->SetState(STATE_VISIBLE, m_main->GetShowMap());
}
pb = static_cast<CButton*>(pw->SearchControl(EVENT_OBJECT_REC));
if ( pb != 0 )
{
@ -1672,23 +1595,11 @@ void CObjectInterface::UpdateInterface(float rTime)
{
if ( bOnBoard )
{
#if 0
angle = m_object->GetGunGoalV();
if ( m_object->GetType() != OBJECT_MOBILErc )
{
angle += 10.0f*Math::PI/360.0f;
}
ppos.x = 0.5f-(64.0f/640.0f)/2.0f;
ppos.y = 0.5f-(64.0f/480.0f)/2.0f;
ppos.y += sinf(angle)*0.6f;
pgr->SetPos(ppos);
#else
ppos.x = 0.50f-(64.0f/640.0f)/2.0f;
ppos.y = 0.50f-(64.0f/480.0f)/2.0f;
ppos.x += m_object->GetGunGoalH()/2.0f;
ppos.y += m_object->GetGunGoalV()/1.3f;
pgr->SetPos(ppos);
#endif
pgr->SetState(STATE_VISIBLE, !m_main->GetFriendAim());
}
else

View File

@ -46,7 +46,6 @@
#include "ui/controls/check.h"
#include "ui/controls/color.h"
#include "ui/controls/compass.h"
#include "ui/controls/control.h"
#include "ui/controls/edit.h"
#include "ui/controls/group.h"