summaryrefslogtreecommitdiffstats
path: root/src/Copie de taskgoto.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Copie de taskgoto.cpp')
-rw-r--r--src/Copie de taskgoto.cpp152
1 files changed, 69 insertions, 83 deletions
diff --git a/src/Copie de taskgoto.cpp b/src/Copie de taskgoto.cpp
index 2ea7b4a..ddb9a40 100644
--- a/src/Copie de taskgoto.cpp
+++ b/src/Copie de taskgoto.cpp
@@ -1,18 +1,4 @@
-// * This file is part of the COLOBOT source code
-// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
-// *
-// * This program is free software: you can redistribute it and/or modify
-// * it under the terms of the GNU General Public License as published by
-// * the Free Software Foundation, either version 3 of the License, or
-// * (at your option) any later version.
-// *
-// * This program is distributed in the hope that it will be useful,
-// * but WITHOUT ANY WARRANTY; without even the implied warranty of
-// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// * GNU General Public License for more details.
-// *
-// * You should have received a copy of the GNU General Public License
-// * along with this program. If not, see http://www.gnu.org/licenses/.
+// taskgoto.cpp
#define STRICT
#define D3D_OVERLOADS
@@ -60,7 +46,7 @@ CTaskGoto::~CTaskGoto()
}
-// Gestion d'un �v�nement.
+// Gestion d'un événement.
BOOL CTaskGoto::EventProcess(const Event &event)
{
@@ -72,7 +58,7 @@ BOOL CTaskGoto::EventProcess(const Event &event)
if ( m_engine->RetPause() ) return TRUE;
if ( event.event != EVENT_FRAME ) return TRUE;
- // Objet momentan�ment immobile (fourmi sur le dos) ?
+ // Objet momentanément immobile (fourmi sur le dos) ?
if ( m_object->RetFixed() )
{
m_physics->SetMotorSpeedX(0.0f); // stoppe l'avance
@@ -109,7 +95,7 @@ BOOL CTaskGoto::EventProcess(const Event &event)
a = NormAngle(a);
if ( a > PI*0.5f && a < PI*1.5f )
{
- linSpeed = 1.0f; // obstacle derri�re -> avance
+ linSpeed = 1.0f; // obstacle derrière -> avance
cirSpeed = -cirSpeed;
}
else
@@ -117,7 +103,7 @@ BOOL CTaskGoto::EventProcess(const Event &event)
linSpeed = -1.0f; // obstacle devant -> recule
}
- m_physics->SetMotorSpeedZ(cirSpeed); // tourne � gauche/droite
+ m_physics->SetMotorSpeedZ(cirSpeed); // tourne à gauche/droite
m_physics->SetMotorSpeedX(linSpeed); // avance
return TRUE;
}
@@ -179,7 +165,7 @@ BOOL CTaskGoto::EventProcess(const Event &event)
return TRUE;
}
- if ( m_phase == TGP_BEAMUP ) // d�colle ?
+ if ( m_phase == TGP_BEAMUP ) // décolle ?
{
m_physics->SetMotorSpeedY(1.0f); // monte
return TRUE;
@@ -262,7 +248,7 @@ BOOL CTaskGoto::EventProcess(const Event &event)
}
else
{
- linSpeed = 1.0f; // fonce sans s'arr�ter
+ linSpeed = 1.0f; // fonce sans s'arrêter
}
linSpeed *= 1.0f-(1.0f-0.3f)*Abs(cirSpeed);
@@ -272,7 +258,7 @@ BOOL CTaskGoto::EventProcess(const Event &event)
linSpeed = 0.0f; // tourne d'abord, puis avance
}
- m_physics->SetMotorSpeedZ(cirSpeed); // tourne � gauche/droite
+ m_physics->SetMotorSpeedZ(cirSpeed); // tourne à gauche/droite
m_physics->SetMotorSpeedX(linSpeed); // avance
return TRUE;
}
@@ -326,7 +312,7 @@ BOOL CTaskGoto::EventProcess(const Event &event)
if ( cirSpeed > 1.0f ) cirSpeed = 1.0f;
if ( cirSpeed < -1.0f ) cirSpeed = -1.0f;
- m_physics->SetMotorSpeedZ(cirSpeed); // tourne � gauche/droite
+ m_physics->SetMotorSpeedZ(cirSpeed); // tourne à gauche/droite
m_physics->SetMotorSpeedX(1.0f); // avance
return TRUE;
}
@@ -402,7 +388,7 @@ BOOL CTaskGoto::EventProcess(const Event &event)
//? if ( m_physics->RetType() == TYPE_FLYING &&
//? m_physics->RetLand() ) // volant au sol ?
//? {
-//? cirSpeed *= 4.0f; // plus de p�che
+//? cirSpeed *= 4.0f; // plus de pèche
//? }
if ( cirSpeed > 1.0f ) cirSpeed = 1.0f;
if ( cirSpeed < -1.0f ) cirSpeed = -1.0f;
@@ -412,7 +398,7 @@ BOOL CTaskGoto::EventProcess(const Event &event)
//? if ( m_physics->RetType() == TYPE_FLYING &&
//? m_physics->RetLand() ) // volant au sol ?
//? {
-//? linSpeed *= 8.0f; // plus de p�che
+//? linSpeed *= 8.0f; // plus de pèche
//? }
if ( linSpeed > 1.0f ) linSpeed = 1.0f;
@@ -424,13 +410,13 @@ BOOL CTaskGoto::EventProcess(const Event &event)
}
#endif
- m_physics->SetMotorSpeedZ(cirSpeed); // tourne � gauche/droite
+ m_physics->SetMotorSpeedZ(cirSpeed); // tourne à gauche/droite
m_physics->SetMotorSpeedX(linSpeed); // avance
}
if ( m_phase == TGP_TURN || // tourne vers l'objet ?
- m_phase == TGP_CRTURN || // tourne apr�s collision ?
- m_phase == TGP_CLTURN ) // tourne apr�s collision ?
+ m_phase == TGP_CRTURN || // tourne après collision ?
+ m_phase == TGP_CLTURN ) // tourne après collision ?
{
a = m_object->RetAngleY(0);
g = m_angle;
@@ -438,18 +424,18 @@ BOOL CTaskGoto::EventProcess(const Event &event)
if ( cirSpeed > 1.0f ) cirSpeed = 1.0f;
if ( cirSpeed < -1.0f ) cirSpeed = -1.0f;
- m_physics->SetMotorSpeedZ(cirSpeed); // tourne � gauche/droite
+ m_physics->SetMotorSpeedZ(cirSpeed); // tourne à gauche/droite
}
- if ( m_phase == TGP_CRWAIT || // attend apr�s collision ?
- m_phase == TGP_CLWAIT ) // attend apr�s collision ?
+ if ( m_phase == TGP_CRWAIT || // attend après collision ?
+ m_phase == TGP_CLWAIT ) // attend après collision ?
{
m_time += event.rTime;
m_physics->SetMotorSpeedX(0.0f); // stoppe l'avance
m_physics->SetMotorSpeedZ(0.0f); // stoppe la rotation
}
- if ( m_phase == TGP_CRADVANCE ) // avance apr�s collision ?
+ if ( m_phase == TGP_CRADVANCE ) // avance après collision ?
{
if ( m_physics->RetCollision() ) // collision ?
{
@@ -461,7 +447,7 @@ BOOL CTaskGoto::EventProcess(const Event &event)
m_physics->SetMotorSpeedX(0.5f); // avance mollo
}
- if ( m_phase == TGP_CLADVANCE ) // avance apr�s collision ?
+ if ( m_phase == TGP_CLADVANCE ) // avance après collision ?
{
if ( m_physics->RetCollision() ) // collision ?
{
@@ -545,7 +531,7 @@ CObject* CTaskGoto::WormSearch(D3DVECTOR &impact)
oType != OBJECT_SAFE &&
oType != OBJECT_HUSTON ) continue;
- if ( pObj->RetVirusMode() ) continue; // objet infect� ?
+ if ( pObj->RetVirusMode() ) continue; // objet infecté ?
if ( !pObj->GetCrashSphere(0, oPos, radius) ) continue;
distance = Length2d(oPos, iPos);
@@ -582,7 +568,7 @@ void CTaskGoto::WormFrame(float rTime)
dist = Length(pos, impact);
if ( dist <= 15.0f )
{
- pObj->SetVirusMode(TRUE); // paf, infect� !
+ pObj->SetVirusMode(TRUE); // paf, infecté !
}
}
}
@@ -590,9 +576,9 @@ void CTaskGoto::WormFrame(float rTime)
-// Assigne le but � atteindre.
-// "dist" est la distance de laquelle il faut s'�loigner pour
-// prendre ou d�poser un objet.
+// Assigne le but à atteindre.
+// "dist" est la distance de laquelle il faut s'éloigner pour
+// prendre ou déposer un objet.
Error CTaskGoto::Start(D3DVECTOR goal, float altitude,
TaskGotoGoal goalMode, TaskGotoCrash crashMode)
@@ -685,7 +671,7 @@ Error CTaskGoto::Start(D3DVECTOR goal, float altitude,
dist = 0.0f;
AdjustTarget(target, m_goal, dist);
}
- m_bTake = TRUE; // objet � prendre � l'arriv�e (rotation finale)
+ m_bTake = TRUE; // objet à prendre à l'arrivée (rotation finale)
}
}
@@ -708,23 +694,23 @@ Error CTaskGoto::Start(D3DVECTOR goal, float altitude,
dist = 4.0f;
if ( AdjustTarget(target, m_goal, dist) )
{
- m_bmFretObject = target; // fret pos� au sol
+ m_bmFretObject = target; // fret posé au sol
}
else
{
m_bmFinalMove = dist;
}
}
- m_bTake = TRUE; // objet � prendre � l'arriv�e (rotation finale)
+ m_bTake = TRUE; // objet à prendre à l'arrivée (rotation finale)
}
if ( m_physics->RetType() == TYPE_FLYING && m_altitude == 0.0f )
{
pos = m_object->RetPosition(0);
dist = Length2d(pos, m_goal);
- if ( dist > 40.0f ) // plus de 10 m�tres ?
+ if ( dist > 40.0f ) // plus de 10 mètres ?
{
- m_altitude = 20.0f; // altitude par d�faut
+ m_altitude = 20.0f; // altitude par défaut
}
}
@@ -734,7 +720,7 @@ Error CTaskGoto::Start(D3DVECTOR goal, float altitude,
{
x = (int)((m_goal.x+1600.0f)/BM_DIM_STEP);
y = (int)((m_goal.z+1600.0f)/BM_DIM_STEP);
- if ( BitmapTestDot(0, x, y) ) // arriv�e occup�e ?
+ if ( BitmapTestDot(0, x, y) ) // arrivée occupée ?
{
m_error = ERR_GOTO_IMPOSSIBLE;
return m_error;
@@ -745,7 +731,7 @@ Error CTaskGoto::Start(D3DVECTOR goal, float altitude,
return ERR_OK;
}
-// Indique si l'action est termin�e.
+// Indique si l'action est terminée.
Error CTaskGoto::IsEnded()
{
@@ -774,13 +760,13 @@ Error CTaskGoto::IsEnded()
return ERR_CONTINUE;
}
- if ( m_phase == TGP_BEAMUP ) // d�colle ?
+ if ( m_phase == TGP_BEAMUP ) // décolle ?
{
if ( m_physics->RetType() == TYPE_FLYING && m_altitude > 0.0f )
{
h = m_terrain->RetFloorHeight(pos, TRUE);
if ( h < m_altitude-20.0f ) return ERR_CONTINUE;
- m_physics->SetMotorSpeedY(0.0f); // stoppe la mont�e
+ m_physics->SetMotorSpeedY(0.0f); // stoppe la montée
}
m_phase = TGP_BEAMGOTO;
}
@@ -794,7 +780,7 @@ Error CTaskGoto::IsEnded()
else // en vol ?
{
limit = 2.0f;
- if ( m_bmIndex < m_bmTotal ) limit *= 2.0f; // point interm�diaire
+ if ( m_bmIndex < m_bmTotal ) limit *= 2.0f; // point intermédiaire
}
if ( m_bApprox ) limit = 2.0f;
@@ -894,7 +880,7 @@ Error CTaskGoto::IsEnded()
}
}
- if ( m_phase == TGP_CRWAIT ) // attend apr�s collision ?
+ if ( m_phase == TGP_CRWAIT ) // attend après collision ?
{
if ( m_crashMode == TGC_HALT )
{
@@ -906,15 +892,15 @@ Error CTaskGoto::IsEnded()
if ( m_time >= 1.0f )
{
if ( m_crashMode == TGC_RIGHTLEFT ||
- m_crashMode == TGC_RIGHT ) angle = PI/2.0f; // 90 � droite
- else angle = -PI/2.0f; // 90 � gauche
+ m_crashMode == TGC_RIGHT ) angle = PI/2.0f; // 90 à droite
+ else angle = -PI/2.0f; // 90 à gauche
m_angle = NormAngle(m_object->RetAngleY(0)+angle);
m_phase = TGP_CRTURN;
//? m_phase = TGP_ADVANCE;
}
}
- if ( m_phase == TGP_CRTURN ) // tourne apr�s collision ?
+ if ( m_phase == TGP_CRTURN ) // tourne après collision ?
{
angle = NormAngle(m_object->RetAngleY(0));
limit = 0.1f;
@@ -926,7 +912,7 @@ Error CTaskGoto::IsEnded()
}
}
- if ( m_phase == TGP_CRADVANCE ) // avance apr�s collision ?
+ if ( m_phase == TGP_CRADVANCE ) // avance après collision ?
{
if ( Length(pos, m_pos) >= 5.0f )
{
@@ -934,7 +920,7 @@ Error CTaskGoto::IsEnded()
}
}
- if ( m_phase == TGP_CLWAIT ) // attend apr�s collision ?
+ if ( m_phase == TGP_CLWAIT ) // attend après collision ?
{
if ( m_time >= 1.0f )
{
@@ -947,7 +933,7 @@ Error CTaskGoto::IsEnded()
}
}
- if ( m_phase == TGP_CLTURN ) // tourne apr�s collision ?
+ if ( m_phase == TGP_CLTURN ) // tourne après collision ?
{
angle = NormAngle(m_object->RetAngleY(0));
limit = 0.1f;
@@ -959,7 +945,7 @@ Error CTaskGoto::IsEnded()
}
}
- if ( m_phase == TGP_CLADVANCE ) // avance apr�s collision ?
+ if ( m_phase == TGP_CLADVANCE ) // avance après collision ?
{
if ( Length(pos, m_pos) >= 10.0f )
{
@@ -987,7 +973,7 @@ Error CTaskGoto::IsEnded()
}
-// Cherche l'objet � la position cible.
+// Cherche l'objet à la position cible.
CObject* CTaskGoto::SearchTarget(D3DVECTOR pos, float margin)
{
@@ -1002,7 +988,7 @@ CObject* CTaskGoto::SearchTarget(D3DVECTOR pos, float margin)
if ( pObj == 0 ) break;
if ( !pObj->RetActif() ) continue;
- if ( pObj->RetTruck() != 0 ) continue; // objet port� ?
+ if ( pObj->RetTruck() != 0 ) continue; // objet porté ?
oPos = pObj->RetPosition(0);
dist = Length2d(pos, oPos);
@@ -1014,7 +1000,7 @@ CObject* CTaskGoto::SearchTarget(D3DVECTOR pos, float margin)
}
// Ajuste la cible en fonction de l'objet.
-// Retourne TRUE s'il s'agit de fret pos� au sol.
+// Retourne TRUE s'il s'agit de fret posé au sol.
BOOL CTaskGoto::AdjustTarget(CObject* pObj, D3DVECTOR &pos, float &distance)
{
@@ -1102,8 +1088,8 @@ BOOL CTaskGoto::AdjustTarget(CObject* pObj, D3DVECTOR &pos, float &distance)
return FALSE;
}
-// S'il on est sur un objet produit par un b�timent (minerai produit
-// par derrick), modifie la position par-rapport au b�timent.
+// S'il on est sur un objet produit par un bâtiment (minerai produit
+// par derrick), modifie la position par-rapport au bâtiment.
BOOL CTaskGoto::AdjustBuilding(D3DVECTOR &pos, float margin, float &distance)
{
@@ -1118,7 +1104,7 @@ BOOL CTaskGoto::AdjustBuilding(D3DVECTOR &pos, float margin, float &distance)
if ( pObj == 0 ) break;
if ( !pObj->RetActif() ) continue;
- if ( pObj->RetTruck() != 0 ) continue; // objet port� ?
+ if ( pObj->RetTruck() != 0 ) continue; // objet porté ?
if ( !GetHotPoint(pObj, oPos, FALSE, 0.0f, suppl) ) continue;
dist = Length2d(pos, oPos);
@@ -1132,7 +1118,7 @@ BOOL CTaskGoto::AdjustBuilding(D3DVECTOR &pos, float margin, float &distance)
return FALSE;
}
-// Retourne le point o� est produit ou pos� qq chose sur un b�timent.
+// Retourne le point où est produit ou posé qq chose sur un bâtiment.
BOOL CTaskGoto::GetHotPoint(CObject *pObj, D3DVECTOR &pos,
BOOL bTake, float distance, float &suppl)
@@ -1254,7 +1240,7 @@ BOOL CTaskGoto::LeakSearch(D3DVECTOR &pos, float &delay)
if ( pObj == m_object ) continue;
if ( !pObj->RetActif() ) continue;
- if ( pObj->RetTruck() != 0 ) continue; // objet port� ?
+ if ( pObj->RetTruck() != 0 ) continue; // objet porté ?
j = 0;
while ( pObj->GetCrashSphere(j++, oPos, oRadius) )
@@ -1276,7 +1262,7 @@ BOOL CTaskGoto::LeakSearch(D3DVECTOR &pos, float &delay)
}
-// Calcule la force de r�pulsion en fonction des obstacles.
+// Calcule la force de répulsion en fonction des obstacles.
// La longueur du vecteur rendu est comprise entre 0 et 1.
void CTaskGoto::ComputeRepulse(FPOINT &dir)
@@ -1337,7 +1323,7 @@ void CTaskGoto::ComputeRepulse(FPOINT &dir)
dir.x = 0.0f;
dir.y = 0.0f;
- // Le ver passe partout et � travers tout !
+ // Le ver passe partout et à travers tout !
iType = m_object->RetType();
if ( iType == OBJECT_WORM ) return;
@@ -1391,7 +1377,7 @@ void CTaskGoto::ComputeRepulse(FPOINT &dir)
add = 4.0f;
fac = 1.5f;
}
- if ( iType == OBJECT_BEE ) // gu�pe ?
+ if ( iType == OBJECT_BEE ) // guêpe ?
{
if ( m_physics->RetLand() )
{
@@ -1452,7 +1438,7 @@ void CTaskGoto::ComputeRepulse(FPOINT &dir)
if ( iType == OBJECT_BEE &&
oType == OBJECT_BEE )
{
- addi = 2.0f; // entre gu�pes, faut pas trop s'emb�ter
+ addi = 2.0f; // entre guèpes, faut pas trop s'embêter
}
j = 0;
@@ -1485,7 +1471,7 @@ void CTaskGoto::ComputeRepulse(FPOINT &dir)
#endif
}
-// Calcule la force de r�pulsion verticale en fonction des obstacles.
+// Calcule la force de répulsion verticale en fonction des obstacles.
// La longueur du vecteur rendu est comprise entre -1 et 1.
void CTaskGoto::ComputeFlyingRepulse(float &dir)
@@ -1539,8 +1525,8 @@ void CTaskGoto::ComputeFlyingRepulse(float &dir)
// Parmi tous les points suivants, cherche s'il en existe un qui
-// permet d'y aller directement � vol d'oiseau. Si oui, saute tous
-// les points interm�diaires inutiles.
+// permet d'y aller directement à vol d'oiseau. Si oui, saute tous
+// les points intermédiaires inutiles.
int CTaskGoto::BeamShortcut()
{
@@ -1550,14 +1536,14 @@ int CTaskGoto::BeamShortcut()
{
if ( BitmapTestLine(m_bmPoints[m_bmIndex], m_bmPoints[i], 0.0f, FALSE) )
{
- return i; // bingo, trouv�
+ return i; // bingo, trouvé
}
}
return m_bmIndex+1; // va simplement au point suivant
}
-// C'est le grand d�part.
+// C'est le grand départ.
void CTaskGoto::BeamStart()
{
@@ -1603,13 +1589,13 @@ void CTaskGoto::BeamInit()
}
}
-// Calcule les points par o� passer pour aller de start � goal.
+// Calcule les points par où passer pour aller de start à goal.
// Retourne :
// ERR_OK si c'est bon
// ERR_GOTO_IMPOSSIBLE si impossible
-// ERR_GOTO_ITER si avort� car trop de r�cursions
+// ERR_GOTO_ITER si avorté car trop de récursions
// ERR_CONTINUE si pas encore fini
-// goalRadius: distance � laquelle il faut s'approcher du but
+// goalRadius: distance à laquelle il faut s'approcher du but
Error CTaskGoto::BeamSearch(const D3DVECTOR &start, const D3DVECTOR &goal,
float goalRadius)
@@ -1626,13 +1612,13 @@ Error CTaskGoto::BeamSearch(const D3DVECTOR &start, const D3DVECTOR &goal,
return BeamExplore(start, start, goal, goalRadius, 165.0f*PI/180.0f, 22, step, 0, nbIter);
}
-// prevPos: position pr�c�dente
+// prevPos: position précédente
// curPos: position courante
-// goalPos: position qu'on cherche � atteindre
+// goalPos: position qu'on cherche à atteindre
// angle: angle par rapport au but qu'on explore
// nbDiv: nombre du sous-divisions qu'on fait avec angle
// step longuer d'un pas
-// i nombre de r�cursions effectu�es
+// i nombre de récursions effectuées
// nbIter nombre max. d'iterations qu'on a le droit de faire avant d'interrompre provisoirement
Error CTaskGoto::BeamExplore(const D3DVECTOR &prevPos, const D3DVECTOR &curPos,
@@ -1645,7 +1631,7 @@ Error CTaskGoto::BeamExplore(const D3DVECTOR &prevPos, const D3DVECTOR &curPos,
int iDiv, iClear, iLar;
iLar = 0;
- if ( i >= MAXPOINTS ) return ERR_GOTO_ITER; // trop de r�cursion
+ if ( i >= MAXPOINTS ) return ERR_GOTO_ITER; // trop de récursion
if ( m_bmIter[i] == -1 )
{
@@ -1723,7 +1709,7 @@ Error CTaskGoto::BeamExplore(const D3DVECTOR &prevPos, const D3DVECTOR &curPos,
return ERR_GOTO_IMPOSSIBLE;
}
-// Soit une droite "start-goal". Calcule le point situ� � la distance
+// Soit une droite "start-goal". Calcule le point situé à la distance
// "step" du point "start" et faisant un angle "angle" avec la droite.
D3DVECTOR CTaskGoto::BeamPoint(const D3DVECTOR &startPoint,
@@ -1845,7 +1831,7 @@ BOOL CTaskGoto::BitmapTestLine(const D3DVECTOR &start, const D3DVECTOR &goal,
{
x = (int)((pos.x+1600.0f)/BM_DIM_STEP);
y = (int)((pos.z+1600.0f)/BM_DIM_STEP);
- BitmapSetDot(1, x, y); // met le flag du point de d�part
+ BitmapSetDot(1, x, y); // met le flag du point de départ
}
max = (int)(dist/step);
@@ -1855,7 +1841,7 @@ BOOL CTaskGoto::BitmapTestLine(const D3DVECTOR &start, const D3DVECTOR &goal,
{
if ( i == max-1 )
{
- pos = goal; // teste le point d'arriv�e
+ pos = goal; // teste le point d'arrivée
}
else
{