00001 #ifndef _ACTOR_H
00002 #define _ACTOR_H
00003
00004 #include "Skeleton.h"
00005 #include "Skin.h"
00006 #include "net/MMNet.h"
00007 #include "math/matrix34.h"
00008 #include "actor/Token.h"
00009 #include "opengl.h"
00010 #include "sceneManagement/sceneObject.h"
00011 #include "Animation.h"
00012 #include "audio/audio.h"
00013
00014 #define ACTOR_SCALE 0.3
00015 #define ACTOR_MAX_WEAPONS 2
00016
00017 class Actor : public SceneObject {
00018 public:
00019 Actor() : feet(0), mouth(0) {}
00020 Actor(int type) : sceneObjectType(type), feet(0), mouth(0) { weapons[0] = NULL; weapons[1] = NULL; }
00021 virtual ~Actor() {
00022 if (feet)
00023 delete feet;
00024 if (mouth)
00025 delete mouth;
00026 }
00027 int objectType() { return sceneObjectType; }
00028 void init() {}
00029 void Load(char *filename);
00030 void update(float dt);
00031 void UpdateAnimations(float dt);
00032 void Pose(float time);
00033 void draw();
00034 const Vector3& getPos() const { return world.d; }
00035 const float getBottom() const { return 0.0f; }
00036 const float getTop() const { return 2.0f; }
00037 const float getRadius() const { return 1.5f; }
00038 void SetAnimations(Animation *anims) { this->anims = anims; }
00039 void SetAnimation1(char newAnim);
00040 void SetAnimation2(char newAnim);
00041
00042 void AddWeapon(Actor *weapon, int slot) {
00043 weapons[slot] = weapon;
00044 if(slot == 0)
00045 skel.joints[13].AttachObject(weapon->skel.joints);
00046 else
00047 skel.joints[17].AttachObject(weapon->skel.joints);
00048 }
00049 void SetPlayer(MMNet::Player *player);
00050
00051 void ToggleSkin() { showSkin = !showSkin; }
00052 void ToggleSkel() { showSkel = !showSkel; }
00053 public:
00054
00055 char anim1, anim2;
00056 signed char weaponState;
00057 Animation *anims;
00058 AnimPlayer animPlayer1, animPlayer2;
00059 Skin skin;
00060 Skeleton skel;
00061 Matrix34 world;
00062 bool showSkin, showSkel;
00063 MMNet::Player *player;
00064 int sceneObjectType;
00065 Actor *weapons[2];
00066 int activeWeapon;
00067
00068 private:
00069
00070 int health;
00071 MMAudio::Stream *feet;
00072 MMAudio::Source *mouth;
00073 void createFeet();
00074 void createMouth();
00075
00076 };
00077 #endif //_ACTOR_H