#ifndef __NPC_H__ #define __NPC_H__ #include #include #include "playerlocation.h" #include "conversation.h" #include "coursecity.h" #define MAXTEXTSIZE 1024 class coursecity; struct NPCState { int id; //10000 and 10001 are reserved for players int type; //-1 means dead/null npc, 0+ is the type of npc int state; int model; //index to the model list (render GL simple model for invalid index) int frame; //current frame for animated 3ds model, each npc has it's own count char *text; bool talking; vector3f loc; float theta, phi; }; struct NPCModel{ char* filename; //pathname, for dir of frames Lib3dsFile **files; //index from 0 to totalFrames-1 float theta, phi; vector3f loc; float scale; int totalFrames; //counting the zero frame }; //note: the player is stored in the coursemap as an object with npcid 10000 or 10001. //do not make npc's with these id's class NPC{ public: NPC(); virtual ~NPC(); void SetDefaultMaterial(); bool Init(const char* npcFilename, conversation *conversationptr, coursecity *courseptr); void RenderModel(int modelID, int frame); bool RenderAll(CameraState *camera); int GetNumFrames(int modelID); void ExecuteAI(); int addnpc(int type, int model, int state, vector3f position, float theta, float phi); bool removenpc(int npcid); bool doconversation(int npcid, int player); //start the ai by checking for conversations, returns true if that npc is busy talking bool KeepTalking(int npcid); void AIZero(int npcid); void AIOne(int id); int numChars; NPCState * chars; int numModels; NPCModel * models; private: Lib3dsFile* Init3DS(const char* filename); void Render3DSNode(Lib3dsFile *file, Lib3dsNode *node); void Render3DSModel (int modelID, int frame); void RenderSimpleModel (int modelID); conversation *theconversation; coursecity *thecoursecity; }; #endif // __NPC_H__