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