Comments translated from French to English.
parent
30d4724c6b
commit
eadbe30bf0
|
@ -12,7 +12,9 @@
|
||||||
// * GNU General Public License for more details.
|
// * GNU General Public License for more details.
|
||||||
// *
|
// *
|
||||||
// * You should have received a copy of the GNU General Public License
|
// * You should have received a copy of the GNU General Public License
|
||||||
// * along with this program. If not, see http://www.gnu.org/licenses/.// taskpen.cpp
|
// * along with this program. If not, see http://www.gnu.org/licenses/.
|
||||||
|
|
||||||
|
// taskpen.cpp
|
||||||
|
|
||||||
#define STRICT
|
#define STRICT
|
||||||
#define D3D_OVERLOADS
|
#define D3D_OVERLOADS
|
||||||
|
@ -41,7 +43,7 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Constructeur de l'objet.
|
// Object's constructor.
|
||||||
|
|
||||||
CTaskPen::CTaskPen(CInstanceManager* iMan, CObject* object)
|
CTaskPen::CTaskPen(CInstanceManager* iMan, CObject* object)
|
||||||
: CTask(iMan, object)
|
: CTask(iMan, object)
|
||||||
|
@ -49,14 +51,14 @@ CTaskPen::CTaskPen(CInstanceManager* iMan, CObject* object)
|
||||||
CTask::CTask(iMan, object);
|
CTask::CTask(iMan, object);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Destructeur de l'objet.
|
// Object's destructor.
|
||||||
|
|
||||||
CTaskPen::~CTaskPen()
|
CTaskPen::~CTaskPen()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Gestion d'un événement.
|
// Management of an event.
|
||||||
|
|
||||||
BOOL CTaskPen::EventProcess(const Event &event)
|
BOOL CTaskPen::EventProcess(const Event &event)
|
||||||
{
|
{
|
||||||
|
@ -74,13 +76,13 @@ BOOL CTaskPen::EventProcess(const Event &event)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_progress += event.rTime*(1.0f/m_delay); // ça avance
|
m_progress += event.rTime*(1.0f/m_delay); // others advance
|
||||||
if ( m_progress > 1.0f ) m_progress = 1.0f;
|
if ( m_progress > 1.0f ) m_progress = 1.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_time += event.rTime;
|
m_time += event.rTime;
|
||||||
|
|
||||||
if ( m_phase == TPP_UP ) // remonte le crayon ?
|
if ( m_phase == TPP_UP ) // back the pencil
|
||||||
{
|
{
|
||||||
i = AngleToRank(m_object->RetAngleY(1));
|
i = AngleToRank(m_object->RetAngleY(1));
|
||||||
pos = m_object->RetPosition(10+i);
|
pos = m_object->RetPosition(10+i);
|
||||||
|
@ -88,7 +90,7 @@ BOOL CTaskPen::EventProcess(const Event &event)
|
||||||
m_object->SetPosition(10+i, pos);
|
m_object->SetPosition(10+i, pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( m_phase == TPP_TURN ) // tourne le carrousel ?
|
if ( m_phase == TPP_TURN ) // turns the carousel?
|
||||||
{
|
{
|
||||||
if ( m_lastParticule+m_engine->ParticuleAdapt(0.05f) <= m_time )
|
if ( m_lastParticule+m_engine->ParticuleAdapt(0.05f) <= m_time )
|
||||||
{
|
{
|
||||||
|
@ -108,7 +110,7 @@ BOOL CTaskPen::EventProcess(const Event &event)
|
||||||
m_object->SetAngleY(1, m_oldAngle+(m_newAngle-m_oldAngle)*m_progress);
|
m_object->SetAngleY(1, m_oldAngle+(m_newAngle-m_oldAngle)*m_progress);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( m_phase == TPP_DOWN ) // descend le crayon ?
|
if ( m_phase == TPP_DOWN ) // down the pencil?
|
||||||
{
|
{
|
||||||
if ( m_lastParticule+m_engine->ParticuleAdapt(0.05f) <= m_time )
|
if ( m_lastParticule+m_engine->ParticuleAdapt(0.05f) <= m_time )
|
||||||
{
|
{
|
||||||
|
@ -142,7 +144,7 @@ BOOL CTaskPen::EventProcess(const Event &event)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Assigne le but à atteindre.
|
// Assigns the goal has achieved.
|
||||||
|
|
||||||
Error CTaskPen::Start(BOOL bDown, int color)
|
Error CTaskPen::Start(BOOL bDown, int color)
|
||||||
{
|
{
|
||||||
|
@ -151,7 +153,7 @@ Error CTaskPen::Start(BOOL bDown, int color)
|
||||||
ObjectType type;
|
ObjectType type;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
m_bError = TRUE; // opération impossible
|
m_bError = TRUE; // operation impossible
|
||||||
|
|
||||||
type = m_object->RetType();
|
type = m_object->RetType();
|
||||||
if ( type != OBJECT_MOBILEdr ) return ERR_FIRE_VEH;
|
if ( type != OBJECT_MOBILEdr ) return ERR_FIRE_VEH;
|
||||||
|
@ -164,16 +166,16 @@ Error CTaskPen::Start(BOOL bDown, int color)
|
||||||
i = AngleToRank(m_oldAngle);
|
i = AngleToRank(m_oldAngle);
|
||||||
pos = m_object->RetPosition(10+i);
|
pos = m_object->RetPosition(10+i);
|
||||||
|
|
||||||
if ( pos.y == 0.0f ) // crayon en haut ?
|
if ( pos.y == 0.0f ) // pencil at the top?
|
||||||
{
|
{
|
||||||
m_timeUp = 0.0f;
|
m_timeUp = 0.0f;
|
||||||
}
|
}
|
||||||
else // crayon en bas ?
|
else // pencil on the bottom?
|
||||||
{
|
{
|
||||||
m_timeUp = 1.0f; // faut le remonter
|
m_timeUp = 1.0f; // must rise up
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( bDown ) // faudra-t-il le descendre en dernier ?
|
if ( bDown ) // must go down ?
|
||||||
{
|
{
|
||||||
m_timeDown = 0.7f;
|
m_timeDown = 0.7f;
|
||||||
}
|
}
|
||||||
|
@ -184,7 +186,7 @@ Error CTaskPen::Start(BOOL bDown, int color)
|
||||||
|
|
||||||
mat = m_object->RetWorldMatrix(0);
|
mat = m_object->RetWorldMatrix(0);
|
||||||
pos = D3DVECTOR(-3.0f, 7.0f, 0.0f);
|
pos = D3DVECTOR(-3.0f, 7.0f, 0.0f);
|
||||||
pos = Transform(*mat, pos); // position carrousel
|
pos = Transform(*mat, pos); // position of carousel
|
||||||
m_supportPos = pos;
|
m_supportPos = pos;
|
||||||
|
|
||||||
m_phase = TPP_UP;
|
m_phase = TPP_UP;
|
||||||
|
@ -204,7 +206,7 @@ Error CTaskPen::Start(BOOL bDown, int color)
|
||||||
return ERR_OK;
|
return ERR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Indique si l'action est terminée.
|
// Indicates whether the action is finished.
|
||||||
|
|
||||||
Error CTaskPen::IsEnded()
|
Error CTaskPen::IsEnded()
|
||||||
{
|
{
|
||||||
|
@ -243,7 +245,7 @@ Error CTaskPen::IsEnded()
|
||||||
return ERR_STOP;
|
return ERR_STOP;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Termine brutalement l'action en cours.
|
// Suddenly ends the current action.
|
||||||
|
|
||||||
BOOL CTaskPen::Abort()
|
BOOL CTaskPen::Abort()
|
||||||
{
|
{
|
||||||
|
@ -252,7 +254,7 @@ BOOL CTaskPen::Abort()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Fait entendre le son du bras manipulateur.
|
// Plays the sound of the manipulator arm.
|
||||||
|
|
||||||
void CTaskPen::SoundManip(float time, float amplitude, float frequency)
|
void CTaskPen::SoundManip(float time, float amplitude, float frequency)
|
||||||
{
|
{
|
||||||
|
@ -265,7 +267,7 @@ void CTaskPen::SoundManip(float time, float amplitude, float frequency)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Conversion d'un angle en numéro de crayon.
|
// Converting a angle to number of pencil.
|
||||||
|
|
||||||
int CTaskPen::AngleToRank(float angle)
|
int CTaskPen::AngleToRank(float angle)
|
||||||
{
|
{
|
||||||
|
@ -275,14 +277,14 @@ int CTaskPen::AngleToRank(float angle)
|
||||||
return (int)(angle/(45.0f*PI/180.0f));
|
return (int)(angle/(45.0f*PI/180.0f));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Conversion d'une couleur en angle pour le carrousel de crayons.
|
// Converting a color to the angle of carousel of pencils.
|
||||||
|
|
||||||
float CTaskPen::ColorToAngle(int color)
|
float CTaskPen::ColorToAngle(int color)
|
||||||
{
|
{
|
||||||
return -45.0f*PI/180.0f*ColorToRank(color);
|
return -45.0f*PI/180.0f*ColorToRank(color);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Conversion d'une couleur en numéro de crayon (0..7).
|
// Converting a color number to the pencil (0 .. 7).
|
||||||
|
|
||||||
int CTaskPen::ColorToRank(int color)
|
int CTaskPen::ColorToRank(int color)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue