24 #ifndef SWORD2_ROUTER_H 25 #define SWORD2_ROUTER_H 35 #include "sword2/object.h" 70 #define TOTAL_ROUTE_SLOTS 2 72 #define MAX_FRAMES_PER_CYCLE 16 73 #define NO_DIRECTIONS 8 74 #define MAX_FRAMES_PER_CHAR (MAX_FRAMES_PER_CYCLE * NO_DIRECTIONS) 75 #define ROUTE_END_FLAG 255 77 #define MAX_WALKGRIDS 10 79 #define O_WALKANIM_SIZE 600 // max number of nodes in router output 80 #define O_GRID_SIZE 200 // max 200 lines & 200 points 81 #define O_ROUTE_SIZE 50 // max number of modules in a route 107 WalkData *_routeSlots[TOTAL_ROUTE_SLOTS];
112 int32 _walkGridList[MAX_WALKGRIDS];
117 int32 _startX, _startY, _startDir;
118 int32 _targetX, _targetY, _targetDir;
119 int32 _scaleA, _scaleB;
123 PathData _modularPath[O_ROUTE_SIZE];
126 int32 _framesPerStep;
127 int32 _framesPerChar;
131 int8 _modX[NO_DIRECTIONS];
132 int8 _modY[NO_DIRECTIONS];
136 int32 _firstStandFrame;
138 int32 _firstStandingTurnLeftFrame;
139 int32 _firstStandingTurnRightFrame;
141 int32 _firstWalkingTurnLeftFrame;
142 int32 _firstWalkingTurnRightFrame;
144 uint32 _firstSlowInFrame[NO_DIRECTIONS];
146 int32 _firstSlowOutFrame;
152 int32 _numberOfSlowOutFrames;
162 uint8 returnSlotNo(uint32 megaId);
167 void setUpWalkGrid(byte *ob_mega, int32 x, int32 y, int32 dir);
168 void loadWalkData(byte *ob_walkdata);
169 bool scan(int32 level);
171 int32 newCheck(int32 status, int32 x1, int32 y1, int32 x2, int32 y2);
172 bool lineCheck(int32 x1, int32 x2, int32 y1, int32 y2);
173 bool vertCheck(int32 x, int32 y1, int32 y2);
174 bool horizCheck(int32 x1, int32 y, int32 x2);
175 bool check(int32 x1, int32 y1, int32 x2, int32 y2);
176 int32 checkTarget(int32 x, int32 y);
178 int32 smoothestPath();
181 void smoothCheck(int32 &steps, int32 best, int32 p, int32 dirS, int32 dirD);
183 bool addSlowInFrames(
WalkData *walkAnim);
184 void addSlowOutFrames(
WalkData *walkAnim);
185 void slidyWalkAnimator(
WalkData *walkAnim);
189 int32 solidWalkAnimator(
WalkData *walkAnim);
192 void plotCross(int16 x, int16 y, uint8 color);
196 memset(_routeSlots, 0,
sizeof(_routeSlots));
197 memset(_bars, 0,
sizeof(_bars));
198 memset(_node, 0,
sizeof(_node));
199 memset(_walkGridList, 0,
sizeof(_walkGridList));
200 memset(_route, 0,
sizeof(_route));
201 memset(_smoothPath, 0,
sizeof(_smoothPath));
202 memset(_modularPath, 0,
sizeof(_modularPath));
203 memset(_modX, 0,
sizeof(_modX));
204 memset(_modY, 0,
sizeof(_modY));
205 memset(_firstSlowInFrame, 0,
sizeof(_firstSlowInFrame));
208 void setStandbyCoords(int16 x, int16 y, uint8 dir);
209 int whatTarget(
int startX,
int startY,
int destX,
int destY);
212 void setSpriteStatus(byte *ob_graph, uint32 type);
213 void setSpriteShading(byte *ob_graph, uint32 type);
216 int doAnimate(byte *ob_logic, byte *ob_graph, int32 animRes,
bool reverse);
217 int megaTableAnimate(byte *ob_logic, byte *ob_graph, byte *ob_mega, byte *animTable,
bool reverse);
220 int doWalk(byte *ob_logic, byte *ob_graph, byte *ob_mega, byte *ob_walkdata, int16 target_x, int16 target_y, uint8 target_dir);
221 int walkToAnim(byte *ob_logic, byte *ob_graph, byte *ob_mega, byte *ob_walkdata, uint32 animRes);
222 int walkToTalkToMega(byte *ob_logic, byte *ob_graph, byte *ob_mega, byte *ob_walkdata, uint32 megaId, uint32 separation);
225 int doFace(byte *ob_logic, byte *ob_graph, byte *ob_mega, byte *ob_walkdata, uint8 target_dir);
226 int faceXY(byte *ob_logic, byte *ob_graph, byte *ob_mega, byte *ob_walkdata, int16 target_x, int16 target_y);
227 int faceMega(byte *ob_logic, byte *ob_graph, byte *ob_mega, byte *ob_walkdata, uint32 megaId);
230 void standAt(byte *ob_graph, byte *ob_mega, int32 x, int32 y, int32 dir);
231 void standAfterAnim(byte *ob_graph, byte *ob_mega, uint32 animRes);
232 void standAtAnim(byte *ob_graph, byte *ob_mega, uint32 animRes);
234 int32 routeFinder(byte *ob_mega, byte *ob_walkdata, int32 x, int32 y, int32 dir);
236 void earlySlowOut(byte *ob_mega, byte *ob_walkdata);
238 void allocateRouteMem();
241 void freeAllRouteMem();
242 void addWalkGrid(int32 gridResource);
243 void removeWalkGrid(int32 gridResource);
244 void clearWalkGridList();
Definition: animation.h:37