From 84d1f79fdf02e0010e4b2d118458e8cd8ce0dd71 Mon Sep 17 00:00:00 2001 From: Krzysztof H Date: Fri, 9 Mar 2012 17:08:05 +0100 Subject: Added license info using a small program SrcHead. --- src/motionspider.cpp | 74 +++++++++++++++++++++++++++++++--------------------- 1 file changed, 44 insertions(+), 30 deletions(-) (limited to 'src/motionspider.cpp') diff --git a/src/motionspider.cpp b/src/motionspider.cpp index dee9391..872c12e 100644 --- a/src/motionspider.cpp +++ b/src/motionspider.cpp @@ -1,4 +1,18 @@ -// motionspider.cpp +// * 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 . #define STRICT #define D3D_OVERLOADS @@ -28,7 +42,7 @@ #define ADJUST_ANGLE FALSE // TRUE -> ajuste les angles des membres -#define START_TIME 1000.0f // début du temps relatif +#define START_TIME 1000.0f // d�but du temps relatif @@ -65,7 +79,7 @@ void CMotionSpider::DeleteObject(BOOL bAll) } -// Crée un véhicule roulant quelconque posé sur le sol. +// Cr�e un v�hicule roulant quelconque pos� sur le sol. BOOL CMotionSpider::Create(D3DVECTOR pos, float angle, ObjectType type, float power) @@ -77,12 +91,12 @@ BOOL CMotionSpider::Create(D3DVECTOR pos, float angle, ObjectType type, float table[] = { // x y z - 0.6f, 0.0f, 0.0f, // patte arrière + 0.6f, 0.0f, 0.0f, // patte arri�re 0.0f, 0.0f, -2.0f, 0.0f, 0.0f, -2.0f, 0.0f, 0.0f, -2.0f, - 0.8f, 0.0f, -0.2f, // patte arrière-milieu + 0.8f, 0.0f, -0.2f, // patte arri�re-milieu 0.0f, 0.0f, -2.0f, 0.0f, 0.0f, -2.0f, 0.0f, 0.0f, -2.0f, @@ -104,7 +118,7 @@ BOOL CMotionSpider::Create(D3DVECTOR pos, float angle, ObjectType type, m_object->SetType(type); - // Crée la base principale. + // Cr�e la base principale. rank = m_engine->CreateObject(); m_engine->SetObjectType(rank, TYPEVEHICULE); // c'est un objet mobile m_object->SetObjectRank(0, rank); @@ -113,12 +127,12 @@ BOOL CMotionSpider::Create(D3DVECTOR pos, float angle, ObjectType type, m_object->SetPosition(0, pos); m_object->SetAngleY(0, angle); - // Un véhicule doit avoir obligatoirement une sphère de + // Un v�hicule doit avoir obligatoirement une sph�re de // collision avec un centre (0;y;0) (voir GetCrashSphere). m_object->CreateCrashSphere(D3DVECTOR(0.0f, -2.0f, 0.0f), 4.0f, SOUND_BOUM, 0.20f); m_object->SetGlobalSphere(D3DVECTOR(-0.5f, 1.0f, 0.0f), 4.0f); - // Crée l'abdomen. + // Cr�e l'abdomen. rank = m_engine->CreateObject(); m_engine->SetObjectType(rank, TYPEDESCENDANT); m_object->SetObjectRank(1, rank); @@ -127,7 +141,7 @@ BOOL CMotionSpider::Create(D3DVECTOR pos, float angle, ObjectType type, pModFile->CreateEngineObject(rank); m_object->SetPosition(1, D3DVECTOR(1.0f, 0.0f, 0.0f)); - // Crée la tête. + // Cr�e la t�te. rank = m_engine->CreateObject(); m_engine->SetObjectType(rank, TYPEDESCENDANT); m_object->SetObjectRank(2, rank); @@ -136,14 +150,14 @@ BOOL CMotionSpider::Create(D3DVECTOR pos, float angle, ObjectType type, pModFile->CreateEngineObject(rank); m_object->SetPosition(2, D3DVECTOR(1.0f, 0.0f, 0.0f)); - // Crée les pattes. + // Cr�e les pattes. for ( i=0 ; i<4 ; i++ ) { for ( j=0 ; j<4 ; j++ ) { sprintf(name, "objects\\spider%d.mod", j+3); // 3..6 - // Crée la patte droite. + // Cr�e la patte droite. rank = m_engine->CreateObject(); m_engine->SetObjectType(rank, TYPEDESCENDANT); m_object->SetObjectRank(3+i*4+j, rank); @@ -157,7 +171,7 @@ BOOL CMotionSpider::Create(D3DVECTOR pos, float angle, ObjectType type, pos.z = table[i*12+j*3+2]; m_object->SetPosition(3+i*4+j, pos); - // Crée la patte gauche. + // Cr�e la patte gauche. rank = m_engine->CreateObject(); m_engine->SetObjectType(rank, TYPEDESCENDANT); m_object->SetObjectRank(19+i*4+j, rank); @@ -174,7 +188,7 @@ BOOL CMotionSpider::Create(D3DVECTOR pos, float angle, ObjectType type, } } - // Crée la mandibule droite. + // Cr�e la mandibule droite. rank = m_engine->CreateObject(); m_engine->SetObjectType(rank, TYPEDESCENDANT); m_object->SetObjectRank(35, rank); @@ -183,7 +197,7 @@ BOOL CMotionSpider::Create(D3DVECTOR pos, float angle, ObjectType type, pModFile->CreateEngineObject(rank); m_object->SetPosition(35, D3DVECTOR(0.0f, 0.0f, -0.3f)); - // Crée la mandibule gauche. + // Cr�e la mandibule gauche. rank = m_engine->CreateObject(); m_engine->SetObjectType(rank, TYPEDESCENDANT); m_object->SetObjectRank(36, rank); @@ -207,7 +221,7 @@ BOOL CMotionSpider::Create(D3DVECTOR pos, float angle, ObjectType type, return TRUE; } -// Crée la physique de l'objet. +// Cr�e la physique de l'objet. void CMotionSpider::CreatePhysics() { @@ -226,7 +240,7 @@ void CMotionSpider::CreatePhysics() -10,40,0, -45,0,0, -45,0,0, -45,-40,0, // t1: jambes 1..4 -90,0,0, -20,0,0, -20,0,0, -20,0,0, // t1: pieds 1..4 -5,0,0, -5,0,0, -5,0,0, -5,0,0, // t1: doigt 1..4 - // au sol derrière : + // au sol derri�re : 35,35,0, 40,10,0, 40,-15,0, 40,-40,0, // t2: cuisses 1..4 -35,40,0, -35,0,0, -35,0,0, -25,-40,0, // t2: jambes 1..4 -50,-25,-30,-65,0,0, -65,0,0, -90,0,30, // t2: pieds 1..4 @@ -245,7 +259,7 @@ void CMotionSpider::CreatePhysics() -30,40,0, -40,0,0, -40,0,0, -40,-40,0, // t1: jambes 1..4 -55,-25,-30,-25,0,0, -25,0,0, -25,0,0, // t1: pieds 1..4 -5,0,0, -5,0,0, -5,0,0, -5,0,0, // t1: doigt 1..4 - // au sol derrière : + // au sol derri�re : 35,35,0, 30,0,0, 30,-25,0, 30,-50,0, // t2: cuisses 1..4 -30,40,0, -40,0,0, -40,0,0, -40,-40,0, // t2: jambes 1..4 -50,-25,-30,-20,0,0, -20,0,0, -20,0,30, // t2: pieds 1..4 @@ -254,7 +268,7 @@ void CMotionSpider::CreatePhysics() int member_spec[] = { - // x1,y1,z1, x2,y2,z2, x3,y3,z3, x4,y4,z4, // brûle : + // x1,y1,z1, x2,y2,z2, x3,y3,z3, x4,y4,z4, // br�le : 30,25,0, 30,0,0, 30,-25,0, 30,-50,0, // s0: cuisses 1..4 -45,0,0, -45,0,0, -45,0,0, -45,0,0, // s0: jambes 1..4 -20,0,0, -20,0,0, -20,0,0, -20,0,0, // s0: pieds 1..4 @@ -327,7 +341,7 @@ void CMotionSpider::CreatePhysics() } -// Gestion d'un événement. +// Gestion d'un �v�nement. BOOL CMotionSpider::EventProcess(const Event &event) { @@ -373,7 +387,7 @@ BOOL CMotionSpider::EventProcess(const Event &event) } // Calcule une valeur (radians) proportionnelle comprise -// entre a et b (degrés). +// entre a et b (degr�s). inline float Propf(float a, float b, float p) { @@ -385,7 +399,7 @@ inline float Propf(float a, float b, float p) return aa+p*(bb-aa); } -// Gestion d'un événement. +// Gestion d'un �v�nement. BOOL CMotionSpider::EventFrame(const Event &event) { @@ -409,7 +423,7 @@ BOOL CMotionSpider::EventFrame(const Event &event) m_armTimeMarch += (s)*event.rTime*0.15f; m_armMember += (s+a)*event.rTime*0.15f; - bStop = ( a == 0.0f && s == 0.0f ); // a l'arrêt ? + bStop = ( a == 0.0f && s == 0.0f ); // a l'arr�t ? action = MS_MARCH; // marche if ( s == 0.0f && a == 0.0f ) @@ -421,7 +435,7 @@ BOOL CMotionSpider::EventFrame(const Event &event) { prog = Mod(m_armTimeAbs, 2.0f)/10.0f; a = Mod(m_armMember, 1.0f); - a = (prog-a)*event.rTime*2.0f; // vient gentiment à position stop + a = (prog-a)*event.rTime*2.0f; // vient gentiment � position stop m_armMember += a; } @@ -429,7 +443,7 @@ BOOL CMotionSpider::EventFrame(const Event &event) { m_actionType = MSS_RUIN; } - if ( m_object->RetBurn() ) // brûle ? + if ( m_object->RetBurn() ) // br�le ? { if ( m_object->RetFixed() ) { @@ -443,7 +457,7 @@ BOOL CMotionSpider::EventFrame(const Event &event) for ( i=0 ; i<8 ; i++ ) // les 8 pattes { - if ( m_actionType != -1 ) // action spéciale en cours ? + if ( m_actionType != -1 ) // action sp�ciale en cours ? { st = 3*4*4*3*MS_SPEC + 3*4*4*m_actionType + (i%4)*3; nd = st; @@ -565,7 +579,7 @@ BOOL CMotionSpider::EventFrame(const Event &event) } #endif - if ( m_actionType == MSS_BURN ) // brûle ? + if ( m_actionType == MSS_BURN ) // br�le ? { dir = D3DVECTOR(PI, 0.0f, 0.0f); SetCirVibration(dir); @@ -574,7 +588,7 @@ BOOL CMotionSpider::EventFrame(const Event &event) SetInclinaison(dir); time = event.rTime*1.0f; - m_object->SetAngleZ(1, Smooth(m_object->RetAngleZ(1), 0.0f, time)); // tête + m_object->SetAngleZ(1, Smooth(m_object->RetAngleZ(1), 0.0f, time)); // t�te } else if ( m_actionType == MSS_RUIN ) // ruine ? { @@ -676,9 +690,9 @@ BOOL CMotionSpider::EventFrame(const Event &event) SetInclinaison(dir); m_object->SetAngleY(1, sinf(m_armTimeAbs*5.0f)*0.05f); // queue - m_object->SetAngleY(2, cosf(m_armTimeAbs*5.0f)*0.20f); // tête + m_object->SetAngleY(2, cosf(m_armTimeAbs*5.0f)*0.20f); // t�te m_object->SetAngleZ(1, 0.4f); // queue - m_object->SetAngleZ(2, 0.0f); // tête + m_object->SetAngleZ(2, 0.0f); // t�te if ( m_progress >= 1.0f ) { @@ -760,7 +774,7 @@ BOOL CMotionSpider::EventFrame(const Event &event) m_object->SetAngleY(1, sinf(m_armTimeAbs*2.4f)*0.10f); m_object->SetZoom(1, 1.0f+sinf(m_armTimeAbs*3.3f)*0.05f); - m_object->SetAngleZ(2, sinf(m_armTimeAbs*1.4f)*0.20f); // tête + m_object->SetAngleZ(2, sinf(m_armTimeAbs*1.4f)*0.20f); // t�te m_object->SetAngleX(2, sinf(m_armTimeAbs*1.9f)*0.10f); m_object->SetAngleY(2, sinf(m_armTimeAbs*2.1f)*0.10f); -- cgit v1.2.3-1-g7c22