00001
00011 #ifndef _CONTROLLER_H
00012 #define _CONTROLLER_H
00013
00014 class cController;
00015
00016 #include "cObject.h"
00017 #include "cComcom.h"
00018
00019 #include <vector>
00020 #include <string>
00021
00027 class cController : public cComputer {
00028 public:
00030 enum Opcodes {
00031 WAIT, ATTACK, FOLLOW, GOTO, REPEAT, OPCODE_MAX
00032 };
00033
00034 bool mEnabled;
00035 cObject* mDevice;
00036 std::vector<OID> mStack;
00037
00038 public:
00040 cController(cObject* entity, bool enabled = true);
00041 virtual ~cController();
00042
00044 void process(float spf = 1.0f);
00045
00047 void drawHUD() {};
00048
00050 void printState();
00051
00052 protected:
00053 std::string getFrameName();
00054 unsigned int getFrameSizeOf(int opcode);
00055 unsigned int getFrameSize();
00056
00057
00058 void setParameter(int offset, OID value);
00059
00060
00061 OID getParameter(int offset);
00062
00063
00064 void push(OID value);
00065
00066
00067 void pop();
00068
00069 public:
00070
00071
00072
00073
00074
00075 void pushWaitEvent(long mseconds = -1, bool patrol = true);
00076 void waitEvent();
00077
00078 void pushAttackEnemy(OID entity);
00079 void attackEnemy();
00080
00081 void pushFollowLeader(OID entity, bool patrol = true);
00082 void followLeader();
00083
00084 void pushGotoDestination(float* v, bool patrol = true);
00085 void gotoDestination();
00086
00087 void pushRepeatInstructions(int n);
00088 void repeatInstructions();
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100 };
00101
00102
00103 #endif