|
From: Yohann C. <pl...@us...> - 2004-12-01 18:56:59
|
Update of /cvsroot/epfl/tggame In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29861 Modified Files: Makefile.Linux aicontroller.cc game.cc Log Message: Et notre guardian devient une boule de billard.... Index: game.cc =================================================================== RCS file: /cvsroot/epfl/tggame/game.cc,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** game.cc 30 Nov 2004 18:22:00 -0000 1.40 --- game.cc 1 Dec 2004 18:56:48 -0000 1.41 *************** *** 9,19 **** pTimer = new Timer (); pEngine = new Engine (pTimer); ! //On cree un nouveau soundmanager pSoundManager = new SoundManager(); ! Engine::pEngine = pEngine; ! ! pSceneManager = new SceneManager (pTimer); pPhysicEngine = new PhysicEngine (); --- 9,19 ---- pTimer = new Timer (); pEngine = new Engine (pTimer); ! //On cree un nouveau soundmanager pSoundManager = new SoundManager(); ! Engine::pEngine = pEngine; ! ! pSceneManager = new SceneManager (pTimer); pPhysicEngine = new PhysicEngine (); *************** *** 29,40 **** std::string mapname = "data/maps/"; if (argc < 2) ! mapname += "test.bsp"; else mapname += argv[1]; ! pWorld = new World((char*)mapname.data()); pWorld->Add(pSceneManager); _CreatePlayers (); ! SoundManager::pSoundManager = pSoundManager; } --- 29,40 ---- std::string mapname = "data/maps/"; if (argc < 2) ! mapname += "epfl_co.bsp"; else mapname += argv[1]; ! pWorld = new World((char*)mapname.data()); pWorld->Add(pSceneManager); _CreatePlayers (); ! SoundManager::pSoundManager = pSoundManager; } *************** *** 79,83 **** return NULL; } ! else return i->second; --- 79,83 ---- return NULL; } ! else return i->second; *************** *** 95,101 **** pEngine->pMeshManager->LoadAnim("pinky", "data/models/player/stand.md5anim"); pEngine->pMeshManager->LoadAnim("pinky", "data/models/player/death.md5anim"); ! pEngine->pMeshManager->Load("rocket", "data/models/rocket/rocket.md5mesh"); ! //création du joueur local --- 95,101 ---- pEngine->pMeshManager->LoadAnim("pinky", "data/models/player/stand.md5anim"); pEngine->pMeshManager->LoadAnim("pinky", "data/models/player/death.md5anim"); ! pEngine->pMeshManager->Load("rocket", "data/models/rocket/rocket.md5mesh"); ! //création du joueur local *************** *** 125,129 **** p->SetVisible(false); //p->GetCamera()->SetPhysicCallBack(pLocalController); ! //création d'un ennemi //for (int i=0; i<pWorld->GetNumStartPositions(); i++) --- 125,129 ---- p->SetVisible(false); //p->GetCamera()->SetPhysicCallBack(pLocalController); ! //création d'un ennemi //for (int i=0; i<pWorld->GetNumStartPositions(); i++) *************** *** 138,141 **** --- 138,142 ---- //p->SetRotation(Quaternion(-90, Vector3::UNIT_X)); p->SetPosition(pWorld->GetStartPosition(0)); + p->SetPosition (Vector3(-80,80,100)); p->SetBB(Vector3(-15, 0, -15), Vector3(15, 80, 15)); c->SetViewOffset(Vector3(0,70,0)); *************** *** 156,160 **** { pSoundManager->UpdateListener(pSceneManager->GetCamera()); ! float t = pTimer->GetFrameInterval (); for (unsigned int i=0; i<vControllers.size(); i++) --- 157,161 ---- { pSoundManager->UpdateListener(pSceneManager->GetCamera()); ! float t = pTimer->GetFrameInterval (); for (unsigned int i=0; i<vControllers.size(); i++) Index: Makefile.Linux =================================================================== RCS file: /cvsroot/epfl/tggame/Makefile.Linux,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Makefile.Linux 17 Nov 2004 23:12:55 -0000 1.7 --- Makefile.Linux 1 Dec 2004 18:56:48 -0000 1.8 *************** *** 13,18 **** all: $(OBJS) ! g++ -o tg $(INCLUDEPATH) $(LINKPATH) $(LIBS) $(OBJS) ! clean: rm -f tg --- 13,18 ---- all: $(OBJS) ! g++ -o tg $(INCLUDEPATH) $(LINKPATH) $(LIBS) $(OBJS) ! clean: rm -f tg Index: aicontroller.cc =================================================================== RCS file: /cvsroot/epfl/tggame/aicontroller.cc,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** aicontroller.cc 30 Nov 2004 18:22:00 -0000 1.15 --- aicontroller.cc 1 Dec 2004 18:56:48 -0000 1.16 *************** *** 18,21 **** --- 18,23 ---- int AIController::CROUCH = 5; + int iDirection; + AIController::AIController(Pawn* p) : Controller(p) { *************** *** 41,85 **** 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; - - /* - if (!initialised) // A mettre ailleurs... mais je ne vais pas hacker tggame.. je laisse ca aux experts ;) - AIController::Initialize(); */ ! // 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, ! vPos + ( Vector3::UNIT_Z*(-1000000) ) ).EndPoint; ! ! float fVarX = vCentre.x - vPos.x; ! float fVarZ = vCentre.z - vPos.z; ! float fDist = sqrt(fVarX*fVarX + fVarZ*fVarZ); ! #if AI_DEBUG >= 5 ! std::cout << "[AI] EndPoint Z: " << vCentre.z ! << " Position : " << vPos ! << " Distance : " << abs(fVarZ) << std::endl; ! #endif*/ - //pPawn->SetRotation(Quaternion(rot++, Vector3::UNIT_Y)); - //rot=rot%360; - //bDir[STRAFELEFT]=1; } ! #if 0 void AIController::Collide (PhysicNode* other, const Vector3& vPoint, const Vector3& vCollisionNormal) { if (other == NULL) //si on a une collision avec la map, on ne prend pas de degats return; ! iLife -= 5; std::cout << "OUCH" << std::endl; if (!bAlive) { --- 43,68 ---- static float rotY = 0.0f; ! static float test = 0.5f; ! /* float test = Util::Random(); if (test < 0.5f) test *= -1; */ ! bDir[FORWARD]=1; ! //bDir[FORWARD] = 1; } ! void AIController::Collide (PhysicNode* other, const Vector3& vPoint, const Vector3& vCollisionNormal) { + pPawn->SetRotation(Quaternion(Util::Random()*360, Vector3::UNIT_Y)); + + /* if (other == NULL) //si on a une collision avec la map, on ne prend pas de degats return; ! iLife -= 5; std::cout << "OUCH" << std::endl; + if (!bAlive) { *************** *** 92,97 **** bAlive = false; } } ! #endif void AIController::Initialize() { --- 75,81 ---- bAlive = false; } + */ } ! void AIController::Initialize() { *************** *** 100,103 **** --- 84,88 ---- #endif initialised=true; + pPawn->SetRotation(Quaternion(180, Vector3::UNIT_Y)); srand( (unsigned)time( NULL ) ); } |