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 {
00028 public:
00030 enum Opcodes {
00032 WAIT,
00034 ATTACK,
00036 FOLLOW,
00038 GOTO,
00040 REPEAT,
00042 OPCODE_MAX
00043 };
00044
00046 bool controllerEnabled;
00048 cObject* controlledDevice;
00050 std::vector<OID> commandStack;
00051
00052 public:
00054 cController(cObject* entity, bool enabled = true);
00055
00057 virtual ~cController();
00058
00060 void process(float spf = 1.0f);
00061
00063 void drawHUD() {
00064 };
00065
00067 void printState();
00068
00069 protected:
00071 std::string getFrameName();
00072
00074 unsigned int getFrameSizeOf(int opcode);
00075
00077 unsigned int getFrameSize();
00078
00080 void setParameter(int offset, OID value);
00081
00083 OID getParameter(int offset);
00084
00086 void push(OID value);
00087
00089 void pop();
00090
00091 public:
00092
00093
00094
00096 void pushWaitEvent(long mseconds = -1, bool patrol = true);
00098 void waitEvent();
00099
00101 void pushAttackEnemy(OID entity);
00103 void attackEnemy();
00104
00106 void pushFollowLeader(OID entity, bool patrol = true);
00108 void followLeader();
00109
00111 void pushGotoDestination(float* v, bool patrol = true);
00113 void gotoDestination();
00114
00116 void pushRepeatInstructions(int n);
00118 void repeatInstructions();
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130 };
00131
00132
00133 #endif