|
From: julien r. <jul...@us...> - 2004-11-22 21:18:56
|
Update of /cvsroot/epfl/tggame In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25646 Modified Files: aicontroller.cc aicontroller.h controller.cc controller.h game.cc playercontroller.cc playercontroller.h Log Message: bugfixes ! Index: game.cc =================================================================== RCS file: /cvsroot/epfl/tggame/game.cc,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** game.cc 20 Nov 2004 09:05:11 -0000 1.37 --- game.cc 22 Nov 2004 21:18:44 -0000 1.38 *************** *** 68,81 **** void Game::_CreatePlayers () { - //création du joueur local - //on ajoute _pas_ le pawn au scenemanager - #ifndef TGWIN32 - #define CAM_SPEED 450 - #else - #define CAM_SPEED 4500 - #endif - Camera* cam = new Camera (0.025f,CAM_SPEED, Vector3 (0, 100,0)); - - //préchargement des meshes pEngine->pMeshManager->Load("guardian", "data/models/guardian/guardian.md5mesh"); pEngine->pMeshManager->LoadAnim("guardian", "data/models/guardian/death.md5anim"); --- 68,71 ---- *************** *** 90,94 **** pEngine->pMeshManager->Load("rocket", "data/models/rocket/rocket.md5mesh"); ! //creation du joueur Pawn* p = new Pawn(); pSceneManager->SetCamera(cam); --- 80,95 ---- pEngine->pMeshManager->Load("rocket", "data/models/rocket/rocket.md5mesh"); ! ! //création du joueur local ! //on ajoute _pas_ le pawn au scenemanager ! #ifndef TGWIN32 ! #define CAM_SPEED 450 ! #else ! #define CAM_SPEED 4500 ! #endif ! Camera* cam = new Camera (0.025f,CAM_SPEED, Vector3 (0, 100,0)); ! ! //préchargement des meshes ! //creation du joueur Pawn* p = new Pawn(); pSceneManager->SetCamera(cam); *************** *** 105,108 **** --- 106,110 ---- p->SetMoveSpeed (CAM_SPEED); p->SetVisible(false); + p->SetClip(true); //p->GetCamera()->SetPhysicCallBack(pLocalController); *************** *** 117,121 **** p->SetMoveSpeed(CAM_SPEED); p->SetVelocity(Vector3(0,0,0)); ! //p->SetRotation(Quaternion(-90, Vector3(1,0,0))); p->SetPosition(pWorld->GetStartPosition(0)); p->SetBB(Vector3(-15, 0, -15), Vector3(15, 80, 15)); --- 119,123 ---- p->SetMoveSpeed(CAM_SPEED); p->SetVelocity(Vector3(0,0,0)); ! //p->SetRotation(Quaternion(-90, Vector3::UNIT_X)); p->SetPosition(pWorld->GetStartPosition(0)); p->SetBB(Vector3(-15, 0, -15), Vector3(15, 80, 15)); Index: controller.h =================================================================== RCS file: /cvsroot/epfl/tggame/controller.h,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** controller.h 17 Nov 2004 23:12:56 -0000 1.11 --- controller.h 22 Nov 2004 21:18:44 -0000 1.12 *************** *** 30,34 **** protected: Pawn* pPawn; ! bool bDir[4]; int iLife; --- 30,34 ---- protected: Pawn* pPawn; ! bool bDir[6]; int iLife; Index: aicontroller.h =================================================================== RCS file: /cvsroot/epfl/tggame/aicontroller.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** aicontroller.h 17 Nov 2004 23:12:56 -0000 1.8 --- aicontroller.h 22 Nov 2004 21:18:44 -0000 1.9 *************** *** 11,14 **** --- 11,16 ---- static int STRAFELEFT; static int STRAFERIGHT; + static int JUMP; + static int CROUCH; DebugSphere* pSphere; Index: playercontroller.h =================================================================== RCS file: /cvsroot/epfl/tggame/playercontroller.h,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** playercontroller.h 17 Nov 2004 23:12:56 -0000 1.11 --- playercontroller.h 22 Nov 2004 21:18:44 -0000 1.12 *************** *** 19,22 **** --- 19,24 ---- static int STRAFELEFT; static int STRAFERIGHT; + static int JUMP; + static int CROUCH; RocketLauncher* pRocketLauncher; *************** *** 32,36 **** void Exec (const std::string& s, int arg) { switch(arg) { ! case CLIP: pPawn->SetClip(pPawn->GetClip() ? false:true); break; default: break; } --- 34,38 ---- void Exec (const std::string& s, int arg) { switch(arg) { ! case CLIP: pPawn->SetClip(pPawn->GetClip()?false:true); break; default: break; } Index: playercontroller.cc =================================================================== RCS file: /cvsroot/epfl/tggame/playercontroller.cc,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** playercontroller.cc 19 Nov 2004 12:05:14 -0000 1.21 --- playercontroller.cc 22 Nov 2004 21:18:44 -0000 1.22 *************** *** 9,12 **** --- 9,14 ---- int PlayerController::STRAFELEFT = 2; int PlayerController::STRAFERIGHT = 3; + int PlayerController::JUMP = 4; + int PlayerController::CROUCH = 5; PlayerController::PlayerController(Pawn* p) : Controller (p) *************** *** 124,127 **** --- 126,135 ---- SoundManager::pSoundManager->PlaySound("step"); break; + case TGKEY_SPACE: + bDir[JUMP] = true; + break; + case TGKEY_LCTRL: + bDir[CROUCH] = true; + break; case TGKEY_RIGHT: pPawn->SetPosition(Game::pSelf->GetWorld()->GetRandomStartPosition()+Vector3(20,80,20)); *************** *** 153,156 **** --- 161,170 ---- SoundManager::pSoundManager->StopSound("step"); break; + case TGKEY_SPACE: + bDir[JUMP] = false; + break; + case TGKEY_LCTRL: + bDir[CROUCH] = false; + break; default: break; Index: controller.cc =================================================================== RCS file: /cvsroot/epfl/tggame/controller.cc,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** controller.cc 17 Nov 2004 23:12:56 -0000 1.12 --- controller.cc 22 Nov 2004 21:18:44 -0000 1.13 *************** *** 10,14 **** vViewOffset.Null(); //iForward = iStrafe = 0; ! for (int i=0; i<4; i++) { bDir[i] = false; } --- 10,14 ---- vViewOffset.Null(); //iForward = iStrafe = 0; ! for (int i=0; i<6; i++) { bDir[i] = false; } *************** *** 29,40 **** vLastVel.Null(); ! Vector3 x, z; //x = rot.Rotate(Vector3::UNIT_X); //z = rot.Rotate(Vector3::UNIT_Z); x = rot.GetXAxis(); z = rot.GetZAxis(); ! //le joueur ne peut pas choisir de se déplacer sur les y (vertical) ! x.y = 0; ! z.y = 0; if (bDir[0]) vLastVel = vVelocity -= z*fSpeed; --- 29,47 ---- vLastVel.Null(); ! Vector3 x, z, y; //x = rot.Rotate(Vector3::UNIT_X); //z = rot.Rotate(Vector3::UNIT_Z); x = rot.GetXAxis(); z = rot.GetZAxis(); ! y = rot.GetYAxis(); ! //le joueur ne peut pas choisir de se déplacer sur les y en avancant/reculant s'il 'clip'(vertical) ! /*if (pPawn->GetClip()) ! { ! x.y = 0; ! z.y = 0; ! }*/ ! ! y.x = 0; ! y.z = 0; if (bDir[0]) vLastVel = vVelocity -= z*fSpeed; *************** *** 45,48 **** --- 52,59 ---- if (bDir[3]) vLastVel = vVelocity += x*fSpeed; + if (bDir[4]) + vLastVel = vVelocity += y*fSpeed; + if (bDir[5]) + vLastVel = vVelocity -= y*fSpeed; pPawn->SetVelocity(pPawn->GetVelocity()+vVelocity); Index: aicontroller.cc =================================================================== RCS file: /cvsroot/epfl/tggame/aicontroller.cc,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** aicontroller.cc 19 Nov 2004 12:05:14 -0000 1.13 --- aicontroller.cc 22 Nov 2004 21:18:44 -0000 1.14 *************** *** 15,18 **** --- 15,20 ---- int AIController::STRAFELEFT = 0; int AIController::STRAFERIGHT = 1; + int AIController::JUMP = 4; + int AIController::CROUCH = 5; AIController::AIController(Pawn* p) : Controller(p) *************** *** 38,41 **** --- 40,52 ---- } + static float rotY = 0.0f; + float test = Util::Random(); + if (test < 0.5f) + test *= -1; + + rotY += test; + + pPawn->SetRotation(Quaternion(rotY, Vector3::UNIT_Y)); + //bDir[FORWARD] = 1; /* *************** *** 44,48 **** */ // Vector3 pos = pPawn->GetPosition(); // position du perso AI ! Vector3 vPos = Game::pSelf->GetSceneManager()->GetCamera()->GetPosition(); // position de la camera Vector3 vCentre = Game::pSelf->GetSceneManager()->Trace(vPos, --- 55,59 ---- */ // Vector3 pos = pPawn->GetPosition(); // position du perso AI ! /* Vector3 vPos = Game::pSelf->GetSceneManager()->GetCamera()->GetPosition(); // position de la camera Vector3 vCentre = Game::pSelf->GetSceneManager()->Trace(vPos, *************** *** 57,61 **** << " Position : " << vPos << " Distance : " << abs(fVarZ) << std::endl; ! #endif //pPawn->SetRotation(Quaternion(rot++, Vector3::UNIT_Y)); --- 68,72 ---- << " Position : " << vPos << " Distance : " << abs(fVarZ) << std::endl; ! #endif*/ //pPawn->SetRotation(Quaternion(rot++, Vector3::UNIT_Y)); |