Removed trailing whitespace
parent
cf312c0b87
commit
c2a7375788
|
@ -390,7 +390,7 @@ void CApplication::ParseEvent()
|
||||||
|
|
||||||
void CApplication::ProcessEvent(Event event)
|
void CApplication::ProcessEvent(Event event)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CApplication::Render()
|
bool CApplication::Render()
|
||||||
|
|
|
@ -278,7 +278,7 @@ void CAuto::CheckInterface(CWindow *pw, EventMsg event, bool bState)
|
||||||
void CAuto::EnableInterface(CWindow *pw, EventMsg event, bool bState)
|
void CAuto::EnableInterface(CWindow *pw, EventMsg event, bool bState)
|
||||||
{
|
{
|
||||||
CControl* control;
|
CControl* control;
|
||||||
|
|
||||||
control = pw->SearchControl(event);
|
control = pw->SearchControl(event);
|
||||||
if ( control == 0 ) return;
|
if ( control == 0 ) return;
|
||||||
|
|
||||||
|
@ -290,7 +290,7 @@ void CAuto::EnableInterface(CWindow *pw, EventMsg event, bool bState)
|
||||||
void CAuto::VisibleInterface(CWindow *pw, EventMsg event, bool bState)
|
void CAuto::VisibleInterface(CWindow *pw, EventMsg event, bool bState)
|
||||||
{
|
{
|
||||||
CControl* control;
|
CControl* control;
|
||||||
|
|
||||||
control = pw->SearchControl(event);
|
control = pw->SearchControl(event);
|
||||||
if ( control == 0 ) return;
|
if ( control == 0 ) return;
|
||||||
|
|
||||||
|
@ -302,7 +302,7 @@ void CAuto::VisibleInterface(CWindow *pw, EventMsg event, bool bState)
|
||||||
void CAuto::DeadInterface(CWindow *pw, EventMsg event, bool bState)
|
void CAuto::DeadInterface(CWindow *pw, EventMsg event, bool bState)
|
||||||
{
|
{
|
||||||
CControl* control;
|
CControl* control;
|
||||||
|
|
||||||
control = pw->SearchControl(event);
|
control = pw->SearchControl(event);
|
||||||
if ( control == 0 ) return;
|
if ( control == 0 ) return;
|
||||||
|
|
||||||
|
|
|
@ -142,7 +142,7 @@ bool CAutoEnergy::EventProcess(const Event &event)
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateInterface(event.rTime);
|
UpdateInterface(event.rTime);
|
||||||
EventProgress(event.rTime);
|
EventProgress(event.rTime);
|
||||||
|
|
||||||
|
@ -332,7 +332,7 @@ bool CAutoEnergy::EventProcess(const Event &event)
|
||||||
m_speed = 1.0f/5.0f;
|
m_speed = 1.0f/5.0f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( m_phase == AENP_SMOKE )
|
if ( m_phase == AENP_SMOKE )
|
||||||
{
|
{
|
||||||
if ( m_progress < 1.0f )
|
if ( m_progress < 1.0f )
|
||||||
|
|
|
@ -511,7 +511,7 @@ void CAutoLabo::UpdateInterface()
|
||||||
void CAutoLabo::OkayButton(CWindow *pw, EventMsg event)
|
void CAutoLabo::OkayButton(CWindow *pw, EventMsg event)
|
||||||
{
|
{
|
||||||
CControl* control;
|
CControl* control;
|
||||||
|
|
||||||
control = pw->SearchControl(event);
|
control = pw->SearchControl(event);
|
||||||
if ( control == 0 ) return;
|
if ( control == 0 ) return;
|
||||||
|
|
||||||
|
|
|
@ -388,7 +388,7 @@ void CAutoResearch::UpdateInterface()
|
||||||
DeadInterface(pw, EVENT_OBJECT_RPHAZER, g_researchEnable&RESEARCH_PHAZER);
|
DeadInterface(pw, EVENT_OBJECT_RPHAZER, g_researchEnable&RESEARCH_PHAZER);
|
||||||
DeadInterface(pw, EVENT_OBJECT_RSHIELD, g_researchEnable&RESEARCH_SHIELD);
|
DeadInterface(pw, EVENT_OBJECT_RSHIELD, g_researchEnable&RESEARCH_SHIELD);
|
||||||
DeadInterface(pw, EVENT_OBJECT_RATOMIC, g_researchEnable&RESEARCH_ATOMIC);
|
DeadInterface(pw, EVENT_OBJECT_RATOMIC, g_researchEnable&RESEARCH_ATOMIC);
|
||||||
|
|
||||||
OkayButton(pw, EVENT_OBJECT_RTANK);
|
OkayButton(pw, EVENT_OBJECT_RTANK);
|
||||||
OkayButton(pw, EVENT_OBJECT_RFLY);
|
OkayButton(pw, EVENT_OBJECT_RFLY);
|
||||||
OkayButton(pw, EVENT_OBJECT_RTHUMP);
|
OkayButton(pw, EVENT_OBJECT_RTHUMP);
|
||||||
|
@ -446,7 +446,7 @@ void CAutoResearch::UpdateInterface(float rTime)
|
||||||
void CAutoResearch::OkayButton(CWindow *pw, EventMsg event)
|
void CAutoResearch::OkayButton(CWindow *pw, EventMsg event)
|
||||||
{
|
{
|
||||||
CControl* control;
|
CControl* control;
|
||||||
|
|
||||||
control = pw->SearchControl(event);
|
control = pw->SearchControl(event);
|
||||||
if ( control == 0 ) return;
|
if ( control == 0 ) return;
|
||||||
|
|
||||||
|
@ -601,7 +601,7 @@ bool CAutoResearch::Read(char *line)
|
||||||
|
|
||||||
m_lastUpdateTime = 0.0f;
|
m_lastUpdateTime = 0.0f;
|
||||||
m_lastParticule = 0.0f;
|
m_lastParticule = 0.0f;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -859,7 +859,7 @@ bool CBrain::IntroduceVirus()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Active Virus indicates that the object is contaminated. Unlike ch'tites (??? - Programerus)
|
// Active Virus indicates that the object is contaminated. Unlike ch'tites (??? - Programerus)
|
||||||
// letters which automatically disappear after a while,
|
// letters which automatically disappear after a while,
|
||||||
// ActiveVirus does not disappear after you edit the program
|
// ActiveVirus does not disappear after you edit the program
|
||||||
// (Even if the virus is not fixed).
|
// (Even if the virus is not fixed).
|
||||||
|
|
||||||
|
@ -2535,7 +2535,7 @@ void CBrain::CheckInterface(CWindow *pw, EventMsg event, bool bState)
|
||||||
void CBrain::EnableInterface(CWindow *pw, EventMsg event, bool bState)
|
void CBrain::EnableInterface(CWindow *pw, EventMsg event, bool bState)
|
||||||
{
|
{
|
||||||
CControl* control;
|
CControl* control;
|
||||||
|
|
||||||
control = pw->SearchControl(event);
|
control = pw->SearchControl(event);
|
||||||
if ( control == 0 ) return;
|
if ( control == 0 ) return;
|
||||||
|
|
||||||
|
@ -2547,7 +2547,7 @@ void CBrain::EnableInterface(CWindow *pw, EventMsg event, bool bState)
|
||||||
void CBrain::DeadInterface(CWindow *pw, EventMsg event, bool bState)
|
void CBrain::DeadInterface(CWindow *pw, EventMsg event, bool bState)
|
||||||
{
|
{
|
||||||
CControl* control;
|
CControl* control;
|
||||||
|
|
||||||
control = pw->SearchControl(event);
|
control = pw->SearchControl(event);
|
||||||
if ( control == 0 ) return;
|
if ( control == 0 ) return;
|
||||||
|
|
||||||
|
@ -2559,7 +2559,7 @@ void CBrain::DeadInterface(CWindow *pw, EventMsg event, bool bState)
|
||||||
void CBrain::DefaultEnter(CWindow *pw, EventMsg event, bool bState)
|
void CBrain::DefaultEnter(CWindow *pw, EventMsg event, bool bState)
|
||||||
{
|
{
|
||||||
CControl* control;
|
CControl* control;
|
||||||
|
|
||||||
control = pw->SearchControl(event);
|
control = pw->SearchControl(event);
|
||||||
if ( control == 0 ) return;
|
if ( control == 0 ) return;
|
||||||
|
|
||||||
|
|
|
@ -99,7 +99,7 @@ bool CMotion::EventProcess(const Event &event)
|
||||||
m_engine->RetPause() ) return true;
|
m_engine->RetPause() ) return true;
|
||||||
|
|
||||||
if ( event.event != EVENT_FRAME ) return true;
|
if ( event.event != EVENT_FRAME ) return true;
|
||||||
|
|
||||||
m_progress += event.rTime*m_actionTime;
|
m_progress += event.rTime*m_actionTime;
|
||||||
if ( m_progress > 1.0f ) m_progress = 1.0f; // (*)
|
if ( m_progress > 1.0f ) m_progress = 1.0f; // (*)
|
||||||
|
|
||||||
|
|
|
@ -912,7 +912,7 @@ bool CMotionHuman::EventFrame(const Event &event)
|
||||||
{
|
{
|
||||||
armAction = MH_MARCHTAKE; // take walking
|
armAction = MH_MARCHTAKE; // take walking
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( m_physics->RetLand() ) // on the ground?
|
if ( m_physics->RetLand() ) // on the ground?
|
||||||
{
|
{
|
||||||
a = m_object->RetAngleY(0);
|
a = m_object->RetAngleY(0);
|
||||||
|
@ -944,7 +944,7 @@ bool CMotionHuman::EventFrame(const Event &event)
|
||||||
ar = 0.0f;
|
ar = 0.0f;
|
||||||
af = 0.0f;
|
af = 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
for ( i=0 ; i<4 ; i++ ) // 4 members
|
for ( i=0 ; i<4 ; i++ ) // 4 members
|
||||||
{
|
{
|
||||||
if ( m_bArmStop ) // focus?
|
if ( m_bArmStop ) // focus?
|
||||||
|
|
|
@ -605,7 +605,7 @@ bool CMotionToto::EventFrame(const Event &event)
|
||||||
pos.z += sinf(m_time*Math::PI*2.11f)*(Math::PI/50.0f)+
|
pos.z += sinf(m_time*Math::PI*2.11f)*(Math::PI/50.0f)+
|
||||||
sinf(m_time*Math::PI*2.83f)*(Math::PI/70.0f)+
|
sinf(m_time*Math::PI*2.83f)*(Math::PI/70.0f)+
|
||||||
sinf(m_time*Math::PI*3.09f)*(Math::PI/90.0f);
|
sinf(m_time*Math::PI*3.09f)*(Math::PI/90.0f);
|
||||||
|
|
||||||
m_object->SetAngle(4, pos); // left antenna
|
m_object->SetAngle(4, pos); // left antenna
|
||||||
m_object->SetAngle(5, pos); // left antenna
|
m_object->SetAngle(5, pos); // left antenna
|
||||||
m_object->SetAngle(6, pos); // left antenna
|
m_object->SetAngle(6, pos); // left antenna
|
||||||
|
@ -623,7 +623,7 @@ bool CMotionToto::EventFrame(const Event &event)
|
||||||
pos.z += sinf(m_time*Math::PI*2.05f)*(Math::PI/50.0f)+
|
pos.z += sinf(m_time*Math::PI*2.05f)*(Math::PI/50.0f)+
|
||||||
sinf(m_time*Math::PI*2.38f)*(Math::PI/70.0f)+
|
sinf(m_time*Math::PI*2.38f)*(Math::PI/70.0f)+
|
||||||
sinf(m_time*Math::PI*2.79f)*(Math::PI/90.0f);
|
sinf(m_time*Math::PI*2.79f)*(Math::PI/90.0f);
|
||||||
|
|
||||||
m_object->SetAngle(7, pos); // right antenna
|
m_object->SetAngle(7, pos); // right antenna
|
||||||
m_object->SetAngle(8, pos); // right antenna
|
m_object->SetAngle(8, pos); // right antenna
|
||||||
m_object->SetAngle(9, pos); // right antenna
|
m_object->SetAngle(9, pos); // right antenna
|
||||||
|
@ -716,7 +716,7 @@ bool CMotionToto::EventFrame(const Event &event)
|
||||||
m_object->SetAngleX(2, 0.0f);
|
m_object->SetAngleX(2, 0.0f);
|
||||||
m_object->SetAngleX(3, 0.0f);
|
m_object->SetAngleX(3, 0.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
mat = m_object->RetWorldMatrix(0); // must be done every time!
|
mat = m_object->RetWorldMatrix(0); // must be done every time!
|
||||||
|
|
||||||
// Generates particles.
|
// Generates particles.
|
||||||
|
@ -741,7 +741,7 @@ bool CMotionToto::EventFrame(const Event &event)
|
||||||
speed.y += 5.0f+Math::Rand()*5.0f;
|
speed.y += 5.0f+Math::Rand()*5.0f;
|
||||||
speed.x += Math::Rand()*2.0f;
|
speed.x += Math::Rand()*2.0f;
|
||||||
speed.z += (Math::Rand()-0.5f)*2.0f;
|
speed.z += (Math::Rand()-0.5f)*2.0f;
|
||||||
|
|
||||||
pos = Transform(*mat, pos);
|
pos = Transform(*mat, pos);
|
||||||
speed = Transform(*mat, speed)-pos;
|
speed = Transform(*mat, speed)-pos;
|
||||||
|
|
||||||
|
@ -759,7 +759,7 @@ bool CMotionToto::EventFrame(const Event &event)
|
||||||
speed.y -= (1.5f+Math::Rand()*1.5f) + vibLin.y;
|
speed.y -= (1.5f+Math::Rand()*1.5f) + vibLin.y;
|
||||||
speed.x += (Math::Rand()-0.5f)*2.0f;
|
speed.x += (Math::Rand()-0.5f)*2.0f;
|
||||||
speed.z += (Math::Rand()-0.5f)*2.0f;
|
speed.z += (Math::Rand()-0.5f)*2.0f;
|
||||||
|
|
||||||
// mat = m_object->RetWorldMatrix(0);
|
// mat = m_object->RetWorldMatrix(0);
|
||||||
pos = Transform(*mat, pos);
|
pos = Transform(*mat, pos);
|
||||||
speed = Transform(*mat, speed)-pos;
|
speed = Transform(*mat, speed)-pos;
|
||||||
|
|
|
@ -775,7 +775,7 @@ bool CObject::ExploObject(ExploType type, float force, float decay)
|
||||||
m_main->DeselectAll();
|
m_main->DeselectAll();
|
||||||
}
|
}
|
||||||
DeleteDeselList(this);
|
DeleteDeselList(this);
|
||||||
|
|
||||||
if ( m_botVar != 0 )
|
if ( m_botVar != 0 )
|
||||||
{
|
{
|
||||||
if ( m_type == OBJECT_STONE ||
|
if ( m_type == OBJECT_STONE ||
|
||||||
|
@ -1140,7 +1140,7 @@ bool CObject::Write(char *line)
|
||||||
else sprintf(name, ";%.2f", value);
|
else sprintf(name, ";%.2f", value);
|
||||||
strcat(line, name);
|
strcat(line, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( m_motion != 0 )
|
if ( m_motion != 0 )
|
||||||
{
|
{
|
||||||
m_motion->Write(line);
|
m_motion->Write(line);
|
||||||
|
@ -1230,7 +1230,7 @@ bool CObject::Read(char *line)
|
||||||
if ( value == NAN ) break;
|
if ( value == NAN ) break;
|
||||||
SetCmdLine(i, value);
|
SetCmdLine(i, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( m_motion != 0 )
|
if ( m_motion != 0 )
|
||||||
{
|
{
|
||||||
m_motion->Read(line);
|
m_motion->Read(line);
|
||||||
|
@ -2417,7 +2417,7 @@ bool CObject::CreateBuilding(Math::Vector pos, float angle, float height,
|
||||||
pModFile->CreateEngineObject(rank);
|
pModFile->CreateEngineObject(rank);
|
||||||
SetPosition(4, Math::Vector(35.0f, 0.0f, 0.0f));
|
SetPosition(4, Math::Vector(35.0f, 0.0f, 0.0f));
|
||||||
SetAngleY(4, -55.0f*Math::PI/180.0f);
|
SetAngleY(4, -55.0f*Math::PI/180.0f);
|
||||||
|
|
||||||
rank = m_engine->CreateObject();
|
rank = m_engine->CreateObject();
|
||||||
m_engine->SetObjectType(rank, TYPEDESCENDANT);
|
m_engine->SetObjectType(rank, TYPEDESCENDANT);
|
||||||
SetObjectRank(5, rank);
|
SetObjectRank(5, rank);
|
||||||
|
@ -2444,7 +2444,7 @@ bool CObject::CreateBuilding(Math::Vector pos, float angle, float height,
|
||||||
pModFile->CreateEngineObject(rank);
|
pModFile->CreateEngineObject(rank);
|
||||||
SetPosition(7, Math::Vector(35.0f, 0.0f, 0.0f));
|
SetPosition(7, Math::Vector(35.0f, 0.0f, 0.0f));
|
||||||
SetAngleY(7, 55.0f*Math::PI/180.0f);
|
SetAngleY(7, 55.0f*Math::PI/180.0f);
|
||||||
|
|
||||||
rank = m_engine->CreateObject();
|
rank = m_engine->CreateObject();
|
||||||
m_engine->SetObjectType(rank, TYPEDESCENDANT);
|
m_engine->SetObjectType(rank, TYPEDESCENDANT);
|
||||||
SetObjectRank(8, rank);
|
SetObjectRank(8, rank);
|
||||||
|
@ -5554,7 +5554,7 @@ bool CObject::CreateApollo(Math::Vector pos, float angle, ObjectType type)
|
||||||
CreateShadowCircle(16.0f, 0.5f);
|
CreateShadowCircle(16.0f, 0.5f);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( type == OBJECT_APOLLO2 ) // jeep
|
if ( type == OBJECT_APOLLO2 ) // jeep
|
||||||
{
|
{
|
||||||
rank = m_engine->CreateObject();
|
rank = m_engine->CreateObject();
|
||||||
m_engine->SetObjectType(rank, TYPEFIX); //it is a stationary object
|
m_engine->SetObjectType(rank, TYPEFIX); //it is a stationary object
|
||||||
|
|
|
@ -151,7 +151,7 @@ bool rPoint(CBotVar* pThis, CBotVar* var, CBotVar* pResult, int& Exception)
|
||||||
pX->SetValFloat( var->GivValFloat() );
|
pX->SetValFloat( var->GivValFloat() );
|
||||||
var = var->GivNext();
|
var = var->GivNext();
|
||||||
|
|
||||||
if ( var == NULL )
|
if ( var == NULL )
|
||||||
{
|
{
|
||||||
Exception = CBotErrLowParam; return false;
|
Exception = CBotErrLowParam; return false;
|
||||||
}
|
}
|
||||||
|
@ -288,18 +288,18 @@ CRobotMain::CRobotMain(CInstanceManager* iMan)
|
||||||
if ( GetProfileFloat("Edit", "WindowPos.y", fValue) ) m_windowPos.y = fValue;
|
if ( GetProfileFloat("Edit", "WindowPos.y", fValue) ) m_windowPos.y = fValue;
|
||||||
if ( GetProfileFloat("Edit", "WindowDim.x", fValue) ) m_windowDim.x = fValue;
|
if ( GetProfileFloat("Edit", "WindowDim.x", fValue) ) m_windowDim.x = fValue;
|
||||||
if ( GetProfileFloat("Edit", "WindowDim.y", fValue) ) m_windowDim.y = fValue;
|
if ( GetProfileFloat("Edit", "WindowDim.y", fValue) ) m_windowDim.y = fValue;
|
||||||
|
|
||||||
m_IOPublic = false;
|
m_IOPublic = false;
|
||||||
m_IODim = Math::Point(320.0f/640.0f, (121.0f+18.0f*8)/480.0f);
|
m_IODim = Math::Point(320.0f/640.0f, (121.0f+18.0f*8)/480.0f);
|
||||||
m_IOPos.x = (1.0f-m_IODim.x)/2.0f; // in the middle
|
m_IOPos.x = (1.0f-m_IODim.x)/2.0f; // in the middle
|
||||||
m_IOPos.y = (1.0f-m_IODim.y)/2.0f;
|
m_IOPos.y = (1.0f-m_IODim.y)/2.0f;
|
||||||
|
|
||||||
if ( GetProfileInt ("Edit", "IOPublic", iValue) ) m_IOPublic = iValue;
|
if ( GetProfileInt ("Edit", "IOPublic", iValue) ) m_IOPublic = iValue;
|
||||||
if ( GetProfileFloat("Edit", "IOPos.x", fValue) ) m_IOPos.x = fValue;
|
if ( GetProfileFloat("Edit", "IOPos.x", fValue) ) m_IOPos.x = fValue;
|
||||||
if ( GetProfileFloat("Edit", "IOPos.y", fValue) ) m_IOPos.y = fValue;
|
if ( GetProfileFloat("Edit", "IOPos.y", fValue) ) m_IOPos.y = fValue;
|
||||||
if ( GetProfileFloat("Edit", "IODim.x", fValue) ) m_IODim.x = fValue;
|
if ( GetProfileFloat("Edit", "IODim.x", fValue) ) m_IODim.x = fValue;
|
||||||
if ( GetProfileFloat("Edit", "IODim.y", fValue) ) m_IODim.y = fValue;
|
if ( GetProfileFloat("Edit", "IODim.y", fValue) ) m_IODim.y = fValue;
|
||||||
|
|
||||||
m_short->FlushShortcuts();
|
m_short->FlushShortcuts();
|
||||||
InitEye();
|
InitEye();
|
||||||
|
|
||||||
|
@ -5978,10 +5978,10 @@ bool CRobotMain::IOWriteScene(char *filename, char *filecbot, char *info)
|
||||||
|
|
||||||
sprintf(line, "Title text=\"%s\"\n", info);
|
sprintf(line, "Title text=\"%s\"\n", info);
|
||||||
fputs(line, file);
|
fputs(line, file);
|
||||||
|
|
||||||
sprintf(line, "Version maj=%d min=%d\n", 0, 1);
|
sprintf(line, "Version maj=%d min=%d\n", 0, 1);
|
||||||
fputs(line, file);
|
fputs(line, file);
|
||||||
|
|
||||||
name = m_dialog->RetSceneName();
|
name = m_dialog->RetSceneName();
|
||||||
if ( strcmp(name, "user") == 0 )
|
if ( strcmp(name, "user") == 0 )
|
||||||
{
|
{
|
||||||
|
@ -6004,7 +6004,7 @@ bool CRobotMain::IOWriteScene(char *filename, char *filecbot, char *info)
|
||||||
sprintf(line, "BlitzMode sleep=%.2f delay=%.2f magnetic=%.2f progress=%.2f\n", sleep, delay, magnetic/g_unit, progress);
|
sprintf(line, "BlitzMode sleep=%.2f delay=%.2f magnetic=%.2f progress=%.2f\n", sleep, delay, magnetic/g_unit, progress);
|
||||||
fputs(line, file);
|
fputs(line, file);
|
||||||
}
|
}
|
||||||
|
|
||||||
objRank = 0;
|
objRank = 0;
|
||||||
for ( i=0 ; i<1000000 ; i++ )
|
for ( i=0 ; i<1000000 ; i++ )
|
||||||
{
|
{
|
||||||
|
@ -6136,7 +6136,7 @@ CObject* CRobotMain::IOReadObject(char *line, char* filename, int objRank)
|
||||||
#else
|
#else
|
||||||
LoadFileScript(pObj, filename, objRank, i);
|
LoadFileScript(pObj, filename, objRank, i);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
run = OpInt(line, "run", -1);
|
run = OpInt(line, "run", -1);
|
||||||
if ( run != -1 )
|
if ( run != -1 )
|
||||||
{
|
{
|
||||||
|
|
|
@ -371,7 +371,7 @@ Error CTaskBuild::Start(ObjectType type)
|
||||||
|
|
||||||
m_metal->SetLock(true); // not usable
|
m_metal->SetLock(true); // not usable
|
||||||
m_camera->StartCentering(m_object, Math::PI*0.15f, 99.9f, 0.0f, 1.0f);
|
m_camera->StartCentering(m_object, Math::PI*0.15f, 99.9f, 0.0f, 1.0f);
|
||||||
|
|
||||||
m_phase = TBP_TURN; // rotation necessary preliminary
|
m_phase = TBP_TURN; // rotation necessary preliminary
|
||||||
m_angleY = oAngle; // angle was reached
|
m_angleY = oAngle; // angle was reached
|
||||||
|
|
||||||
|
|
|
@ -316,7 +316,7 @@ Error CTaskFire::Start(float delay)
|
||||||
else if ( m_bRay ) fire = m_delay*ENERGY_FIREr;
|
else if ( m_bRay ) fire = m_delay*ENERGY_FIREr;
|
||||||
else fire = m_delay*ENERGY_FIRE;
|
else fire = m_delay*ENERGY_FIRE;
|
||||||
if ( energy < fire/power->RetCapacity()+0.05f ) return ERR_FIRE_ENERGY;
|
if ( energy < fire/power->RetCapacity()+0.05f ) return ERR_FIRE_ENERGY;
|
||||||
|
|
||||||
m_speed = 1.0f/m_delay;
|
m_speed = 1.0f/m_delay;
|
||||||
m_progress = 0.0f;
|
m_progress = 0.0f;
|
||||||
m_time = 0.0f;
|
m_time = 0.0f;
|
||||||
|
|
|
@ -1441,7 +1441,7 @@ void CTaskGoto::ComputeRepulse(Math::Point &dir)
|
||||||
|
|
||||||
if ( pObj == m_object ) continue;
|
if ( pObj == m_object ) continue;
|
||||||
if ( pObj->RetTruck() != 0 ) continue;
|
if ( pObj->RetTruck() != 0 ) continue;
|
||||||
|
|
||||||
oPos = pObj->RetPosition(0);
|
oPos = pObj->RetPosition(0);
|
||||||
dist = Math::Distance(oPos, m_goalObject);
|
dist = Math::Distance(oPos, m_goalObject);
|
||||||
if ( dist <= 1.0f ) continue;
|
if ( dist <= 1.0f ) continue;
|
||||||
|
@ -1601,7 +1601,7 @@ void CTaskGoto::ComputeRepulse(Math::Point &dir)
|
||||||
{
|
{
|
||||||
addi = 2.0f; // between wasps, do not annoy too much
|
addi = 2.0f; // between wasps, do not annoy too much
|
||||||
}
|
}
|
||||||
|
|
||||||
j = 0;
|
j = 0;
|
||||||
while ( pObj->GetCrashSphere(j++, oPos, oRadius) )
|
while ( pObj->GetCrashSphere(j++, oPos, oRadius) )
|
||||||
{
|
{
|
||||||
|
@ -1791,10 +1791,10 @@ Error CTaskGoto::BeamExplore(const Math::Vector &prevPos, const Math::Vector &cu
|
||||||
Math::Vector newPos;
|
Math::Vector newPos;
|
||||||
Error ret;
|
Error ret;
|
||||||
int iDiv, iClear, iLar;
|
int iDiv, iClear, iLar;
|
||||||
|
|
||||||
iLar = 0;
|
iLar = 0;
|
||||||
if ( i >= MAXPOINTS ) return ERR_GOTO_ITER; // too many recursions
|
if ( i >= MAXPOINTS ) return ERR_GOTO_ITER; // too many recursions
|
||||||
|
|
||||||
if ( m_bmIter[i] == -1 )
|
if ( m_bmIter[i] == -1 )
|
||||||
{
|
{
|
||||||
m_bmIter[i] = 0;
|
m_bmIter[i] = 0;
|
||||||
|
@ -1828,7 +1828,7 @@ Error CTaskGoto::BeamExplore(const Math::Vector &prevPos, const Math::Vector &cu
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( iLar >= m_bmIter[i] )
|
if ( iLar >= m_bmIter[i] )
|
||||||
{
|
{
|
||||||
newPos = BeamPoint(curPos, goalPos, 0, step);
|
newPos = BeamPoint(curPos, goalPos, 0, step);
|
||||||
|
@ -2051,7 +2051,7 @@ void CTaskGoto::BitmapObject()
|
||||||
if ( pObj == m_object ) continue;
|
if ( pObj == m_object ) continue;
|
||||||
if ( pObj == m_bmFretObject ) continue;
|
if ( pObj == m_bmFretObject ) continue;
|
||||||
if ( pObj->RetTruck() != 0 ) continue;
|
if ( pObj->RetTruck() != 0 ) continue;
|
||||||
|
|
||||||
h = m_terrain->RetFloorLevel(pObj->RetPosition(0), false);
|
h = m_terrain->RetFloorLevel(pObj->RetPosition(0), false);
|
||||||
if ( m_physics->RetType() == TYPE_FLYING && m_altitude > 0.0f )
|
if ( m_physics->RetType() == TYPE_FLYING && m_altitude > 0.0f )
|
||||||
{
|
{
|
||||||
|
@ -2177,7 +2177,7 @@ void CTaskGoto::BitmapTerrain(int minx, int miny, int maxx, int maxy)
|
||||||
{
|
{
|
||||||
aLimit = 60.0f*Math::PI/180.0f;
|
aLimit = 60.0f*Math::PI/180.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
for ( y=miny ; y<=maxy ; y++ )
|
for ( y=miny ; y<=maxy ; y++ )
|
||||||
{
|
{
|
||||||
for ( x=minx ; x<=maxx ; x++ )
|
for ( x=minx ; x<=maxx ; x++ )
|
||||||
|
|
|
@ -189,7 +189,7 @@ Error CTaskRecover::Start()
|
||||||
if ( power == 0 ) return ERR_RECOVER_ENERGY;
|
if ( power == 0 ) return ERR_RECOVER_ENERGY;
|
||||||
energy = power->RetEnergy();
|
energy = power->RetEnergy();
|
||||||
if ( energy < ENERGY_RECOVER/power->RetCapacity()+0.05f ) return ERR_RECOVER_ENERGY;
|
if ( energy < ENERGY_RECOVER/power->RetCapacity()+0.05f ) return ERR_RECOVER_ENERGY;
|
||||||
|
|
||||||
mat = m_object->RetWorldMatrix(0);
|
mat = m_object->RetWorldMatrix(0);
|
||||||
pos = Math::Vector(RECOVER_DIST, 3.3f, 0.0f);
|
pos = Math::Vector(RECOVER_DIST, 3.3f, 0.0f);
|
||||||
pos = Transform(*mat, pos); // position in front
|
pos = Transform(*mat, pos); // position in front
|
||||||
|
|
|
@ -257,7 +257,7 @@ Error CTaskShield::Start(TaskShieldMode mode, float delay)
|
||||||
if ( power == 0 ) return ERR_SHIELD_ENERGY;
|
if ( power == 0 ) return ERR_SHIELD_ENERGY;
|
||||||
energy = power->RetEnergy();
|
energy = power->RetEnergy();
|
||||||
if ( energy == 0.0f ) return ERR_SHIELD_ENERGY;
|
if ( energy == 0.0f ) return ERR_SHIELD_ENERGY;
|
||||||
|
|
||||||
mat = m_object->RetWorldMatrix(0);
|
mat = m_object->RetWorldMatrix(0);
|
||||||
pos = Math::Vector(7.0f, 15.0f, 0.0f);
|
pos = Math::Vector(7.0f, 15.0f, 0.0f);
|
||||||
pos = Transform(*mat, pos); // sphere position
|
pos = Transform(*mat, pos); // sphere position
|
||||||
|
|
|
@ -216,7 +216,7 @@ Error CTaskTerraform::Start()
|
||||||
if ( power == 0 ) return ERR_TERRA_ENERGY;
|
if ( power == 0 ) return ERR_TERRA_ENERGY;
|
||||||
energy = power->RetEnergy();
|
energy = power->RetEnergy();
|
||||||
if ( energy < ENERGY_TERRA/power->RetCapacity()+0.05f ) return ERR_TERRA_ENERGY;
|
if ( energy < ENERGY_TERRA/power->RetCapacity()+0.05f ) return ERR_TERRA_ENERGY;
|
||||||
|
|
||||||
speed = m_physics->RetMotorSpeed();
|
speed = m_physics->RetMotorSpeed();
|
||||||
if ( speed.x != 0.0f ||
|
if ( speed.x != 0.0f ||
|
||||||
speed.z != 0.0f ) return ERR_MANIP_MOTOR;
|
speed.z != 0.0f ) return ERR_MANIP_MOTOR;
|
||||||
|
|
|
@ -1438,7 +1438,7 @@ D3DMouse CCamera::RetMouseDef(Math::Point pos)
|
||||||
{
|
{
|
||||||
m_mouseDirV = 1.0f - (1.0f-pos.y)/m_mouseMarging;
|
m_mouseDirV = 1.0f - (1.0f-pos.y)/m_mouseMarging;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( m_type == CAMERA_FREE ||
|
if ( m_type == CAMERA_FREE ||
|
||||||
m_type == CAMERA_EDIT ||
|
m_type == CAMERA_EDIT ||
|
||||||
m_type == CAMERA_BACK ||
|
m_type == CAMERA_BACK ||
|
||||||
|
@ -1455,7 +1455,7 @@ D3DMouse CCamera::RetMouseDef(Math::Point pos)
|
||||||
type = D3DMOUSESCROLLL;
|
type = D3DMOUSESCROLLL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( m_type == CAMERA_FREE ||
|
if ( m_type == CAMERA_FREE ||
|
||||||
m_type == CAMERA_EDIT )
|
m_type == CAMERA_EDIT )
|
||||||
{
|
{
|
||||||
|
@ -1535,7 +1535,7 @@ bool CCamera::EventFrameFree(const Event &event)
|
||||||
}
|
}
|
||||||
|
|
||||||
m_terrain->ValidPosition(m_eyePt, 10.0f);
|
m_terrain->ValidPosition(m_eyePt, 10.0f);
|
||||||
|
|
||||||
if ( m_terrain->MoveOnFloor(m_eyePt, true) )
|
if ( m_terrain->MoveOnFloor(m_eyePt, true) )
|
||||||
{
|
{
|
||||||
m_eyePt.y += m_heightEye;
|
m_eyePt.y += m_heightEye;
|
||||||
|
@ -1560,7 +1560,7 @@ bool CCamera::EventFrameFree(const Event &event)
|
||||||
}
|
}
|
||||||
|
|
||||||
SetViewTime(m_eyePt, vLookatPt, event.rTime);
|
SetViewTime(m_eyePt, vLookatPt, event.rTime);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1595,7 +1595,7 @@ bool CCamera::EventFrameEdit(const Event &event)
|
||||||
}
|
}
|
||||||
|
|
||||||
m_terrain->ValidPosition(m_eyePt, 10.0f);
|
m_terrain->ValidPosition(m_eyePt, 10.0f);
|
||||||
|
|
||||||
if ( m_terrain->MoveOnFloor(m_eyePt, false) )
|
if ( m_terrain->MoveOnFloor(m_eyePt, false) )
|
||||||
{
|
{
|
||||||
m_eyePt.y += m_editHeight;
|
m_eyePt.y += m_editHeight;
|
||||||
|
@ -1620,7 +1620,7 @@ bool CCamera::EventFrameEdit(const Event &event)
|
||||||
}
|
}
|
||||||
|
|
||||||
SetViewTime(m_eyePt, vLookatPt, event.rTime);
|
SetViewTime(m_eyePt, vLookatPt, event.rTime);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1762,7 +1762,7 @@ bool CCamera::EventFrameBack(const Event &event)
|
||||||
else vLookatPt.y += 4.0f;
|
else vLookatPt.y += 4.0f;
|
||||||
|
|
||||||
h = -m_cameraObj->RetAngleY(0); // angle vehicle / building
|
h = -m_cameraObj->RetAngleY(0); // angle vehicle / building
|
||||||
|
|
||||||
if ( type == OBJECT_DERRICK ||
|
if ( type == OBJECT_DERRICK ||
|
||||||
type == OBJECT_FACTORY ||
|
type == OBJECT_FACTORY ||
|
||||||
type == OBJECT_REPAIR ||
|
type == OBJECT_REPAIR ||
|
||||||
|
@ -1909,7 +1909,7 @@ bool CCamera::EventFrameExplo(const Event &event)
|
||||||
}
|
}
|
||||||
|
|
||||||
m_terrain->ValidPosition(m_eyePt, 10.0f);
|
m_terrain->ValidPosition(m_eyePt, 10.0f);
|
||||||
|
|
||||||
if ( m_terrain->MoveOnFloor(m_eyePt, false) )
|
if ( m_terrain->MoveOnFloor(m_eyePt, false) )
|
||||||
{
|
{
|
||||||
m_eyePt.y += m_heightEye;
|
m_eyePt.y += m_heightEye;
|
||||||
|
@ -1934,7 +1934,7 @@ bool CCamera::EventFrameExplo(const Event &event)
|
||||||
}
|
}
|
||||||
|
|
||||||
SetViewTime(m_eyePt, vLookatPt, event.rTime);
|
SetViewTime(m_eyePt, vLookatPt, event.rTime);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -170,7 +170,7 @@ CD3DApplication::CD3DApplication()
|
||||||
g_pD3DApp = this;
|
g_pD3DApp = this;
|
||||||
|
|
||||||
// Request event sent by Logitech.
|
// Request event sent by Logitech.
|
||||||
m_mshMouseWheel = RegisterWindowMessage(MSH_MOUSEWHEEL);
|
m_mshMouseWheel = RegisterWindowMessage(MSH_MOUSEWHEEL);
|
||||||
|
|
||||||
_mkdir("files\\");
|
_mkdir("files\\");
|
||||||
}
|
}
|
||||||
|
@ -538,7 +538,7 @@ HRESULT CD3DApplication::Create( HINSTANCE hInst, TCHAR* strCmdLine )
|
||||||
// Register the window class
|
// Register the window class
|
||||||
WNDCLASS wndClass = { 0, WndProc, 0, 0, hInst,
|
WNDCLASS wndClass = { 0, WndProc, 0, 0, hInst,
|
||||||
LoadIcon( hInst, MAKEINTRESOURCE(IDI_MAIN_ICON) ),
|
LoadIcon( hInst, MAKEINTRESOURCE(IDI_MAIN_ICON) ),
|
||||||
LoadCursor( NULL, IDC_ARROW ),
|
LoadCursor( NULL, IDC_ARROW ),
|
||||||
(HBRUSH)GetStockObject(WHITE_BRUSH),
|
(HBRUSH)GetStockObject(WHITE_BRUSH),
|
||||||
NULL, _T("D3D Window") };
|
NULL, _T("D3D Window") };
|
||||||
RegisterClass( &wndClass );
|
RegisterClass( &wndClass );
|
||||||
|
@ -550,7 +550,7 @@ HRESULT CD3DApplication::Create( HINSTANCE hInst, TCHAR* strCmdLine )
|
||||||
//? WS_OVERLAPPEDWINDOW|WS_VISIBLE,
|
//? WS_OVERLAPPEDWINDOW|WS_VISIBLE,
|
||||||
style, CW_USEDEFAULT, CW_USEDEFAULT,
|
style, CW_USEDEFAULT, CW_USEDEFAULT,
|
||||||
WINDOW_DX, WINDOW_DY, 0L,
|
WINDOW_DX, WINDOW_DY, 0L,
|
||||||
//? LoadMenu( hInst, MAKEINTRESOURCE(IDR_MENU) ),
|
//? LoadMenu( hInst, MAKEINTRESOURCE(IDR_MENU) ),
|
||||||
NULL,
|
NULL,
|
||||||
hInst, 0L );
|
hInst, 0L );
|
||||||
UpdateWindow( m_hWnd );
|
UpdateWindow( m_hWnd );
|
||||||
|
@ -738,7 +738,7 @@ void CD3DApplication::SetMousePos(Math::Point pos)
|
||||||
p.x = (int)pos.x;
|
p.x = (int)pos.x;
|
||||||
p.y = (int)pos.y;
|
p.y = (int)pos.y;
|
||||||
ClientToScreen(m_hWnd, &p);
|
ClientToScreen(m_hWnd, &p);
|
||||||
|
|
||||||
SetCursorPos(p.x, p.y);
|
SetCursorPos(p.x, p.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1426,7 +1426,7 @@ LRESULT CD3DApplication::MsgProc( HWND hWnd, UINT uMsg, WPARAM wParam,
|
||||||
return DefWindowProc( hWnd, uMsg, wParam, lParam );
|
return DefWindowProc( hWnd, uMsg, wParam, lParam );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Enumeration function to report valid pixel formats for z-buffers.
|
// Enumeration function to report valid pixel formats for z-buffers.
|
||||||
|
|
||||||
HRESULT WINAPI EnumZBufferFormatsCallback(DDPIXELFORMAT* pddpf,
|
HRESULT WINAPI EnumZBufferFormatsCallback(DDPIXELFORMAT* pddpf,
|
||||||
|
@ -1482,7 +1482,7 @@ HRESULT CD3DApplication::CreateZBuffer(GUID* pDeviceGUID)
|
||||||
ddsd.ddpfPixelFormat.dwRGBBitCount = 16;
|
ddsd.ddpfPixelFormat.dwRGBBitCount = 16;
|
||||||
m_pD3D->EnumZBufferFormats( *pDeviceGUID, EnumZBufferFormatsCallback,
|
m_pD3D->EnumZBufferFormats( *pDeviceGUID, EnumZBufferFormatsCallback,
|
||||||
(VOID*)&ddsd.ddpfPixelFormat );
|
(VOID*)&ddsd.ddpfPixelFormat );
|
||||||
|
|
||||||
if( 0 == ddsd.ddpfPixelFormat.dwSize )
|
if( 0 == ddsd.ddpfPixelFormat.dwSize )
|
||||||
{
|
{
|
||||||
DEBUG_MSG( _T("Device doesn't support requested zbuffer format") );
|
DEBUG_MSG( _T("Device doesn't support requested zbuffer format") );
|
||||||
|
@ -1523,9 +1523,9 @@ HRESULT CD3DApplication::CreateZBuffer(GUID* pDeviceGUID)
|
||||||
HRESULT CD3DApplication::Initialize3DEnvironment()
|
HRESULT CD3DApplication::Initialize3DEnvironment()
|
||||||
{
|
{
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
DDSCAPS2 ddsCaps2;
|
DDSCAPS2 ddsCaps2;
|
||||||
DWORD dwFrameworkFlags = 0L;
|
DWORD dwFrameworkFlags = 0L;
|
||||||
DWORD dwTotal;
|
DWORD dwTotal;
|
||||||
DWORD dwFree;
|
DWORD dwFree;
|
||||||
|
|
||||||
dwFrameworkFlags |= ( !m_pDeviceInfo->bWindowed ? D3DFW_FULLSCREEN : 0L );
|
dwFrameworkFlags |= ( !m_pDeviceInfo->bWindowed ? D3DFW_FULLSCREEN : 0L );
|
||||||
|
@ -1550,9 +1550,9 @@ HRESULT CD3DApplication::Initialize3DEnvironment()
|
||||||
|
|
||||||
// Request the amount of video memory.
|
// Request the amount of video memory.
|
||||||
ZeroMemory(&ddsCaps2, sizeof(ddsCaps2));
|
ZeroMemory(&ddsCaps2, sizeof(ddsCaps2));
|
||||||
ddsCaps2.dwCaps = DDSCAPS_TEXTURE;
|
ddsCaps2.dwCaps = DDSCAPS_TEXTURE;
|
||||||
dwTotal = 0;
|
dwTotal = 0;
|
||||||
hr = m_pDD->GetAvailableVidMem(&ddsCaps2, &dwTotal, &dwFree);
|
hr = m_pDD->GetAvailableVidMem(&ddsCaps2, &dwTotal, &dwFree);
|
||||||
m_vidMemTotal = dwTotal;
|
m_vidMemTotal = dwTotal;
|
||||||
|
|
||||||
// Let the app run its startup code which creates the 3d scene.
|
// Let the app run its startup code which creates the 3d scene.
|
||||||
|
@ -1577,7 +1577,7 @@ HRESULT CD3DApplication::Initialize3DEnvironment()
|
||||||
D3DEnum_SelectDefaultDevice( &m_pDeviceInfo, D3DENUM_SOFTWAREONLY );
|
D3DEnum_SelectDefaultDevice( &m_pDeviceInfo, D3DENUM_SOFTWAREONLY );
|
||||||
return Initialize3DEnvironment();
|
return Initialize3DEnvironment();
|
||||||
}
|
}
|
||||||
|
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1611,7 +1611,7 @@ HRESULT CD3DApplication::Change3DEnvironment()
|
||||||
// Coming from fullscreen mode, so restore window properties
|
// Coming from fullscreen mode, so restore window properties
|
||||||
SetWindowLong( m_hWnd, GWL_STYLE, dwSavedStyle );
|
SetWindowLong( m_hWnd, GWL_STYLE, dwSavedStyle );
|
||||||
SetWindowPos( m_hWnd, HWND_NOTOPMOST, rcSaved.left, rcSaved.top,
|
SetWindowPos( m_hWnd, HWND_NOTOPMOST, rcSaved.left, rcSaved.top,
|
||||||
( rcSaved.right - rcSaved.left ),
|
( rcSaved.right - rcSaved.left ),
|
||||||
( rcSaved.bottom - rcSaved.top ), SWP_SHOWWINDOW );
|
( rcSaved.bottom - rcSaved.top ), SWP_SHOWWINDOW );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1841,7 +1841,7 @@ LRESULT CD3DApplication::OnQuerySuspend( DWORD dwFlags )
|
||||||
|
|
||||||
|
|
||||||
// Called when the app receives a PBT_APMRESUMESUSPEND message, meaning
|
// Called when the app receives a PBT_APMRESUMESUSPEND message, meaning
|
||||||
// the computer has just resumed from a suspended state. At this point,
|
// the computer has just resumed from a suspended state. At this point,
|
||||||
// the app should recover any data, network connections, files, etc..,
|
// the app should recover any data, network connections, files, etc..,
|
||||||
// and resume running from when the app was suspended.
|
// and resume running from when the app was suspended.
|
||||||
|
|
||||||
|
@ -1971,7 +1971,7 @@ VOID CD3DApplication::ShowStats()
|
||||||
// Setup the text buffer to write out dimensions
|
// Setup the text buffer to write out dimensions
|
||||||
TCHAR buffer[100];
|
TCHAR buffer[100];
|
||||||
sprintf( buffer, _T("%7.02f fps T=%d (%dx%dx%d)"), fFPS, t,
|
sprintf( buffer, _T("%7.02f fps T=%d (%dx%dx%d)"), fFPS, t,
|
||||||
m_ddsdRenderTarget.dwWidth, m_ddsdRenderTarget.dwHeight,
|
m_ddsdRenderTarget.dwWidth, m_ddsdRenderTarget.dwHeight,
|
||||||
m_ddsdRenderTarget.ddpfPixelFormat.dwRGBBitCount );
|
m_ddsdRenderTarget.ddpfPixelFormat.dwRGBBitCount );
|
||||||
OutputText( 400, 2, buffer );
|
OutputText( 400, 2, buffer );
|
||||||
|
|
||||||
|
@ -2017,28 +2017,28 @@ VOID CD3DApplication::OutputText( DWORD x, DWORD y, TCHAR* str )
|
||||||
// members within a BITMAPINFOHEADER structure
|
// members within a BITMAPINFOHEADER structure
|
||||||
|
|
||||||
PBITMAPINFO CD3DApplication::CreateBitmapInfoStruct(HBITMAP hBmp)
|
PBITMAPINFO CD3DApplication::CreateBitmapInfoStruct(HBITMAP hBmp)
|
||||||
{
|
{
|
||||||
BITMAP bmp;
|
BITMAP bmp;
|
||||||
PBITMAPINFO pbmi;
|
PBITMAPINFO pbmi;
|
||||||
WORD cClrBits;
|
WORD cClrBits;
|
||||||
|
|
||||||
// Retrieve the bitmap's color format, width, and height.
|
// Retrieve the bitmap's color format, width, and height.
|
||||||
if ( !GetObject(hBmp, sizeof(BITMAP), (LPSTR)&bmp) )
|
if ( !GetObject(hBmp, sizeof(BITMAP), (LPSTR)&bmp) )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
// Convert the color format to a count of bits.
|
// Convert the color format to a count of bits.
|
||||||
cClrBits = (WORD)(bmp.bmPlanes * bmp.bmBitsPixel);
|
cClrBits = (WORD)(bmp.bmPlanes * bmp.bmBitsPixel);
|
||||||
|
|
||||||
if ( cClrBits == 1 ) cClrBits = 1;
|
if ( cClrBits == 1 ) cClrBits = 1;
|
||||||
else if ( cClrBits <= 4 ) cClrBits = 4;
|
else if ( cClrBits <= 4 ) cClrBits = 4;
|
||||||
else if ( cClrBits <= 8 ) cClrBits = 8;
|
else if ( cClrBits <= 8 ) cClrBits = 8;
|
||||||
else if ( cClrBits <= 16 ) cClrBits = 16;
|
else if ( cClrBits <= 16 ) cClrBits = 16;
|
||||||
else if ( cClrBits <= 24 ) cClrBits = 24;
|
else if ( cClrBits <= 24 ) cClrBits = 24;
|
||||||
else cClrBits = 32;
|
else cClrBits = 32;
|
||||||
|
|
||||||
// Allocate memory for the BITMAPINFO structure. (This structure
|
// Allocate memory for the BITMAPINFO structure. (This structure
|
||||||
// contains a BITMAPINFOHEADER structure and an array of RGBQUAD data
|
// contains a BITMAPINFOHEADER structure and an array of RGBQUAD data
|
||||||
// structures.)
|
// structures.)
|
||||||
if ( cClrBits != 24 )
|
if ( cClrBits != 24 )
|
||||||
{
|
{
|
||||||
pbmi = (PBITMAPINFO)LocalAlloc(LPTR,
|
pbmi = (PBITMAPINFO)LocalAlloc(LPTR,
|
||||||
|
@ -2051,7 +2051,7 @@ PBITMAPINFO CD3DApplication::CreateBitmapInfoStruct(HBITMAP hBmp)
|
||||||
pbmi = (PBITMAPINFO)LocalAlloc(LPTR,
|
pbmi = (PBITMAPINFO)LocalAlloc(LPTR,
|
||||||
sizeof(BITMAPINFOHEADER));
|
sizeof(BITMAPINFOHEADER));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialize the fields in the BITMAPINFO structure.
|
// Initialize the fields in the BITMAPINFO structure.
|
||||||
pbmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
|
pbmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
|
||||||
pbmi->bmiHeader.biWidth = bmp.bmWidth;
|
pbmi->bmiHeader.biWidth = bmp.bmWidth;
|
||||||
|
@ -2060,77 +2060,77 @@ PBITMAPINFO CD3DApplication::CreateBitmapInfoStruct(HBITMAP hBmp)
|
||||||
pbmi->bmiHeader.biBitCount = bmp.bmBitsPixel;
|
pbmi->bmiHeader.biBitCount = bmp.bmBitsPixel;
|
||||||
if ( cClrBits < 24 )
|
if ( cClrBits < 24 )
|
||||||
pbmi->bmiHeader.biClrUsed = 2^cClrBits;
|
pbmi->bmiHeader.biClrUsed = 2^cClrBits;
|
||||||
|
|
||||||
// If the bitmap is not compressed, set the BI_RGB flag.
|
// If the bitmap is not compressed, set the BI_RGB flag.
|
||||||
pbmi->bmiHeader.biCompression = BI_RGB;
|
pbmi->bmiHeader.biCompression = BI_RGB;
|
||||||
|
|
||||||
// Compute the number of bytes in the array of color
|
// Compute the number of bytes in the array of color
|
||||||
// indices and store the result in biSizeImage.
|
// indices and store the result in biSizeImage.
|
||||||
pbmi->bmiHeader.biSizeImage = (pbmi->bmiHeader.biWidth + 7) /8
|
pbmi->bmiHeader.biSizeImage = (pbmi->bmiHeader.biWidth + 7) /8
|
||||||
* pbmi->bmiHeader.biHeight
|
* pbmi->bmiHeader.biHeight
|
||||||
* cClrBits;
|
* cClrBits;
|
||||||
|
|
||||||
// Set biClrImportant to 0, indicating that all of the
|
// Set biClrImportant to 0, indicating that all of the
|
||||||
// device colors are important.
|
// device colors are important.
|
||||||
pbmi->bmiHeader.biClrImportant = 0;
|
pbmi->bmiHeader.biClrImportant = 0;
|
||||||
|
|
||||||
return pbmi;
|
return pbmi;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Defines a function that initializes the remaining structures,
|
// Defines a function that initializes the remaining structures,
|
||||||
// retrieves the array of palette indices, opens the file, copies
|
// retrieves the array of palette indices, opens the file, copies
|
||||||
// the data, and closes the file.
|
// the data, and closes the file.
|
||||||
|
|
||||||
bool CD3DApplication::CreateBMPFile(LPTSTR pszFile, PBITMAPINFO pbi, HBITMAP hBMP, HDC hDC)
|
bool CD3DApplication::CreateBMPFile(LPTSTR pszFile, PBITMAPINFO pbi, HBITMAP hBMP, HDC hDC)
|
||||||
{
|
{
|
||||||
FILE* file; // file handle
|
FILE* file; // file handle
|
||||||
BITMAPFILEHEADER hdr; // bitmap file-header
|
BITMAPFILEHEADER hdr; // bitmap file-header
|
||||||
PBITMAPINFOHEADER pbih; // bitmap info-header
|
PBITMAPINFOHEADER pbih; // bitmap info-header
|
||||||
LPBYTE lpBits; // memory pointer
|
LPBYTE lpBits; // memory pointer
|
||||||
DWORD dwTotal; // total count of bytes
|
DWORD dwTotal; // total count of bytes
|
||||||
|
|
||||||
pbih = (PBITMAPINFOHEADER)pbi;
|
pbih = (PBITMAPINFOHEADER)pbi;
|
||||||
lpBits = (LPBYTE)GlobalAlloc(GMEM_FIXED, pbih->biSizeImage);
|
lpBits = (LPBYTE)GlobalAlloc(GMEM_FIXED, pbih->biSizeImage);
|
||||||
if ( !lpBits ) return false;
|
if ( !lpBits ) return false;
|
||||||
|
|
||||||
// Retrieve the color table (RGBQUAD array) and the bits
|
// Retrieve the color table (RGBQUAD array) and the bits
|
||||||
// (array of palette indices) from the DIB.
|
// (array of palette indices) from the DIB.
|
||||||
if ( !GetDIBits(hDC, hBMP, 0, (WORD)pbih->biHeight,
|
if ( !GetDIBits(hDC, hBMP, 0, (WORD)pbih->biHeight,
|
||||||
lpBits, pbi, DIB_RGB_COLORS) )
|
lpBits, pbi, DIB_RGB_COLORS) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Create the .BMP file.
|
// Create the .BMP file.
|
||||||
file = fopen(pszFile, "wb");
|
file = fopen(pszFile, "wb");
|
||||||
if ( file == NULL ) return false;
|
if ( file == NULL ) return false;
|
||||||
|
|
||||||
hdr.bfType = 0x4d42; // 0x42 = "B" 0x4d = "M"
|
hdr.bfType = 0x4d42; // 0x42 = "B" 0x4d = "M"
|
||||||
|
|
||||||
// Compute the size of the entire file.
|
// Compute the size of the entire file.
|
||||||
hdr.bfSize = (DWORD)(sizeof(BITMAPFILEHEADER) +
|
hdr.bfSize = (DWORD)(sizeof(BITMAPFILEHEADER) +
|
||||||
pbih->biSize + pbih->biClrUsed
|
pbih->biSize + pbih->biClrUsed
|
||||||
* sizeof(RGBQUAD) + pbih->biSizeImage);
|
* sizeof(RGBQUAD) + pbih->biSizeImage);
|
||||||
|
|
||||||
hdr.bfReserved1 = 0;
|
hdr.bfReserved1 = 0;
|
||||||
hdr.bfReserved2 = 0;
|
hdr.bfReserved2 = 0;
|
||||||
|
|
||||||
// Compute the offset to the array of color indices.
|
// Compute the offset to the array of color indices.
|
||||||
hdr.bfOffBits = (DWORD)sizeof(BITMAPFILEHEADER) +
|
hdr.bfOffBits = (DWORD)sizeof(BITMAPFILEHEADER) +
|
||||||
pbih->biSize + pbih->biClrUsed
|
pbih->biSize + pbih->biClrUsed
|
||||||
* sizeof (RGBQUAD);
|
* sizeof (RGBQUAD);
|
||||||
|
|
||||||
// Copy the BITMAPFILEHEADER into the .BMP file.
|
// Copy the BITMAPFILEHEADER into the .BMP file.
|
||||||
fwrite(&hdr, sizeof(BITMAPFILEHEADER), 1, file);
|
fwrite(&hdr, sizeof(BITMAPFILEHEADER), 1, file);
|
||||||
|
|
||||||
// Copy the BITMAPINFOHEADER and RGBQUAD array into the file.
|
// Copy the BITMAPINFOHEADER and RGBQUAD array into the file.
|
||||||
fwrite(pbih, sizeof(BITMAPINFOHEADER)+pbih->biClrUsed*sizeof(RGBQUAD), 1, file);
|
fwrite(pbih, sizeof(BITMAPINFOHEADER)+pbih->biClrUsed*sizeof(RGBQUAD), 1, file);
|
||||||
|
|
||||||
// Copy the array of color indices into the .BMP file.
|
// Copy the array of color indices into the .BMP file.
|
||||||
dwTotal = pbih->biSizeImage;
|
dwTotal = pbih->biSizeImage;
|
||||||
fwrite(lpBits, dwTotal, 1, file);
|
fwrite(lpBits, dwTotal, 1, file);
|
||||||
|
|
||||||
// Close the .BMP file.
|
// Close the .BMP file.
|
||||||
fclose(file);
|
fclose(file);
|
||||||
|
|
||||||
// Free memory.
|
// Free memory.
|
||||||
GlobalFree((HGLOBAL)lpBits);
|
GlobalFree((HGLOBAL)lpBits);
|
||||||
return true;
|
return true;
|
||||||
|
@ -2389,7 +2389,7 @@ VOID CD3DApplication::DisplayFrameworkError( HRESULT hr, DWORD dwType )
|
||||||
break;
|
break;
|
||||||
case D3DFWERR_NO3DDEVICE:
|
case D3DFWERR_NO3DDEVICE:
|
||||||
lstrcpy( strMsg, _T("Could not create the Direct3DDevice object.") );
|
lstrcpy( strMsg, _T("Could not create the Direct3DDevice object.") );
|
||||||
|
|
||||||
if( MSGWARN_SWITCHEDTOSOFTWARE == dwType )
|
if( MSGWARN_SWITCHEDTOSOFTWARE == dwType )
|
||||||
lstrcat( strMsg, _T("\nThe 3D hardware chipset may not support"
|
lstrcat( strMsg, _T("\nThe 3D hardware chipset may not support"
|
||||||
"\nrendering in the current display mode.") );
|
"\nrendering in the current display mode.") );
|
||||||
|
|
|
@ -205,7 +205,7 @@ CD3DEngine::CD3DEngine(CInstanceManager *iMan, CD3DApplication *app)
|
||||||
m_bForceStateColor = false;
|
m_bForceStateColor = false;
|
||||||
m_bStateColor = false;
|
m_bStateColor = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_blackSrcBlend[0] = 0;
|
m_blackSrcBlend[0] = 0;
|
||||||
m_blackDestBlend[0] = 0;
|
m_blackDestBlend[0] = 0;
|
||||||
m_whiteSrcBlend[0] = 0;
|
m_whiteSrcBlend[0] = 0;
|
||||||
|
@ -1294,8 +1294,8 @@ int CD3DEngine::RetTotalTriangles(int objRank)
|
||||||
return m_objectParam[objRank].totalTriangle;
|
return m_objectParam[objRank].totalTriangle;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return qq triangles of an object.
|
// Return qq triangles of an object.
|
||||||
// qq triangles used to extract an object that explodes.
|
// qq triangles used to extract an object that explodes.
|
||||||
// "Percent" is between 0 and 1.
|
// "Percent" is between 0 and 1.
|
||||||
|
|
||||||
int CD3DEngine::GetTriangles(int objRank, float min, float max,
|
int CD3DEngine::GetTriangles(int objRank, float min, float max,
|
||||||
|
@ -1489,7 +1489,7 @@ bool CD3DEngine::ChangeTextureMapping(int objRank,
|
||||||
// [p] = distance in the 3D world
|
// [p] = distance in the 3D world
|
||||||
// [t] = position in the texture (pixels)
|
// [t] = position in the texture (pixels)
|
||||||
|
|
||||||
// ^ y 5
|
// ^ y 5
|
||||||
// | 6 o---------o 4
|
// | 6 o---------o 4
|
||||||
// | / \
|
// | / \
|
||||||
// | o o
|
// | o o
|
||||||
|
@ -2166,7 +2166,7 @@ void CD3DEngine::ShadowDelete(int objRank)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Specifies if the shadow is visible.
|
// Specifies if the shadow is visible.
|
||||||
// For example, when an object is carried, he has no shadow.
|
// For example, when an object is carried, he has no shadow.
|
||||||
|
|
||||||
bool CD3DEngine::SetObjectShadowHide(int objRank, bool bHide)
|
bool CD3DEngine::SetObjectShadowHide(int objRank, bool bHide)
|
||||||
|
@ -3632,7 +3632,7 @@ D3DCOLORVALUE GetDot(DDSURFACEDESC2* ddsd, int x, int y)
|
||||||
// 0 | 1 2 253 254|255
|
// 0 | 1 2 253 254|255
|
||||||
// |---|---|---|-- ... --|---|---|---|
|
// |---|---|---|-- ... --|---|---|---|
|
||||||
//
|
//
|
||||||
// So we draw in 254x254 pixels surfaces.
|
// So we draw in 254x254 pixels surfaces.
|
||||||
// The pixel margin around it is drawn twice (in two adjacent surfaces),
|
// The pixel margin around it is drawn twice (in two adjacent surfaces),
|
||||||
// so that the filter produces the same results!
|
// so that the filter produces the same results!
|
||||||
|
|
||||||
|
@ -3655,7 +3655,7 @@ void CD3DEngine::RenderGroundSpot()
|
||||||
m_groundMark.drawPos.z == m_groundMark.pos.z &&
|
m_groundMark.drawPos.z == m_groundMark.pos.z &&
|
||||||
m_groundMark.drawRadius == m_groundMark.radius &&
|
m_groundMark.drawRadius == m_groundMark.radius &&
|
||||||
m_groundMark.drawIntensity == m_groundMark.intensity ) return;
|
m_groundMark.drawIntensity == m_groundMark.intensity ) return;
|
||||||
|
|
||||||
for ( s=0 ; s<16 ; s++ )
|
for ( s=0 ; s<16 ; s++ )
|
||||||
{
|
{
|
||||||
min.x = (s%4)*254.0f-1.0f; // 1 pixel cover
|
min.x = (s%4)*254.0f-1.0f; // 1 pixel cover
|
||||||
|
@ -3716,7 +3716,7 @@ void CD3DEngine::RenderGroundSpot()
|
||||||
{
|
{
|
||||||
bSet = true;
|
bSet = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( bClear || bSet )
|
if ( bClear || bSet )
|
||||||
{
|
{
|
||||||
// Load the song.
|
// Load the song.
|
||||||
|
@ -4120,7 +4120,7 @@ void CD3DEngine::DrawShadow()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Called ounces per frame, the call is the entry point for 3d rendering.
|
// Called ounces per frame, the call is the entry point for 3d rendering.
|
||||||
// This function sets up render states, clears the
|
// This function sets up render states, clears the
|
||||||
// viewport, and renders the scene.
|
// viewport, and renders the scene.
|
||||||
|
|
||||||
|
@ -4642,7 +4642,7 @@ void CD3DEngine::DrawBackgroundGradient(D3DCOLOR up, D3DCOLOR down)
|
||||||
m_pD3DDevice->DrawPrimitive(D3DPT_TRIANGLESTRIP, D3DFVF_LVERTEX, vertex, 4, NULL);
|
m_pD3DDevice->DrawPrimitive(D3DPT_TRIANGLESTRIP, D3DFVF_LVERTEX, vertex, 4, NULL);
|
||||||
AddStatisticTriangle(2);
|
AddStatisticTriangle(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draws a portion of the image background.
|
// Draws a portion of the image background.
|
||||||
|
|
||||||
void CD3DEngine::DrawBackgroundImageQuarter(Math::Point p1, Math::Point p2, char *name)
|
void CD3DEngine::DrawBackgroundImageQuarter(Math::Point p1, Math::Point p2, char *name)
|
||||||
|
@ -4947,7 +4947,7 @@ bool CD3DEngine::GetBBox2D(int objRank, Math::Point &min, Math::Point &max)
|
||||||
if ( pp.y > max.y ) max.y = pp.y;
|
if ( pp.y > max.y ) max.y = pp.y;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( min.x == 1000000.0f ||
|
if ( min.x == 1000000.0f ||
|
||||||
min.y == 1000000.0f ||
|
min.y == 1000000.0f ||
|
||||||
max.x == -1000000.0f ||
|
max.x == -1000000.0f ||
|
||||||
|
@ -5034,7 +5034,7 @@ bool CD3DEngine::GetSpriteCoord(int &x, int &y)
|
||||||
v.y *= vp.dwHeight/2;
|
v.y *= vp.dwHeight/2;
|
||||||
v.x = v.x+vp.dwWidth/2;
|
v.x = v.x+vp.dwWidth/2;
|
||||||
v.y = vp.dwHeight-(v.y+vp.dwHeight/2);
|
v.y = vp.dwHeight-(v.y+vp.dwHeight/2);
|
||||||
|
|
||||||
x = (int)v.x;
|
x = (int)v.x;
|
||||||
y = (int)v.y;
|
y = (int)v.y;
|
||||||
return true;
|
return true;
|
||||||
|
@ -5435,7 +5435,7 @@ float CD3DEngine::RetFocus()
|
||||||
return m_focus;
|
return m_focus;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
||||||
void CD3DEngine::UpdateMatProj()
|
void CD3DEngine::UpdateMatProj()
|
||||||
{
|
{
|
||||||
|
@ -5544,7 +5544,7 @@ HRESULT CD3DEngine::InitDeviceObjects()
|
||||||
m_matProjInterface.Set(4, 3, 1.0f);
|
m_matProjInterface.Set(4, 3, 1.0f);
|
||||||
m_matProjInterface.Set(3, 4, -1.0f);
|
m_matProjInterface.Set(3, 4, -1.0f);
|
||||||
m_matProjInterface.Set(4, 4, 0.0f);
|
m_matProjInterface.Set(4, 4, 0.0f);
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5576,7 +5576,7 @@ HRESULT CD3DEngine::FinalCleanup()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Overrrides the main WndProc, so the sample can do custom message
|
// Overrrides the main WndProc, so the sample can do custom message
|
||||||
// handling (e.g. processing mouse, keyboard, or menu commands).
|
// handling (e.g. processing mouse, keyboard, or menu commands).
|
||||||
|
|
||||||
LRESULT CD3DEngine::MsgProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
|
LRESULT CD3DEngine::MsgProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
|
||||||
|
|
|
@ -352,7 +352,7 @@ public:
|
||||||
bool GroundMarkDelete(int rank);
|
bool GroundMarkDelete(int rank);
|
||||||
|
|
||||||
void Update();
|
void Update();
|
||||||
|
|
||||||
void SetViewParams(const Math::Vector &vEyePt, const Math::Vector &vLookatPt, const Math::Vector &vUpVec, FLOAT fEyeDistance);
|
void SetViewParams(const Math::Vector &vEyePt, const Math::Vector &vLookatPt, const Math::Vector &vUpVec, FLOAT fEyeDistance);
|
||||||
|
|
||||||
bool FreeTexture(char* name);
|
bool FreeTexture(char* name);
|
||||||
|
|
|
@ -212,7 +212,7 @@ static bool WINAPI DriverEnumCallback( GUID* pGUID, TCHAR* strDesc,
|
||||||
LPDIRECTDRAW7 pDD;
|
LPDIRECTDRAW7 pDD;
|
||||||
LPDIRECT3D7 pD3D;
|
LPDIRECT3D7 pD3D;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
// Use the GUID to create the DirectDraw object
|
// Use the GUID to create the DirectDraw object
|
||||||
hr = DirectDrawCreateEx( pGUID, (VOID**)&pDD, IID_IDirectDraw7, NULL );
|
hr = DirectDrawCreateEx( pGUID, (VOID**)&pDD, IID_IDirectDraw7, NULL );
|
||||||
if( FAILED(hr) )
|
if( FAILED(hr) )
|
||||||
|
@ -280,7 +280,7 @@ HRESULT D3DEnum_EnumerateDevices( HRESULT (*AppConfirmFn)(DDCAPS*, D3DDEVICEDESC
|
||||||
g_fnAppConfirmFn = AppConfirmFn;
|
g_fnAppConfirmFn = AppConfirmFn;
|
||||||
|
|
||||||
// Enumerate drivers, devices, and modes
|
// Enumerate drivers, devices, and modes
|
||||||
DirectDrawEnumerateEx( DriverEnumCallback, NULL,
|
DirectDrawEnumerateEx( DriverEnumCallback, NULL,
|
||||||
DDENUM_ATTACHEDSECONDARYDEVICES |
|
DDENUM_ATTACHEDSECONDARYDEVICES |
|
||||||
DDENUM_DETACHEDSECONDARYDEVICES |
|
DDENUM_DETACHEDSECONDARYDEVICES |
|
||||||
DDENUM_NONDISPLAYDEVICES );
|
DDENUM_NONDISPLAYDEVICES );
|
||||||
|
@ -370,7 +370,7 @@ static VOID UpdateDialogControls( HWND hDlg, D3DEnum_DeviceInfo* pCurrentDevice,
|
||||||
|
|
||||||
// Add device name to the combo box
|
// Add device name to the combo box
|
||||||
DWORD dwItem = ComboBox_AddString( hwndDevice, pDevice->strDesc );
|
DWORD dwItem = ComboBox_AddString( hwndDevice, pDevice->strDesc );
|
||||||
|
|
||||||
// Set the remaining UI states for the current device
|
// Set the remaining UI states for the current device
|
||||||
if( pDevice == pCurrentDevice )
|
if( pDevice == pCurrentDevice )
|
||||||
{
|
{
|
||||||
|
@ -383,7 +383,7 @@ static VOID UpdateDialogControls( HWND hDlg, D3DEnum_DeviceInfo* pCurrentDevice,
|
||||||
EnableWindow( hwndWindowed, pDevice->bDesktopCompatible );
|
EnableWindow( hwndWindowed, pDevice->bDesktopCompatible );
|
||||||
Button_SetCheck( hwndWindowed, bWindowed );
|
Button_SetCheck( hwndWindowed, bWindowed );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Enable/set the stereo checkbox, as appropriate
|
// Enable/set the stereo checkbox, as appropriate
|
||||||
if( hwndStereo )
|
if( hwndStereo )
|
||||||
{
|
{
|
||||||
|
@ -436,7 +436,7 @@ static VOID UpdateDialogControls( HWND hDlg, D3DEnum_DeviceInfo* pCurrentDevice,
|
||||||
// Name: ChangeDeviceProc()
|
// Name: ChangeDeviceProc()
|
||||||
// Desc: Windows message handling function for the device select dialog
|
// Desc: Windows message handling function for the device select dialog
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
static INT_PTR CALLBACK ChangeDeviceProc( HWND hDlg, UINT uiMsg, WPARAM wParam,
|
static INT_PTR CALLBACK ChangeDeviceProc( HWND hDlg, UINT uiMsg, WPARAM wParam,
|
||||||
LPARAM lParam )
|
LPARAM lParam )
|
||||||
{
|
{
|
||||||
static D3DEnum_DeviceInfo** ppDeviceArg;
|
static D3DEnum_DeviceInfo** ppDeviceArg;
|
||||||
|
@ -453,7 +453,7 @@ static INT_PTR CALLBACK ChangeDeviceProc( HWND hDlg, UINT uiMsg, WPARAM wParam,
|
||||||
// Handle the initialization message
|
// Handle the initialization message
|
||||||
if( WM_INITDIALOG == uiMsg )
|
if( WM_INITDIALOG == uiMsg )
|
||||||
{
|
{
|
||||||
// Get the app's current device, passed in as an lParam argument
|
// Get the app's current device, passed in as an lParam argument
|
||||||
ppDeviceArg = (D3DEnum_DeviceInfo**)lParam;
|
ppDeviceArg = (D3DEnum_DeviceInfo**)lParam;
|
||||||
if( NULL == ppDeviceArg )
|
if( NULL == ppDeviceArg )
|
||||||
return false;
|
return false;
|
||||||
|
@ -484,7 +484,7 @@ static INT_PTR CALLBACK ChangeDeviceProc( HWND hDlg, UINT uiMsg, WPARAM wParam,
|
||||||
bool bStereo = hwndStereo ? Button_GetCheck( hwndStereo ) : 0;
|
bool bStereo = hwndStereo ? Button_GetCheck( hwndStereo ) : 0;
|
||||||
|
|
||||||
D3DEnum_DeviceInfo* pDevice = &pDeviceList[dwDevice];
|
D3DEnum_DeviceInfo* pDevice = &pDeviceList[dwDevice];
|
||||||
|
|
||||||
if( IDOK == LOWORD(wParam) )
|
if( IDOK == LOWORD(wParam) )
|
||||||
{
|
{
|
||||||
// Handle the case when the user hits the OK button. Check if any
|
// Handle the case when the user hits the OK button. Check if any
|
||||||
|
@ -608,7 +608,7 @@ HRESULT D3DEnum_SelectDefaultDevice( D3DEnum_DeviceInfo** ppDevice,
|
||||||
else
|
else
|
||||||
return D3DENUMERR_NOCOMPATIBLEDEVICES;
|
return D3DENUMERR_NOCOMPATIBLEDEVICES;
|
||||||
|
|
||||||
// Set the windowed state of the newly selected device
|
// Set the windowed state of the newly selected device
|
||||||
(*ppDevice)->bWindowed = true;
|
(*ppDevice)->bWindowed = true;
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
|
|
|
@ -41,11 +41,11 @@ CD3DFramework7::CD3DFramework7()
|
||||||
m_bIsStereo = false;
|
m_bIsStereo = false;
|
||||||
m_dwRenderWidth = 0L;
|
m_dwRenderWidth = 0L;
|
||||||
m_dwRenderHeight = 0L;
|
m_dwRenderHeight = 0L;
|
||||||
|
|
||||||
m_pddsFrontBuffer = NULL;
|
m_pddsFrontBuffer = NULL;
|
||||||
m_pddsBackBuffer = NULL;
|
m_pddsBackBuffer = NULL;
|
||||||
m_pddsBackBufferLeft = NULL;
|
m_pddsBackBufferLeft = NULL;
|
||||||
|
|
||||||
m_pddsZBuffer = NULL;
|
m_pddsZBuffer = NULL;
|
||||||
m_pd3dDevice = NULL;
|
m_pd3dDevice = NULL;
|
||||||
m_pDD = NULL;
|
m_pDD = NULL;
|
||||||
|
@ -124,7 +124,7 @@ HRESULT CD3DFramework7::Initialize( HWND hWnd, GUID* pDriverGUID,
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
// Check params. Note: A NULL mode is valid for windowed modes only.
|
// Check params. Note: A NULL mode is valid for windowed modes only.
|
||||||
if( ( NULL==hWnd ) || ( NULL==pDeviceGUID ) ||
|
if( ( NULL==hWnd ) || ( NULL==pDeviceGUID ) ||
|
||||||
( NULL==pMode && (dwFlags&D3DFW_FULLSCREEN) ) )
|
( NULL==pMode && (dwFlags&D3DFW_FULLSCREEN) ) )
|
||||||
return E_INVALIDARG;
|
return E_INVALIDARG;
|
||||||
|
|
||||||
|
@ -491,7 +491,7 @@ HRESULT CD3DFramework7::CreateZBuffer( GUID* pDeviceGUID )
|
||||||
ddsd.ddpfPixelFormat.dwRGBBitCount = 16;
|
ddsd.ddpfPixelFormat.dwRGBBitCount = 16;
|
||||||
m_pD3D->EnumZBufferFormats( *pDeviceGUID, EnumZBufferFormatsCallback,
|
m_pD3D->EnumZBufferFormats( *pDeviceGUID, EnumZBufferFormatsCallback,
|
||||||
(VOID*)&ddsd.ddpfPixelFormat );
|
(VOID*)&ddsd.ddpfPixelFormat );
|
||||||
|
|
||||||
if( 0 == ddsd.ddpfPixelFormat.dwSize )
|
if( 0 == ddsd.ddpfPixelFormat.dwSize )
|
||||||
{
|
{
|
||||||
DEBUG_MSG( _T("Device doesn't support requested zbuffer format") );
|
DEBUG_MSG( _T("Device doesn't support requested zbuffer format") );
|
||||||
|
|
|
@ -43,9 +43,9 @@ VOID D3DMath_MatrixMultiply( D3DMATRIX& q, D3DMATRIX& a, D3DMATRIX& b )
|
||||||
|
|
||||||
ZeroMemory( pM, sizeof(D3DMATRIX) );
|
ZeroMemory( pM, sizeof(D3DMATRIX) );
|
||||||
|
|
||||||
for( WORD i=0; i<4; i++ )
|
for( WORD i=0; i<4; i++ )
|
||||||
for( WORD j=0; j<4; j++ )
|
for( WORD j=0; j<4; j++ )
|
||||||
for( WORD k=0; k<4; k++ )
|
for( WORD k=0; k<4; k++ )
|
||||||
pM[4*i+j] += pA[4*i+k] * pB[4*k+j];
|
pM[4*i+j] += pA[4*i+k] * pB[4*k+j];
|
||||||
|
|
||||||
memcpy( &q, pM, sizeof(D3DMATRIX) );
|
memcpy( &q, pM, sizeof(D3DMATRIX) );
|
||||||
|
@ -107,7 +107,7 @@ HRESULT D3DMath_VectorMatrixMultiply( D3DVECTOR& vDest, D3DVECTOR& vSrc,
|
||||||
FLOAT y = vSrc.x*mat._12 + vSrc.y*mat._22 + vSrc.z* mat._32 + mat._42;
|
FLOAT y = vSrc.x*mat._12 + vSrc.y*mat._22 + vSrc.z* mat._32 + mat._42;
|
||||||
FLOAT z = vSrc.x*mat._13 + vSrc.y*mat._23 + vSrc.z* mat._33 + mat._43;
|
FLOAT z = vSrc.x*mat._13 + vSrc.y*mat._23 + vSrc.z* mat._33 + mat._43;
|
||||||
FLOAT w = vSrc.x*mat._14 + vSrc.y*mat._24 + vSrc.z* mat._34 + mat._44;
|
FLOAT w = vSrc.x*mat._14 + vSrc.y*mat._24 + vSrc.z* mat._34 + mat._44;
|
||||||
|
|
||||||
if( fabs( w ) < g_EPSILON )
|
if( fabs( w ) < g_EPSILON )
|
||||||
return E_INVALIDARG;
|
return E_INVALIDARG;
|
||||||
|
|
||||||
|
@ -167,7 +167,7 @@ VOID D3DMath_QuaternionFromRotation( FLOAT& x, FLOAT& y, FLOAT& z, FLOAT& w,
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
VOID D3DMath_RotationFromQuaternion( D3DVECTOR& v, FLOAT& fTheta,
|
VOID D3DMath_RotationFromQuaternion( D3DVECTOR& v, FLOAT& fTheta,
|
||||||
FLOAT x, FLOAT y, FLOAT z, FLOAT w )
|
FLOAT x, FLOAT y, FLOAT z, FLOAT w )
|
||||||
|
|
||||||
{
|
{
|
||||||
fTheta = acosf(w) * 2.0f;
|
fTheta = acosf(w) * 2.0f;
|
||||||
v.x = x / sinf( fTheta/2.0f );
|
v.x = x / sinf( fTheta/2.0f );
|
||||||
|
@ -184,7 +184,7 @@ VOID D3DMath_RotationFromQuaternion( D3DVECTOR& v, FLOAT& fTheta,
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
VOID D3DMath_QuaternionFromAngles( FLOAT& x, FLOAT& y, FLOAT& z, FLOAT& w,
|
VOID D3DMath_QuaternionFromAngles( FLOAT& x, FLOAT& y, FLOAT& z, FLOAT& w,
|
||||||
FLOAT fYaw, FLOAT fPitch, FLOAT fRoll )
|
FLOAT fYaw, FLOAT fPitch, FLOAT fRoll )
|
||||||
|
|
||||||
{
|
{
|
||||||
FLOAT fSinYaw = sinf( fYaw/2.0f );
|
FLOAT fSinYaw = sinf( fYaw/2.0f );
|
||||||
FLOAT fSinPitch = sinf( fPitch/2.0f );
|
FLOAT fSinPitch = sinf( fPitch/2.0f );
|
||||||
|
@ -212,8 +212,8 @@ VOID D3DMath_MatrixFromQuaternion( D3DMATRIX& mat, FLOAT x, FLOAT y, FLOAT z,
|
||||||
FLOAT xx = x*x; FLOAT yy = y*y; FLOAT zz = z*z;
|
FLOAT xx = x*x; FLOAT yy = y*y; FLOAT zz = z*z;
|
||||||
FLOAT xy = x*y; FLOAT xz = x*z; FLOAT yz = y*z;
|
FLOAT xy = x*y; FLOAT xz = x*z; FLOAT yz = y*z;
|
||||||
FLOAT wx = w*x; FLOAT wy = w*y; FLOAT wz = w*z;
|
FLOAT wx = w*x; FLOAT wy = w*y; FLOAT wz = w*z;
|
||||||
|
|
||||||
mat._11 = 1 - 2 * ( yy + zz );
|
mat._11 = 1 - 2 * ( yy + zz );
|
||||||
mat._12 = 2 * ( xy - wz );
|
mat._12 = 2 * ( xy - wz );
|
||||||
mat._13 = 2 * ( xz + wy );
|
mat._13 = 2 * ( xz + wy );
|
||||||
|
|
||||||
|
@ -257,8 +257,8 @@ VOID D3DMath_QuaternionFromMatrix( FLOAT& x, FLOAT& y, FLOAT& z, FLOAT& w,
|
||||||
FLOAT xx = x*x; FLOAT yy = y*y; FLOAT zz = z*z;
|
FLOAT xx = x*x; FLOAT yy = y*y; FLOAT zz = z*z;
|
||||||
FLOAT xy = x*y; FLOAT xz = x*z; FLOAT yz = y*z;
|
FLOAT xy = x*y; FLOAT xz = x*z; FLOAT yz = y*z;
|
||||||
FLOAT wx = w*x; FLOAT wy = w*y; FLOAT wz = w*z;
|
FLOAT wx = w*x; FLOAT wy = w*y; FLOAT wz = w*z;
|
||||||
|
|
||||||
mat._11 = 1 - 2 * ( yy + zz );
|
mat._11 = 1 - 2 * ( yy + zz );
|
||||||
mat._12 = 2 * ( xy - wz );
|
mat._12 = 2 * ( xy - wz );
|
||||||
mat._13 = 2 * ( xz + wy );
|
mat._13 = 2 * ( xz + wy );
|
||||||
|
|
||||||
|
@ -311,7 +311,7 @@ VOID D3DMath_QuaternionSlerp( FLOAT& Qx, FLOAT& Qy, FLOAT& Qz, FLOAT& Qw,
|
||||||
FLOAT fCosTheta = Ax*Bx + Ay*By + Az*Bz + Aw*Bw;
|
FLOAT fCosTheta = Ax*Bx + Ay*By + Az*Bz + Aw*Bw;
|
||||||
|
|
||||||
// Check angle to see if quaternions are in opposite hemispheres
|
// Check angle to see if quaternions are in opposite hemispheres
|
||||||
if( fCosTheta < 0.0f )
|
if( fCosTheta < 0.0f )
|
||||||
{
|
{
|
||||||
// If so, flip one of the quaterions
|
// If so, flip one of the quaterions
|
||||||
fCosTheta = -fCosTheta;
|
fCosTheta = -fCosTheta;
|
||||||
|
@ -321,12 +321,12 @@ VOID D3DMath_QuaternionSlerp( FLOAT& Qx, FLOAT& Qy, FLOAT& Qz, FLOAT& Qw,
|
||||||
// Set factors to do linear interpolation, as a special case where the
|
// Set factors to do linear interpolation, as a special case where the
|
||||||
// quaternions are close together.
|
// quaternions are close together.
|
||||||
FLOAT fBeta = 1.0f - fAlpha;
|
FLOAT fBeta = 1.0f - fAlpha;
|
||||||
|
|
||||||
// If the quaternions aren't close, proceed with spherical interpolation
|
// If the quaternions aren't close, proceed with spherical interpolation
|
||||||
if( 1.0f - fCosTheta > 0.001f )
|
if( 1.0f - fCosTheta > 0.001f )
|
||||||
{
|
{
|
||||||
FLOAT fTheta = acosf( fCosTheta );
|
FLOAT fTheta = acosf( fCosTheta );
|
||||||
|
|
||||||
fBeta = sinf( fTheta*fBeta ) / sinf( fTheta);
|
fBeta = sinf( fTheta*fBeta ) / sinf( fTheta);
|
||||||
fAlpha = sinf( fTheta*fAlpha ) / sinf( fTheta);
|
fAlpha = sinf( fTheta*fAlpha ) / sinf( fTheta);
|
||||||
}
|
}
|
||||||
|
|
|
@ -347,7 +347,7 @@ HRESULT TextureContainer::LoadBitmapFile( TCHAR* strPathname )
|
||||||
LR_LOADFROMFILE|LR_CREATEDIBSECTION );
|
LR_LOADFROMFILE|LR_CREATEDIBSECTION );
|
||||||
if( m_hbmBitmap )
|
if( m_hbmBitmap )
|
||||||
return S_OK;
|
return S_OK;
|
||||||
|
|
||||||
return DDERR_NOTFOUND;
|
return DDERR_NOTFOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -381,7 +381,7 @@ HRESULT TextureContainer::LoadTargaFile( TCHAR* strMetaname, TCHAR* strFilename
|
||||||
g_metafile.Read(&tga, sizeof(TargaHeader));
|
g_metafile.Read(&tga, sizeof(TargaHeader));
|
||||||
|
|
||||||
// Only true color, non-mapped images are supported
|
// Only true color, non-mapped images are supported
|
||||||
if( ( 0 != tga.ColormapType ) ||
|
if( ( 0 != tga.ColormapType ) ||
|
||||||
( tga.ImageType != 10 && tga.ImageType != 2 ) )
|
( tga.ImageType != 10 && tga.ImageType != 2 ) )
|
||||||
{
|
{
|
||||||
g_metafile.Close();
|
g_metafile.Close();
|
||||||
|
@ -478,7 +478,7 @@ HRESULT TextureContainer::LoadTargaFile( TCHAR* strMetaname, TCHAR* strFilename
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -852,7 +852,7 @@ HRESULT TextureContainer::CopyRGBADataToSurface()
|
||||||
else
|
else
|
||||||
pDstData16[x] = (WORD)(dr+dg+db+da);
|
pDstData16[x] = (WORD)(dr+dg+db+da);
|
||||||
}
|
}
|
||||||
|
|
||||||
pBytes += ddsd.lPitch;
|
pBytes += ddsd.lPitch;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -935,7 +935,7 @@ HRESULT D3DTextr_CreateTextureFromFile( TCHAR* strName, DWORD dwStage,
|
||||||
// Desc: Creates an empty texture.
|
// Desc: Creates an empty texture.
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
HRESULT D3DTextr_CreateEmptyTexture( TCHAR* strName, DWORD dwWidth,
|
HRESULT D3DTextr_CreateEmptyTexture( TCHAR* strName, DWORD dwWidth,
|
||||||
DWORD dwHeight, DWORD dwStage,
|
DWORD dwHeight, DWORD dwStage,
|
||||||
DWORD dwFlags )
|
DWORD dwFlags )
|
||||||
{
|
{
|
||||||
// Check parameters
|
// Check parameters
|
||||||
|
|
|
@ -29,8 +29,8 @@
|
||||||
|
|
||||||
// Global variables.
|
// Global variables.
|
||||||
|
|
||||||
LPDIRECTINPUT7 g_pDI = NULL;
|
LPDIRECTINPUT7 g_pDI = NULL;
|
||||||
LPDIRECTINPUTDEVICE2 g_pJoystick = NULL;
|
LPDIRECTINPUTDEVICE2 g_pJoystick = NULL;
|
||||||
DIDEVCAPS g_diDevCaps;
|
DIDEVCAPS g_diDevCaps;
|
||||||
|
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ bool CALLBACK EnumJoysticksCallback( const DIDEVICEINSTANCE* pdidInstance,
|
||||||
|
|
||||||
// If it failed, then we can't use this joystick. (Maybe the user unplugged
|
// If it failed, then we can't use this joystick. (Maybe the user unplugged
|
||||||
// it while we were in the middle of enumerating it.)
|
// it while we were in the middle of enumerating it.)
|
||||||
if( FAILED(hr) )
|
if( FAILED(hr) )
|
||||||
return DIENUM_CONTINUE;
|
return DIENUM_CONTINUE;
|
||||||
|
|
||||||
|
|
||||||
|
@ -66,14 +66,14 @@ bool CALLBACK EnumJoysticksCallback( const DIDEVICEINSTANCE* pdidInstance,
|
||||||
bool CALLBACK EnumAxesCallback( const DIDEVICEOBJECTINSTANCE* pdidoi,
|
bool CALLBACK EnumAxesCallback( const DIDEVICEOBJECTINSTANCE* pdidoi,
|
||||||
VOID* pContext )
|
VOID* pContext )
|
||||||
{
|
{
|
||||||
DIPROPRANGE diprg;
|
DIPROPRANGE diprg;
|
||||||
diprg.diph.dwSize = sizeof(DIPROPRANGE);
|
diprg.diph.dwSize = sizeof(DIPROPRANGE);
|
||||||
diprg.diph.dwHeaderSize = sizeof(DIPROPHEADER);
|
diprg.diph.dwHeaderSize = sizeof(DIPROPHEADER);
|
||||||
diprg.diph.dwHow = DIPH_BYOFFSET;
|
diprg.diph.dwHow = DIPH_BYOFFSET;
|
||||||
diprg.diph.dwObj = pdidoi->dwOfs; // Specify the enumerated axis
|
diprg.diph.dwObj = pdidoi->dwOfs; // Specify the enumerated axis
|
||||||
diprg.lMin = -1000;
|
diprg.lMin = -1000;
|
||||||
diprg.lMax = +1000;
|
diprg.lMax = +1000;
|
||||||
|
|
||||||
// Set the range for the axis
|
// Set the range for the axis
|
||||||
if( FAILED( g_pJoystick->SetProperty( DIPROP_RANGE, &diprg.diph ) ) )
|
if( FAILED( g_pJoystick->SetProperty( DIPROP_RANGE, &diprg.diph ) ) )
|
||||||
return DIENUM_STOP;
|
return DIENUM_STOP;
|
||||||
|
@ -136,12 +136,12 @@ bool InitDirectInput(HINSTANCE hInst, HWND hWnd)
|
||||||
// Make sure we got a joystick
|
// Make sure we got a joystick
|
||||||
if( NULL == g_pJoystick )
|
if( NULL == g_pJoystick )
|
||||||
{
|
{
|
||||||
//? MessageBox( NULL, "Joystick not found", "DInput Sample",
|
//? MessageBox( NULL, "Joystick not found", "DInput Sample",
|
||||||
//? MB_ICONERROR | MB_OK );
|
//? MB_ICONERROR | MB_OK );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the data format to "simple joystick" - a predefined data format
|
// Set the data format to "simple joystick" - a predefined data format
|
||||||
//
|
//
|
||||||
// A data format specifies which controls on a device we are interested in,
|
// A data format specifies which controls on a device we are interested in,
|
||||||
// and how they should be reported. This tells DInput that we will be
|
// and how they should be reported. This tells DInput that we will be
|
||||||
|
@ -189,7 +189,7 @@ bool UpdateInputState( DIJOYSTATE &js )
|
||||||
{
|
{
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
if ( g_pJoystick )
|
if ( g_pJoystick )
|
||||||
{
|
{
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
@ -212,7 +212,7 @@ bool UpdateInputState( DIJOYSTATE &js )
|
||||||
}
|
}
|
||||||
while ( DIERR_INPUTLOST == hr );
|
while ( DIERR_INPUTLOST == hr );
|
||||||
if ( FAILED(hr) ) return false;
|
if ( FAILED(hr) ) return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -222,9 +222,9 @@ bool UpdateInputState( DIJOYSTATE &js )
|
||||||
bool FreeDirectInput()
|
bool FreeDirectInput()
|
||||||
{
|
{
|
||||||
// Unacquire and release any DirectInputDevice objects.
|
// Unacquire and release any DirectInputDevice objects.
|
||||||
if( NULL != g_pJoystick )
|
if( NULL != g_pJoystick )
|
||||||
{
|
{
|
||||||
// Unacquire the device one last time just in case
|
// Unacquire the device one last time just in case
|
||||||
// the app tried to exit while the device is still acquired.
|
// the app tried to exit while the device is still acquired.
|
||||||
g_pJoystick->Unacquire();
|
g_pJoystick->Unacquire();
|
||||||
g_pJoystick->Release();
|
g_pJoystick->Release();
|
||||||
|
@ -233,7 +233,7 @@ bool FreeDirectInput()
|
||||||
|
|
||||||
|
|
||||||
// Release any DirectInput objects.
|
// Release any DirectInput objects.
|
||||||
if( g_pDI )
|
if( g_pDI )
|
||||||
{
|
{
|
||||||
g_pDI->Release();
|
g_pDI->Release();
|
||||||
g_pDI = NULL;
|
g_pDI = NULL;
|
||||||
|
|
|
@ -420,7 +420,7 @@ FPOINT RotatePoint(float angle, float dist)
|
||||||
// | / |
|
// | / |
|
||||||
// |/)a |
|
// |/)a |
|
||||||
// ----o----o-->
|
// ----o----o-->
|
||||||
// | x
|
// | x
|
||||||
// |
|
// |
|
||||||
|
|
||||||
float RotateAngle(float x, float y)
|
float RotateAngle(float x, float y)
|
||||||
|
|
|
@ -2724,28 +2724,28 @@ static int tablePartDr[] = // drawer.tga
|
||||||
40, 104, 48, 160, // bocal
|
40, 104, 48, 160, // bocal
|
||||||
24, 152, 48, 160, // bocal fond
|
24, 152, 48, 160, // bocal fond
|
||||||
0, 240, 32, 256, // crayon 1: couleur (22)
|
0, 240, 32, 256, // crayon 1: couleur (22)
|
||||||
0, 160, 32, 192, // crayon 1: dessus
|
0, 160, 32, 192, // crayon 1: dessus
|
||||||
0, 192, 32, 256, // crayon 1: pointe
|
0, 192, 32, 256, // crayon 1: pointe
|
||||||
32, 240, 64, 256, // crayon 2: couleur
|
32, 240, 64, 256, // crayon 2: couleur
|
||||||
32, 160, 64, 192, // crayon 2: dessus
|
32, 160, 64, 192, // crayon 2: dessus
|
||||||
32, 192, 64, 256, // crayon 2: pointe
|
32, 192, 64, 256, // crayon 2: pointe
|
||||||
64, 240, 96, 256, // crayon 3: couleur
|
64, 240, 96, 256, // crayon 3: couleur
|
||||||
64, 160, 96, 192, // crayon 3: dessus
|
64, 160, 96, 192, // crayon 3: dessus
|
||||||
64, 192, 96, 256, // crayon 3: pointe
|
64, 192, 96, 256, // crayon 3: pointe
|
||||||
96, 240, 128, 256, // crayon 4: couleur
|
96, 240, 128, 256, // crayon 4: couleur
|
||||||
96, 160, 128, 192, // crayon 4: dessus
|
96, 160, 128, 192, // crayon 4: dessus
|
||||||
96, 192, 128, 256, // crayon 4: pointe
|
96, 192, 128, 256, // crayon 4: pointe
|
||||||
128, 240, 160, 256, // crayon 5: couleur
|
128, 240, 160, 256, // crayon 5: couleur
|
||||||
128, 160, 160, 192, // crayon 5: dessus
|
128, 160, 160, 192, // crayon 5: dessus
|
||||||
128, 192, 160, 256, // crayon 5: pointe
|
128, 192, 160, 256, // crayon 5: pointe
|
||||||
160, 240, 192, 256, // crayon 6: couleur
|
160, 240, 192, 256, // crayon 6: couleur
|
||||||
160, 160, 192, 192, // crayon 6: dessus
|
160, 160, 192, 192, // crayon 6: dessus
|
||||||
160, 192, 192, 256, // crayon 6: pointe
|
160, 192, 192, 256, // crayon 6: pointe
|
||||||
192, 240, 224, 256, // crayon 7: couleur
|
192, 240, 224, 256, // crayon 7: couleur
|
||||||
192, 160, 224, 192, // crayon 7: dessus
|
192, 160, 224, 192, // crayon 7: dessus
|
||||||
192, 192, 224, 256, // crayon 7: pointe
|
192, 192, 224, 256, // crayon 7: pointe
|
||||||
224, 240, 256, 256, // crayon 8: couleur
|
224, 240, 256, 256, // crayon 8: couleur
|
||||||
224, 160, 256, 192, // crayon 8: dessus
|
224, 160, 256, 192, // crayon 8: dessus
|
||||||
224, 192, 256, 256, // crayon 8: pointe
|
224, 192, 256, 256, // crayon 8: pointe
|
||||||
-1
|
-1
|
||||||
};
|
};
|
||||||
|
|
|
@ -1322,7 +1322,7 @@ void CParticule::FrameParticule(float rTime)
|
||||||
duration = Math::Rand()*1.0f+1.0f;
|
duration = Math::Rand()*1.0f+1.0f;
|
||||||
mass = 0.0f;
|
mass = 0.0f;
|
||||||
CreateParticule(pos, speed, dim, PARTIEXPLOG1, duration, mass, 1.0f);
|
CreateParticule(pos, speed, dim, PARTIEXPLOG1, duration, mass, 1.0f);
|
||||||
|
|
||||||
pos.y += 1.0f;
|
pos.y += 1.0f;
|
||||||
total = (int)(2.0f*m_engine->RetParticuleDensity());
|
total = (int)(2.0f*m_engine->RetParticuleDensity());
|
||||||
for ( j=0 ; j<total ; j++ )
|
for ( j=0 ; j<total ; j++ )
|
||||||
|
@ -1366,7 +1366,7 @@ void CParticule::FrameParticule(float rTime)
|
||||||
duration = Math::Rand()*1.0f+1.0f;
|
duration = Math::Rand()*1.0f+1.0f;
|
||||||
mass = 0.0f;
|
mass = 0.0f;
|
||||||
CreateParticule(pos, speed, dim, PARTIEXPLOG1, duration, mass, 1.0f);
|
CreateParticule(pos, speed, dim, PARTIEXPLOG1, duration, mass, 1.0f);
|
||||||
|
|
||||||
pos.y += 1.0f;
|
pos.y += 1.0f;
|
||||||
total = (int)(2.0f*m_engine->RetParticuleDensity());
|
total = (int)(2.0f*m_engine->RetParticuleDensity());
|
||||||
for ( j=0 ; j<total ; j++ )
|
for ( j=0 ; j<total ; j++ )
|
||||||
|
@ -3534,7 +3534,7 @@ void CParticule::DrawParticuleSphere(int i)
|
||||||
// Generate the group of rings for the sphere.
|
// Generate the group of rings for the sphere.
|
||||||
j = 0;
|
j = 0;
|
||||||
for ( ring=0 ; ring<numRings ; ring++ )
|
for ( ring=0 ; ring<numRings ; ring++ )
|
||||||
{
|
{
|
||||||
r0 = sinf((ring+0)*deltaRingAngle);
|
r0 = sinf((ring+0)*deltaRingAngle);
|
||||||
r1 = sinf((ring+1)*deltaRingAngle);
|
r1 = sinf((ring+1)*deltaRingAngle);
|
||||||
v0.y = cosf((ring+0)*deltaRingAngle);
|
v0.y = cosf((ring+0)*deltaRingAngle);
|
||||||
|
@ -3562,7 +3562,7 @@ void CParticule::DrawParticuleSphere(int i)
|
||||||
vertex[j++] = D3DVERTEX2(v1,v1, tu1,tv1);
|
vertex[j++] = D3DVERTEX2(v1,v1, tu1,tv1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_pD3DDevice->DrawPrimitive(D3DPT_TRIANGLESTRIP, D3DFVF_VERTEX2, vertex, j, NULL);
|
m_pD3DDevice->DrawPrimitive(D3DPT_TRIANGLESTRIP, D3DFVF_VERTEX2, vertex, j, NULL);
|
||||||
m_engine->AddStatisticTriangle(j);
|
m_engine->AddStatisticTriangle(j);
|
||||||
|
|
||||||
|
@ -3680,7 +3680,7 @@ void CParticule::DrawParticuleCylinder(int i)
|
||||||
vertex[j++] = D3DVERTEX2(v1,v1, tu1,tv1);
|
vertex[j++] = D3DVERTEX2(v1,v1, tu1,tv1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_pD3DDevice->DrawPrimitive(D3DPT_TRIANGLESTRIP, D3DFVF_VERTEX2, vertex, j, NULL);
|
m_pD3DDevice->DrawPrimitive(D3DPT_TRIANGLESTRIP, D3DFVF_VERTEX2, vertex, j, NULL);
|
||||||
m_engine->AddStatisticTriangle(j);
|
m_engine->AddStatisticTriangle(j);
|
||||||
|
|
||||||
|
|
|
@ -488,7 +488,7 @@ bool CPyro::Create(PyroType type, CObject* pObj, float force)
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( m_type == PT_SHOTW ) return true;
|
if ( m_type == PT_SHOTW ) return true;
|
||||||
|
|
||||||
// Generates the triangles of the explosion.
|
// Generates the triangles of the explosion.
|
||||||
if ( m_type == PT_FRAGT ||
|
if ( m_type == PT_FRAGT ||
|
||||||
m_type == PT_FRAGO ||
|
m_type == PT_FRAGO ||
|
||||||
|
@ -1200,7 +1200,7 @@ bool CPyro::EventProcess(const Event &event)
|
||||||
dim.x = (Math::Rand()*2.5f+2.5f)*(1.0f-m_progress*0.9f);
|
dim.x = (Math::Rand()*2.5f+2.5f)*(1.0f-m_progress*0.9f);
|
||||||
dim.y = dim.x;
|
dim.y = dim.x;
|
||||||
pos.y += dim.y;
|
pos.y += dim.y;
|
||||||
m_particule->CreateParticule(pos, speed, dim,
|
m_particule->CreateParticule(pos, speed, dim,
|
||||||
(ParticuleType)(PARTILENS1+rand()%4),
|
(ParticuleType)(PARTILENS1+rand()%4),
|
||||||
Math::Rand()*2.5f+2.5f,
|
Math::Rand()*2.5f+2.5f,
|
||||||
Math::Rand()*5.0f+5.0f, 0.0f);
|
Math::Rand()*5.0f+5.0f, 0.0f);
|
||||||
|
@ -1390,7 +1390,7 @@ void CPyro::CutObjectLink(CObject* pObj)
|
||||||
|
|
||||||
Error CPyro::IsEnded()
|
Error CPyro::IsEnded()
|
||||||
{
|
{
|
||||||
// Destroys the object that exploded.
|
// Destroys the object that exploded.
|
||||||
//It should not be destroyed at the end of the Create,
|
//It should not be destroyed at the end of the Create,
|
||||||
//because it is sometimes the object itself that makes the Create:
|
//because it is sometimes the object itself that makes the Create:
|
||||||
// pyro->Create(PT_FRAGT, this);
|
// pyro->Create(PT_FRAGT, this);
|
||||||
|
|
|
@ -43,7 +43,7 @@
|
||||||
#define IDM_EXIT 40006
|
#define IDM_EXIT 40006
|
||||||
|
|
||||||
// Next default values for new objects
|
// Next default values for new objects
|
||||||
//
|
//
|
||||||
#ifdef APSTUDIO_INVOKED
|
#ifdef APSTUDIO_INVOKED
|
||||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||||
#define _APS_3D_CONTROLS 1
|
#define _APS_3D_CONTROLS 1
|
||||||
|
|
|
@ -295,7 +295,7 @@ bool InitAudioTrackVolume(int volume)
|
||||||
CSound::CSound(CInstanceManager* iMan)
|
CSound::CSound(CInstanceManager* iMan)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
m_iMan = iMan;
|
m_iMan = iMan;
|
||||||
m_iMan->AddInstance(CLASS_SOUND, this);
|
m_iMan->AddInstance(CLASS_SOUND, this);
|
||||||
|
|
||||||
|
@ -428,7 +428,7 @@ bool CSound::Create(HWND hWnd, bool b3D)
|
||||||
|
|
||||||
if ( m_ctrl3D )
|
if ( m_ctrl3D )
|
||||||
{
|
{
|
||||||
hr = primary->QueryInterface( IID_IDirectSound3DListener,
|
hr = primary->QueryInterface( IID_IDirectSound3DListener,
|
||||||
(VOID**)&m_listener );
|
(VOID**)&m_listener );
|
||||||
if ( hr != S_OK )
|
if ( hr != S_OK )
|
||||||
{
|
{
|
||||||
|
@ -806,7 +806,7 @@ bool CSound::SearchFreeBuffer(Sound sound, int &channel, bool &bAlreadyLoaded)
|
||||||
|
|
||||||
// Reads in data from a wave file.
|
// Reads in data from a wave file.
|
||||||
|
|
||||||
bool CSound::ReadData(LPDIRECTSOUNDBUFFER lpDSB, Sound sound, DWORD size)
|
bool CSound::ReadData(LPDIRECTSOUNDBUFFER lpDSB, Sound sound, DWORD size)
|
||||||
{
|
{
|
||||||
LPVOID pData1;
|
LPVOID pData1;
|
||||||
DWORD dwData1Size;
|
DWORD dwData1Size;
|
||||||
|
@ -822,13 +822,13 @@ bool CSound::ReadData(LPDIRECTSOUNDBUFFER lpDSB, Sound sound, DWORD size)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read in first chunk of data.
|
// Read in first chunk of data.
|
||||||
if ( dwData1Size > 0 )
|
if ( dwData1Size > 0 )
|
||||||
{
|
{
|
||||||
memcpy(pData1, m_files[sound]+sizeof(WaveHeader), dwData1Size);
|
memcpy(pData1, m_files[sound]+sizeof(WaveHeader), dwData1Size);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read in second chunk if necessary.
|
// Read in second chunk if necessary.
|
||||||
if ( dwData2Size > 0 )
|
if ( dwData2Size > 0 )
|
||||||
{
|
{
|
||||||
memcpy(pData2, m_files[sound]+sizeof(WaveHeader)+dwData1Size, dwData2Size);
|
memcpy(pData2, m_files[sound]+sizeof(WaveHeader)+dwData1Size, dwData2Size);
|
||||||
}
|
}
|
||||||
|
@ -853,10 +853,10 @@ bool CSound::CreateSoundBuffer(int channel, DWORD size, DWORD freq,
|
||||||
DSBUFFERDESC dsbdesc;
|
DSBUFFERDESC dsbdesc;
|
||||||
DS3DBUFFER bufferParams; // 3D buffer properties
|
DS3DBUFFER bufferParams; // 3D buffer properties
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
// Set up wave format structure.
|
// Set up wave format structure.
|
||||||
memset( &pcmwf, 0, sizeof(PCMWAVEFORMAT) );
|
memset( &pcmwf, 0, sizeof(PCMWAVEFORMAT) );
|
||||||
pcmwf.wf.wFormatTag = WAVE_FORMAT_PCM;
|
pcmwf.wf.wFormatTag = WAVE_FORMAT_PCM;
|
||||||
pcmwf.wf.nChannels = bStereo ? 2 : 1;
|
pcmwf.wf.nChannels = bStereo ? 2 : 1;
|
||||||
pcmwf.wf.nSamplesPerSec = freq;
|
pcmwf.wf.nSamplesPerSec = freq;
|
||||||
pcmwf.wf.nBlockAlign = (WORD)blkAlign;
|
pcmwf.wf.nBlockAlign = (WORD)blkAlign;
|
||||||
|
@ -864,7 +864,7 @@ bool CSound::CreateSoundBuffer(int channel, DWORD size, DWORD freq,
|
||||||
pcmwf.wBitsPerSample = (WORD)bitsPerSample;
|
pcmwf.wBitsPerSample = (WORD)bitsPerSample;
|
||||||
|
|
||||||
// Set up DSBUFFERDESC structure.
|
// Set up DSBUFFERDESC structure.
|
||||||
memset(&dsbdesc, 0, sizeof(DSBUFFERDESC)); // Zero it out.
|
memset(&dsbdesc, 0, sizeof(DSBUFFERDESC)); // Zero it out.
|
||||||
dsbdesc.dwSize = sizeof(DSBUFFERDESC);
|
dsbdesc.dwSize = sizeof(DSBUFFERDESC);
|
||||||
if ( m_ctrl3D )
|
if ( m_ctrl3D )
|
||||||
{
|
{
|
||||||
|
@ -876,7 +876,7 @@ bool CSound::CreateSoundBuffer(int channel, DWORD size, DWORD freq,
|
||||||
{
|
{
|
||||||
dsbdesc.dwFlags = DSBCAPS_CTRLVOLUME|DSBCAPS_CTRLPAN|DSBCAPS_CTRLFREQUENCY;
|
dsbdesc.dwFlags = DSBCAPS_CTRLVOLUME|DSBCAPS_CTRLPAN|DSBCAPS_CTRLFREQUENCY;
|
||||||
}
|
}
|
||||||
dsbdesc.dwBufferBytes = size;
|
dsbdesc.dwBufferBytes = size;
|
||||||
dsbdesc.lpwfxFormat = (LPWAVEFORMATEX)&pcmwf;
|
dsbdesc.lpwfxFormat = (LPWAVEFORMATEX)&pcmwf;
|
||||||
|
|
||||||
hr = m_lpDS->CreateSoundBuffer(&dsbdesc, &m_channel[channel].soundBuffer, NULL);
|
hr = m_lpDS->CreateSoundBuffer(&dsbdesc, &m_channel[channel].soundBuffer, NULL);
|
||||||
|
@ -886,12 +886,12 @@ bool CSound::CreateSoundBuffer(int channel, DWORD size, DWORD freq,
|
||||||
{
|
{
|
||||||
hr = m_channel[channel].soundBuffer->QueryInterface
|
hr = m_channel[channel].soundBuffer->QueryInterface
|
||||||
(
|
(
|
||||||
IID_IDirectSound3DBuffer,
|
IID_IDirectSound3DBuffer,
|
||||||
(VOID**)&m_channel[channel].soundBuffer3D
|
(VOID**)&m_channel[channel].soundBuffer3D
|
||||||
);
|
);
|
||||||
if ( hr != DS_OK ) return false;
|
if ( hr != DS_OK ) return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_channel[channel].bUsed = true;
|
m_channel[channel].bUsed = true;
|
||||||
m_channel[channel].bMute = false;
|
m_channel[channel].bMute = false;
|
||||||
return true;
|
return true;
|
||||||
|
@ -1484,11 +1484,11 @@ bool CSound::PlayMusic(int rank, bool bRepeat)
|
||||||
// The device opened successfully; get the device ID.
|
// The device opened successfully; get the device ID.
|
||||||
m_MidiDeviceID = mciOpenParms.wDeviceID;
|
m_MidiDeviceID = mciOpenParms.wDeviceID;
|
||||||
|
|
||||||
// Begin playback.
|
// Begin playback.
|
||||||
mciPlayParms.dwCallback = (DWORD)m_hWnd;
|
mciPlayParms.dwCallback = (DWORD)m_hWnd;
|
||||||
dwReturn = mciSendCommand(m_MidiDeviceID,
|
dwReturn = mciSendCommand(m_MidiDeviceID,
|
||||||
MCI_PLAY,
|
MCI_PLAY,
|
||||||
MCI_NOTIFY,
|
MCI_NOTIFY,
|
||||||
(DWORD)(LPVOID)&mciPlayParms);
|
(DWORD)(LPVOID)&mciPlayParms);
|
||||||
if ( dwReturn != 0 )
|
if ( dwReturn != 0 )
|
||||||
{
|
{
|
||||||
|
@ -1570,7 +1570,7 @@ bool CSound::PlayAudioTrack(int rank)
|
||||||
mciGetErrorString(dwReturn, filename, 128);
|
mciGetErrorString(dwReturn, filename, 128);
|
||||||
StopMusic();
|
StopMusic();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Begin playback.
|
// Begin playback.
|
||||||
memset(&mciPlayParms, 0, sizeof(MCI_PLAY_PARMS));
|
memset(&mciPlayParms, 0, sizeof(MCI_PLAY_PARMS));
|
||||||
|
|
|
@ -108,7 +108,7 @@ CTerrain::~CTerrain()
|
||||||
// +---+---o---+---+---> x
|
// +---+---o---+---+---> x
|
||||||
// | | | | |
|
// | | | | |
|
||||||
// | | | | |
|
// | | | | |
|
||||||
// +---+---+---+---+
|
// +---+---+---+---+
|
||||||
// | | | | | The land is viewed from above here.
|
// | | | | | The land is viewed from above here.
|
||||||
// | | | | |
|
// | | | | |
|
||||||
// +---+---+---+---+
|
// +---+---+---+---+
|
||||||
|
@ -759,7 +759,7 @@ D3DVERTEX2 CTerrain::RetVertex(int x, int y, int step)
|
||||||
// |
|
// |
|
||||||
// +-------------------> x
|
// +-------------------> x
|
||||||
|
|
||||||
bool CTerrain::CreateMosaic(int ox, int oy, int step, int objRank,
|
bool CTerrain::CreateMosaic(int ox, int oy, int step, int objRank,
|
||||||
const D3DMATERIAL7 &mat,
|
const D3DMATERIAL7 &mat,
|
||||||
float min, float max)
|
float min, float max)
|
||||||
{
|
{
|
||||||
|
@ -1794,7 +1794,7 @@ float CTerrain::RetFloorLevel(const Math::Vector &p, bool bBrut, bool bWater)
|
||||||
return ps.y;
|
return ps.y;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns the height to the ground.
|
// Returns the height to the ground.
|
||||||
// This height is positive when you are above the ground.
|
// This height is positive when you are above the ground.
|
||||||
|
|
||||||
float CTerrain::RetFloorHeight(const Math::Vector &p, bool bBrut, bool bWater)
|
float CTerrain::RetFloorHeight(const Math::Vector &p, bool bBrut, bool bWater)
|
||||||
|
|
|
@ -188,7 +188,7 @@ protected:
|
||||||
char m_texBaseName[20];
|
char m_texBaseName[20];
|
||||||
char m_texBaseExt[10];
|
char m_texBaseExt[10];
|
||||||
float m_defHardness;
|
float m_defHardness;
|
||||||
|
|
||||||
TerrainMaterial m_levelMat[MAXMATTERRAIN+1];
|
TerrainMaterial m_levelMat[MAXMATTERRAIN+1];
|
||||||
int m_levelMatTotal;
|
int m_levelMatTotal;
|
||||||
int m_levelMatMax;
|
int m_levelMatMax;
|
||||||
|
|
|
@ -130,7 +130,7 @@ static short table_text_colobot[] =
|
||||||
218,17, 227,33, // Y
|
218,17, 227,33, // Y
|
||||||
227,17, 236,33, // Z
|
227,17, 236,33, // Z
|
||||||
236,17, 241,33, // [
|
236,17, 241,33, // [
|
||||||
241,17, 248,33, // \
|
241,17, 248,33, // \
|
||||||
248,17, 252,33, // ]
|
248,17, 252,33, // ]
|
||||||
219,0, 229,16, // ^
|
219,0, 229,16, // ^
|
||||||
0, 34, 9, 50, // _
|
0, 34, 9, 50, // _
|
||||||
|
@ -166,7 +166,7 @@ static short table_text_colobot[] =
|
||||||
201,34, 203,50, // |
|
201,34, 203,50, // |
|
||||||
203,34, 209,50, // }
|
203,34, 209,50, // }
|
||||||
209,34, 219,50, // ~
|
209,34, 219,50, // ~
|
||||||
219,34, 228,50, //
|
219,34, 228,50, //
|
||||||
|
|
||||||
219,34, 225,50, // 128
|
219,34, 225,50, // 128
|
||||||
219,34, 225,50,
|
219,34, 225,50,
|
||||||
|
@ -1223,7 +1223,7 @@ void CText::DimText(char *string, char *format, int len, Math::Point pos,
|
||||||
start.y -= RetDescent(size, FONT_COLOBOT);
|
start.y -= RetDescent(size, FONT_COLOBOT);
|
||||||
end.y += RetAscent(size, FONT_COLOBOT);
|
end.y += RetAscent(size, FONT_COLOBOT);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns the size of a multi-font text.
|
// Returns the size of a multi-font text.
|
||||||
|
|
||||||
void CText::DimText(char *string, char *format, Math::Point pos, int justif,
|
void CText::DimText(char *string, char *format, Math::Point pos, int justif,
|
||||||
|
@ -1259,7 +1259,7 @@ void CText::DimText(char *string, int len, Math::Point pos, int justif,
|
||||||
start.y -= RetDescent(size, font);
|
start.y -= RetDescent(size, font);
|
||||||
end.y += RetAscent(size, font);
|
end.y += RetAscent(size, font);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns the size of a text.
|
// Returns the size of a text.
|
||||||
|
|
||||||
void CText::DimText(char *string, Math::Point pos, int justif,
|
void CText::DimText(char *string, Math::Point pos, int justif,
|
||||||
|
@ -1291,7 +1291,7 @@ float CText::RetHeight(float size, FontType font)
|
||||||
return (16.0f/256.0f)*(size/20.0f);
|
return (16.0f/256.0f)*(size/20.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Returns the width of a string of multi-font characters.
|
// Returns the width of a string of multi-font characters.
|
||||||
|
|
||||||
float CText::RetStringWidth(char *string, char *format, int len,
|
float CText::RetStringWidth(char *string, char *format, int len,
|
||||||
|
|
|
@ -684,7 +684,7 @@ float CPhysics::RetLinStopLength(PhysicsMode sMode, PhysicsMode aMode)
|
||||||
|
|
||||||
float CPhysics::RetCirStopLength()
|
float CPhysics::RetCirStopLength()
|
||||||
{
|
{
|
||||||
return m_cirMotion.advanceSpeed.y * m_cirMotion.advanceSpeed.y /
|
return m_cirMotion.advanceSpeed.y * m_cirMotion.advanceSpeed.y /
|
||||||
m_cirMotion.stopAccel.y / 2.0f;
|
m_cirMotion.stopAccel.y / 2.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1802,7 +1802,7 @@ void CPhysics::WaterFrame(float aTime, float rTime)
|
||||||
m_particule->CreateParticule(pos, speed, dim, PARTISMOKE3, 4.0f);
|
m_particule->CreateParticule(pos, speed, dim, PARTISMOKE3, 4.0f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pos = m_object->RetPosition(0);
|
pos = m_object->RetPosition(0);
|
||||||
if ( pos.y >= m_water->RetLevel(m_object) ) return; // out of water?
|
if ( pos.y >= m_water->RetLevel(m_object) ) return; // out of water?
|
||||||
|
|
||||||
|
@ -2072,7 +2072,7 @@ void CPhysics::SoundMotorSlow(float rTime, ObjectType type)
|
||||||
speed.x -= Math::Rand()*4.0f;
|
speed.x -= Math::Rand()*4.0f;
|
||||||
speed.y -= Math::Rand()*3.0f;
|
speed.y -= Math::Rand()*3.0f;
|
||||||
speed.z += (Math::Rand()-0.5f)*6.0f;
|
speed.z += (Math::Rand()-0.5f)*6.0f;
|
||||||
|
|
||||||
mat = m_object->RetWorldMatrix(0);
|
mat = m_object->RetWorldMatrix(0);
|
||||||
pos = Transform(*mat, pos);
|
pos = Transform(*mat, pos);
|
||||||
speed = Transform(*mat, speed)-pos;
|
speed = Transform(*mat, speed)-pos;
|
||||||
|
@ -2690,7 +2690,7 @@ int CPhysics::ObjectAdapt(const Math::Vector &pos, const Math::Vector &angle)
|
||||||
}
|
}
|
||||||
|
|
||||||
// (*) Collision has the initial position (iiPos) and the new position (iPos),
|
// (*) Collision has the initial position (iiPos) and the new position (iPos),
|
||||||
// the obstacle is not known. We can therefore pass through.
|
// the obstacle is not known. We can therefore pass through.
|
||||||
// This is necessary when barriers found "in" a vehicle, not to block it definitely!
|
// This is necessary when barriers found "in" a vehicle, not to block it definitely!
|
||||||
|
|
||||||
|
|
||||||
|
@ -3642,7 +3642,7 @@ void CPhysics::MotorParticule(float aTime, float rTime)
|
||||||
}
|
}
|
||||||
speed.y -= 0.5f+Math::Rand()*2.0f;
|
speed.y -= 0.5f+Math::Rand()*2.0f;
|
||||||
speed.z += (Math::Rand()-0.5f)*3.0f;
|
speed.z += (Math::Rand()-0.5f)*3.0f;
|
||||||
|
|
||||||
mat = m_object->RetWorldMatrix(0);
|
mat = m_object->RetWorldMatrix(0);
|
||||||
pos = Transform(*mat, pos);
|
pos = Transform(*mat, pos);
|
||||||
speed = Transform(*mat, speed)-pos;
|
speed = Transform(*mat, speed)-pos;
|
||||||
|
@ -3864,7 +3864,7 @@ Error CPhysics::RetError()
|
||||||
type == OBJECT_WORM ||
|
type == OBJECT_WORM ||
|
||||||
type == OBJECT_APOLLO2 ||
|
type == OBJECT_APOLLO2 ||
|
||||||
type == OBJECT_MOBILEdr ) return ERR_OK;
|
type == OBJECT_MOBILEdr ) return ERR_OK;
|
||||||
|
|
||||||
if ( m_brain != 0 && m_brain->RetActiveVirus() )
|
if ( m_brain != 0 && m_brain->RetActiveVirus() )
|
||||||
{
|
{
|
||||||
return ERR_VEH_VIRUS;
|
return ERR_VEH_VIRUS;
|
||||||
|
|
|
@ -34,7 +34,7 @@ void PrepareFilename(CBotString &filename)
|
||||||
pos = filename.ReverseFind('\\');
|
pos = filename.ReverseFind('\\');
|
||||||
if ( pos > 0 )
|
if ( pos > 0 )
|
||||||
{
|
{
|
||||||
filename = filename.Mid(pos+1); // Remove files with
|
filename = filename.Mid(pos+1); // Remove files with
|
||||||
}
|
}
|
||||||
|
|
||||||
pos = filename.ReverseFind('/');
|
pos = filename.ReverseFind('/');
|
||||||
|
@ -57,7 +57,7 @@ void PrepareFilename(CBotString &filename)
|
||||||
// get the filename as a parameter
|
// get the filename as a parameter
|
||||||
|
|
||||||
// execution
|
// execution
|
||||||
bool rfconstruct (CBotVar* pThis, CBotVar* pVar, CBotVar* pResult, int& Exception)
|
bool rfconstruct (CBotVar* pThis, CBotVar* pVar, CBotVar* pResult, int& Exception)
|
||||||
{
|
{
|
||||||
CBotString mode;
|
CBotString mode;
|
||||||
|
|
||||||
|
@ -79,7 +79,7 @@ bool rfconstruct (CBotVar* pThis, CBotVar* pVar, CBotVar* pResult, int& Exceptio
|
||||||
if ( mode != "r" && mode != "w" ) { Exception = CBotErrBadParam; return false; }
|
if ( mode != "r" && mode != "w" ) { Exception = CBotErrBadParam; return false; }
|
||||||
|
|
||||||
// no third parameter
|
// no third parameter
|
||||||
if ( pVar->GivNext() != NULL ) { Exception = CBotErrOverParam; return false; }
|
if ( pVar->GivNext() != NULL ) { Exception = CBotErrOverParam; return false; }
|
||||||
}
|
}
|
||||||
|
|
||||||
// saves the file name
|
// saves the file name
|
||||||
|
@ -238,7 +238,7 @@ CBotTypResult cfopen (CBotVar* pThis, CBotVar* &pVar)
|
||||||
return CBotTypResult(CBotTypBoolean);
|
return CBotTypResult(CBotTypBoolean);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// process FILE :: close
|
// process FILE :: close
|
||||||
|
|
||||||
// execeution
|
// execeution
|
||||||
|
@ -290,7 +290,7 @@ bool rfwrite (CBotVar* pThis, CBotVar* pVar, CBotVar* pResult, int& Exception)
|
||||||
if ( pVar->GivInit() != IS_DEF) { Exception = CBotErrNotOpen; return false; }
|
if ( pVar->GivInit() != IS_DEF) { Exception = CBotErrNotOpen; return false; }
|
||||||
|
|
||||||
FILE* pFile= (FILE*)pVar->GivValInt();
|
FILE* pFile= (FILE*)pVar->GivValInt();
|
||||||
|
|
||||||
int res = fputs(param+CBotString("\n"), pFile);
|
int res = fputs(param+CBotString("\n"), pFile);
|
||||||
|
|
||||||
// if an error occurs generate an exception
|
// if an error occurs generate an exception
|
||||||
|
|
|
@ -1056,7 +1056,7 @@ bool rProduce(CBotVar* var, CBotVar* result, int& exception, void* user)
|
||||||
object->SetActivity(false);
|
object->SetActivity(false);
|
||||||
object->ReadProgram(0, (char*)name);
|
object->ReadProgram(0, (char*)name);
|
||||||
object->RunProgram(0);
|
object->RunProgram(0);
|
||||||
|
|
||||||
result->SetValInt(0); // no error
|
result->SetValInt(0); // no error
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1759,7 +1759,7 @@ CBotTypResult cSend(CBotVar* &var, void* user)
|
||||||
if ( var == 0 ) return CBotTypResult(CBotErrLowParam);
|
if ( var == 0 ) return CBotTypResult(CBotErrLowParam);
|
||||||
if ( var->GivType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
|
if ( var->GivType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
|
||||||
var = var->GivNext();
|
var = var->GivNext();
|
||||||
|
|
||||||
if ( var == 0 ) return CBotTypResult(CBotTypFloat);
|
if ( var == 0 ) return CBotTypResult(CBotTypFloat);
|
||||||
if ( var->GivType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
|
if ( var->GivType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
|
||||||
var = var->GivNext();
|
var = var->GivNext();
|
||||||
|
@ -2249,7 +2249,7 @@ bool rMotor(CBotVar* var, CBotVar* result, int& exception, void* user)
|
||||||
turn = left-right;
|
turn = left-right;
|
||||||
if ( turn < -1.0f ) turn = -1.0f;
|
if ( turn < -1.0f ) turn = -1.0f;
|
||||||
if ( turn > 1.0f ) turn = 1.0f;
|
if ( turn > 1.0f ) turn = 1.0f;
|
||||||
|
|
||||||
if ( pThis->RetFixed() ) // ant on the back?
|
if ( pThis->RetFixed() ) // ant on the back?
|
||||||
{
|
{
|
||||||
speed = 0.0f;
|
speed = 0.0f;
|
||||||
|
@ -3568,7 +3568,7 @@ void CScript::New(CEdit* edit, char* name)
|
||||||
edit->SetCursor(cursor2, cursor1);
|
edit->SetCursor(cursor2, cursor1);
|
||||||
edit->ShowSelect();
|
edit->ShowSelect();
|
||||||
edit->SetFocus(true);
|
edit->SetFocus(true);
|
||||||
|
|
||||||
sf = m_main->RetScriptFile();
|
sf = m_main->RetScriptFile();
|
||||||
if ( sf[0] != 0 ) // Load an empty program specific?
|
if ( sf[0] != 0 ) // Load an empty program specific?
|
||||||
{
|
{
|
||||||
|
@ -3730,7 +3730,7 @@ bool CScript::ReadStack(FILE *file)
|
||||||
|
|
||||||
if ( m_botProg == 0 ) return false;
|
if ( m_botProg == 0 ) return false;
|
||||||
if ( !m_botProg->RestoreState(file) ) return false;
|
if ( !m_botProg->RestoreState(file) ) return false;
|
||||||
|
|
||||||
m_object->SetRunScript(this);
|
m_object->SetRunScript(this);
|
||||||
m_bRun = true;
|
m_bRun = true;
|
||||||
m_bContinue = false;
|
m_bContinue = false;
|
||||||
|
|
|
@ -2199,7 +2199,7 @@ void CEdit::Scroll(int pos, bool bAdjustCursor)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Justif();
|
Justif();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -576,7 +576,7 @@ void CGroup::Draw()
|
||||||
uv2.x -= dp;
|
uv2.x -= dp;
|
||||||
uv2.y -= dp;
|
uv2.y -= dp;
|
||||||
DrawIcon(pos, dim, uv1, uv2);
|
DrawIcon(pos, dim, uv1, uv2);
|
||||||
|
|
||||||
m_engine->SetTexture("button3.tga");
|
m_engine->SetTexture("button3.tga");
|
||||||
m_engine->SetState(D3DSTATENORMAL);
|
m_engine->SetState(D3DSTATENORMAL);
|
||||||
pos.x += 8.0f/640.0f;
|
pos.x += 8.0f/640.0f;
|
||||||
|
@ -607,7 +607,7 @@ void CGroup::Draw()
|
||||||
uv2.x -= dp;
|
uv2.x -= dp;
|
||||||
uv2.y -= dp;
|
uv2.y -= dp;
|
||||||
DrawIcon(pos, dim, uv1, uv2);
|
DrawIcon(pos, dim, uv1, uv2);
|
||||||
|
|
||||||
m_engine->SetState(D3DSTATETTb);
|
m_engine->SetState(D3DSTATETTb);
|
||||||
pos.x += 8.0f/640.0f;
|
pos.x += 8.0f/640.0f;
|
||||||
pos.y += 8.0f/480.0f;
|
pos.y += 8.0f/480.0f;
|
||||||
|
|
|
@ -431,7 +431,7 @@ void CList::Draw()
|
||||||
DrawIcon(pos, dim, uv1, uv2); // ch'tite shadow cute (?)
|
DrawIcon(pos, dim, uv1, uv2); // ch'tite shadow cute (?)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for ( i=0 ; i<m_displayLine ; i++ )
|
for ( i=0 ; i<m_displayLine ; i++ )
|
||||||
{
|
{
|
||||||
if ( i+m_firstLine >= m_totalLine ) break;
|
if ( i+m_firstLine >= m_totalLine ) break;
|
||||||
|
|
|
@ -83,7 +83,7 @@ static int perso_color[3*10*3] =
|
||||||
90, 95, 85, // black
|
90, 95, 85, // black
|
||||||
85, 48, 9, // brown
|
85, 48, 9, // brown
|
||||||
60, 0, 23, // black
|
60, 0, 23, // black
|
||||||
0, 0, 0, //
|
0, 0, 0, //
|
||||||
// spacesuit:
|
// spacesuit:
|
||||||
203, 206, 204, // dirty white
|
203, 206, 204, // dirty white
|
||||||
0, 205, 203, // bluish
|
0, 205, 203, // bluish
|
||||||
|
@ -94,7 +94,7 @@ static int perso_color[3*10*3] =
|
||||||
0, 84, 136, // bluish
|
0, 84, 136, // bluish
|
||||||
56, 61, 146, // bluish
|
56, 61, 146, // bluish
|
||||||
56, 56, 56, // black
|
56, 56, 56, // black
|
||||||
0, 0, 0, //
|
0, 0, 0, //
|
||||||
// strips:
|
// strips:
|
||||||
255, 255, 255, // white
|
255, 255, 255, // white
|
||||||
255, 255, 0, // yellow
|
255, 255, 0, // yellow
|
||||||
|
@ -105,7 +105,7 @@ static int perso_color[3*10*3] =
|
||||||
0, 255, 255, // cyan
|
0, 255, 255, // cyan
|
||||||
0, 0, 255, // blue
|
0, 0, 255, // blue
|
||||||
70, 51, 84, // dark
|
70, 51, 84, // dark
|
||||||
0, 0, 0, //
|
0, 0, 0, //
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -187,7 +187,7 @@ CMainDialog::CMainDialog(CInstanceManager* iMan)
|
||||||
|
|
||||||
ZeroMemory(&m_perso, sizeof(GamerPerso));
|
ZeroMemory(&m_perso, sizeof(GamerPerso));
|
||||||
DefPerso();
|
DefPerso();
|
||||||
|
|
||||||
m_bTooltip = true;
|
m_bTooltip = true;
|
||||||
m_bGlint = true;
|
m_bGlint = true;
|
||||||
m_bRain = true;
|
m_bRain = true;
|
||||||
|
@ -588,7 +588,7 @@ void CMainDialog::ChangePhase(Phase phase)
|
||||||
ddim.x = 220.0f/640.0f;
|
ddim.x = 220.0f/640.0f;
|
||||||
ddim.y = 274.0f/480.0f;
|
ddim.y = 274.0f/480.0f;
|
||||||
pw->CreateGroup(pos, ddim, 17, EVENT_NULL); // frame
|
pw->CreateGroup(pos, ddim, 17, EVENT_NULL); // frame
|
||||||
|
|
||||||
pos.x = 100.0f/640.0f;
|
pos.x = 100.0f/640.0f;
|
||||||
pos.y = 364.0f/480.0f;
|
pos.y = 364.0f/480.0f;
|
||||||
ddim.x = 210.0f/640.0f;
|
ddim.x = 210.0f/640.0f;
|
||||||
|
@ -890,7 +890,7 @@ void CMainDialog::ChangePhase(Phase phase)
|
||||||
pli->SetState(STATE_SHADOW);
|
pli->SetState(STATE_SHADOW);
|
||||||
UpdateSceneChap(m_chap[m_index]);
|
UpdateSceneChap(m_chap[m_index]);
|
||||||
if ( m_phase != PHASE_USER ) pli->SetState(STATE_EXTEND);
|
if ( m_phase != PHASE_USER ) pli->SetState(STATE_EXTEND);
|
||||||
|
|
||||||
// Displays a list of missions:
|
// Displays a list of missions:
|
||||||
pos.x = ox+sx*9.5f;
|
pos.x = ox+sx*9.5f;
|
||||||
pos.y = oy+sy*10.5f;
|
pos.y = oy+sy*10.5f;
|
||||||
|
@ -925,7 +925,7 @@ void CMainDialog::ChangePhase(Phase phase)
|
||||||
GetResource(RES_TEXT, RT_PLAY_RESUME, name);
|
GetResource(RES_TEXT, RT_PLAY_RESUME, name);
|
||||||
pl = pw->CreateLabel(pos, ddim, 0, EVENT_LABEL13, name);
|
pl = pw->CreateLabel(pos, ddim, 0, EVENT_LABEL13, name);
|
||||||
pl->SetJustif(1);
|
pl->SetJustif(1);
|
||||||
|
|
||||||
pos.x = ox+sx*3;
|
pos.x = ox+sx*3;
|
||||||
pos.y = oy+sy*3.6f;
|
pos.y = oy+sy*3.6f;
|
||||||
ddim.x = dim.x*13.4f;
|
ddim.x = dim.x*13.4f;
|
||||||
|
@ -3678,7 +3678,7 @@ void CMainDialog::ReadNameList()
|
||||||
pl = (CList*)pw->SearchControl(EVENT_INTERFACE_NLIST);
|
pl = (CList*)pw->SearchControl(EVENT_INTERFACE_NLIST);
|
||||||
if ( pl == 0 ) return;
|
if ( pl == 0 ) return;
|
||||||
pl->Flush();
|
pl->Flush();
|
||||||
|
|
||||||
nbFilenames = 0;
|
nbFilenames = 0;
|
||||||
sprintf(dir, "%s\\*", m_savegameDir);
|
sprintf(dir, "%s\\*", m_savegameDir);
|
||||||
hFile = _findfirst(dir, &fBuffer);
|
hFile = _findfirst(dir, &fBuffer);
|
||||||
|
|
|
@ -186,9 +186,9 @@ protected:
|
||||||
|
|
||||||
char m_sceneDir[_MAX_FNAME]; // scene folder
|
char m_sceneDir[_MAX_FNAME]; // scene folder
|
||||||
char m_savegameDir[_MAX_FNAME]; // savegame folder
|
char m_savegameDir[_MAX_FNAME]; // savegame folder
|
||||||
char m_publicDir[_MAX_FNAME]; // program folder
|
char m_publicDir[_MAX_FNAME]; // program folder
|
||||||
char m_userDir[_MAX_FNAME]; // user folder
|
char m_userDir[_MAX_FNAME]; // user folder
|
||||||
char m_filesDir[_MAX_FNAME]; // case files
|
char m_filesDir[_MAX_FNAME]; // case files
|
||||||
|
|
||||||
int m_index; // 0..4
|
int m_index; // 0..4
|
||||||
int m_chap[10]; // selected chapter (0..8)
|
int m_chap[10]; // selected chapter (0..8)
|
||||||
|
|
|
@ -498,7 +498,7 @@ void CStudio::SearchToken(CEdit* edit)
|
||||||
token[i] = text[cursor2+i];
|
token[i] = text[cursor2+i];
|
||||||
}
|
}
|
||||||
token[i] = 0;
|
token[i] = 0;
|
||||||
|
|
||||||
strcpy(m_helpFilename, RetHelpFilename(token));
|
strcpy(m_helpFilename, RetHelpFilename(token));
|
||||||
if ( m_helpFilename[0] == 0 )
|
if ( m_helpFilename[0] == 0 )
|
||||||
{
|
{
|
||||||
|
@ -1503,7 +1503,7 @@ void CStudio::UpdateDialogPublic()
|
||||||
sprintf(text, name, dir);
|
sprintf(text, name, dir);
|
||||||
pl->SetName(text, false);
|
pl->SetName(text, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fills the list with all programs saved.
|
// Fills the list with all programs saved.
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# A script for removing trailing whitespace from all lines
|
||||||
|
|
||||||
|
for file in "$@"; do
|
||||||
|
sed -i 's/[ \t]*$//' "$file"
|
||||||
|
done
|
Loading…
Reference in New Issue