|
From: julien r. <jul...@us...> - 2004-10-10 20:55:27
|
Update of /cvsroot/epfl/tggame In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16197 Modified Files: Makefile Makefile.Linux controller.h game.cc game.h model.h pawn.cc pawn.h playercontroller.cc playercontroller.h Log Message: AI Index: game.cc =================================================================== RCS file: /cvsroot/epfl/tggame/game.cc,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** game.cc 4 Oct 2004 14:51:01 -0000 1.7 --- game.cc 10 Oct 2004 20:54:47 -0000 1.8 *************** *** 91,94 **** --- 91,95 ---- vControllers.push_back(pLocalController); p->SetPosition(pWorld->GetRandomStartPosition()+Vector3(20,70,20)); + p->GetCamera()->SetPhysicCallBack(pLocalController); *************** *** 97,108 **** vPawns.push_back(p); this->AddPawn(p); ! Controller* c = new IAController(p); vControllers.push_back(c); ! p->SetPosition(pWorld->GetRandomStartPosition()+Vector3(0,70,0)); } void Game::PreFrame () { ! Camera* myCam = pSceneManager->GetCamera(); Vector3 position = myCam->GetPosition(); --- 98,111 ---- vPawns.push_back(p); this->AddPawn(p); ! Controller* c = new AIController(p); vControllers.push_back(c); ! p->SetMoveSpeed(15000); ! p->SetPosition(pWorld->GetRandomStartPosition()+Vector3(0,30,0)); ! p->GetModel()->SetPhysicCallBack(c); } void Game::PreFrame () { ! /* Camera* myCam = pSceneManager->GetCamera(); Vector3 position = myCam->GetPosition(); *************** *** 112,116 **** pSoundManager->SetListenerPosition(position.x,position.y,position.z); ! pSoundManager->SetListenerOrientation(forward.x,forward.y,forward.z,up.x,up.y,up.z); float t = pTimer->GetFrameInterval (); --- 115,119 ---- pSoundManager->SetListenerPosition(position.x,position.y,position.z); ! pSoundManager->SetListenerOrientation(forward.x,forward.y,forward.z,up.x,up.y,up.z);*/ float t = pTimer->GetFrameInterval (); Index: pawn.h =================================================================== RCS file: /cvsroot/epfl/tggame/pawn.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** pawn.h 28 Sep 2004 09:45:24 -0000 1.3 --- pawn.h 10 Oct 2004 20:54:47 -0000 1.4 *************** *** 29,35 **** --- 29,43 ---- inline void SetPosition (const Vector3& v) { pModel->SetPosition(v); if (pCamera) pCamera->SetPosition(v);} + inline Vector3 GetPosition () + { + if (pModel) return pModel->GetPosition(); + else if (pCamera) return pCamera->GetPosition(); + return Vector3::ZERO; + } + inline Camera* GetCamera () { return pCamera; } inline float GetMoveSpeed () { return fMoveSpeed; } + inline void SetMoveSpeed (float s) { fMoveSpeed = s; } Model* GetModel () { return pModel; } Index: pawn.cc =================================================================== RCS file: /cvsroot/epfl/tggame/pawn.cc,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** pawn.cc 26 Sep 2004 14:44:55 -0000 1.2 --- pawn.cc 10 Oct 2004 20:54:47 -0000 1.3 *************** *** 7,10 **** pModel = new Model ("data/models/pinky/pinky.mdl", MDL_PLAYER); pCamera = c; ! fMoveSpeed = 1.0f; } --- 7,10 ---- pModel = new Model ("data/models/pinky/pinky.mdl", MDL_PLAYER); pCamera = c; ! fMoveSpeed = 0.0f; } Index: model.h =================================================================== RCS file: /cvsroot/epfl/tggame/model.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** model.h 30 Sep 2004 10:31:42 -0000 1.4 --- model.h 10 Oct 2004 20:54:47 -0000 1.5 *************** *** 48,52 **** --- 48,57 ---- void Add(PhysicEngine* p); + /** + * SetPhysicCallBack: change la fonction appele lors de collision + */ + void SetPhysicCallBack (PhysicCallBack* p) { pMD5->SetPhysicCallBack(p); } + inline Vector3 GetPosition () { return pMD5->GetPosition(); } inline void SetPosition (const Vector3& v) { pMD5->SetPosition(v); } inline void SetAcceleration (const Vector3& v) { pMD5->vAccel = v; } Index: playercontroller.h =================================================================== RCS file: /cvsroot/epfl/tggame/playercontroller.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** playercontroller.h 24 Sep 2004 13:26:30 -0000 1.2 --- playercontroller.h 10 Oct 2004 20:54:47 -0000 1.3 *************** *** 14,17 **** --- 14,18 ---- void Think (float); void EventHandler (tgEvent& e); + void Collide(SceneNode* other, const Vector3& vPoint, const Vector3& vCollisionNormal); }; Index: playercontroller.cc =================================================================== RCS file: /cvsroot/epfl/tggame/playercontroller.cc,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** playercontroller.cc 26 Sep 2004 14:44:55 -0000 1.3 --- playercontroller.cc 10 Oct 2004 20:54:47 -0000 1.4 *************** *** 13,16 **** --- 13,21 ---- } + void PlayerController::Collide (SceneNode* other, const Vector3& vPoint, const Vector3& vCollisionNormal) + { + // std::cout << "playercontroller" << std::endl; + } + void PlayerController::EventHandler (tgEvent& e) { Index: Makefile =================================================================== RCS file: /cvsroot/epfl/tggame/Makefile,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Makefile 1 Oct 2004 20:26:03 -0000 1.6 --- Makefile 10 Oct 2004 20:54:47 -0000 1.7 *************** *** 3,7 **** ## ! all: linux clean: --- 3,7 ---- ## ! all: linuxDebug clean: Index: game.h =================================================================== RCS file: /cvsroot/epfl/tggame/game.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** game.h 2 Oct 2004 22:47:06 -0000 1.4 --- game.h 10 Oct 2004 20:54:47 -0000 1.5 *************** *** 11,18 **** #include "controller.h" #include "playercontroller.h" ! #include "iacontroller.h" #include "world.h" ! #include "SoundManager.h" using namespace tg; --- 11,18 ---- #include "controller.h" #include "playercontroller.h" ! #include "aicontroller.h" #include "world.h" ! #include "soundmanager.h" using namespace tg; *************** *** 53,56 **** --- 53,58 ---- void PostFrame (); + inline SceneManager* GetSceneManager () { return pSceneManager; } + /** * GetLocalController : retourne le controller local (celui qui reçoit les événements locaux (clavier + souris) Index: controller.h =================================================================== RCS file: /cvsroot/epfl/tggame/controller.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** controller.h 26 Sep 2004 14:44:55 -0000 1.2 --- controller.h 10 Oct 2004 20:54:47 -0000 1.3 *************** *** 4,7 **** --- 4,8 ---- #include <event.h> #include <defs.h> + #include <physiccallback.h> #include "pawn.h" *************** *** 12,16 **** * * Classe parente des robots et joueurs humains */ ! class Controller : public Actor { public: --- 13,17 ---- * * Classe parente des robots et joueurs humains */ ! class Controller : public Actor, public PhysicCallBack { public: *************** *** 20,23 **** --- 21,26 ---- virtual void EventHandler (tgEvent& e) {} virtual void MovePawn(); + + virtual void Collide(SceneNode* other, const Vector3& vPoint, const Vector3& vCollisionNormal) = 0; protected: Pawn* pPawn; Index: Makefile.Linux =================================================================== RCS file: /cvsroot/epfl/tggame/Makefile.Linux,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Makefile.Linux 27 Sep 2004 21:41:34 -0000 1.3 --- Makefile.Linux 10 Oct 2004 20:54:47 -0000 1.4 *************** *** 3,7 **** INCLUDEPATH = -I/usr/include/SDL -I./ -I../tgengine-0.1 LINKPATH = -L../tgengine-0.1/out ! LIBS = -lGL -lSDL -lGLU -ltgengine -ljpeg -lm -lSDL_image OBJ_EXT = o OBJSRC = $(wildcard *.cc) --- 3,7 ---- INCLUDEPATH = -I/usr/include/SDL -I./ -I../tgengine-0.1 LINKPATH = -L../tgengine-0.1/out ! LIBS = -lGL -lSDL -lGLU -ltgengine -ljpeg -lm -lSDL_image -lvorbis -lvorbisfile -lopenal OBJ_EXT = o OBJSRC = $(wildcard *.cc) |