2007-05-30 21:56:52 +00:00
|
|
|
/* ScummVM - Graphic Adventure Engine
|
|
|
|
*
|
|
|
|
* ScummVM is the legal property of its developers, whose names
|
|
|
|
* are too numerous to list here. Please refer to the COPYRIGHT
|
|
|
|
* file distributed with this source distribution.
|
2003-07-28 01:44:38 +00:00
|
|
|
*
|
2007-05-31 20:28:29 +00:00
|
|
|
* Additional copyright for this file:
|
|
|
|
* Copyright (C) 1994-1998 Revolution Software Ltd.
|
|
|
|
*
|
2003-07-28 01:44:38 +00:00
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
2005-10-18 01:30:26 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2003-07-28 01:44:38 +00:00
|
|
|
*
|
2006-02-09 15:12:44 +00:00
|
|
|
* $URL$
|
|
|
|
* $Id$
|
2003-07-28 01:44:38 +00:00
|
|
|
*/
|
|
|
|
|
2006-02-12 19:57:23 +00:00
|
|
|
#ifndef SWORD2_ROUTER_H
|
|
|
|
#define SWORD2_ROUTER_H
|
2003-07-28 01:44:38 +00:00
|
|
|
|
2003-10-12 14:40:04 +00:00
|
|
|
// This used to be a variable, but it was never set. Actually, it wasn't even
|
|
|
|
// initialised!
|
|
|
|
//
|
|
|
|
// Define this to force the use of slidy router (so solid path not used when
|
|
|
|
// ending walk in ANY direction)
|
|
|
|
//
|
|
|
|
// #define FORCE_SLIDY
|
|
|
|
|
2003-11-16 14:18:29 +00:00
|
|
|
#include "sword2/object.h"
|
|
|
|
|
2003-10-04 00:52:27 +00:00
|
|
|
namespace Sword2 {
|
|
|
|
|
2003-12-17 08:01:59 +00:00
|
|
|
struct WalkData {
|
2003-09-20 15:34:53 +00:00
|
|
|
uint16 frame;
|
|
|
|
int16 x;
|
|
|
|
int16 y;
|
|
|
|
uint8 step;
|
|
|
|
uint8 dir;
|
Applied my own patch #1341495, in an attempt to fix alignment issues
reported by Crilith.
To elaborate a bit, the engine no longer accesses resource data through
packed structs. Instead it uses memory streams and the READ/WRITE
functions.
If data is mainly read, not written, I have replaced the old struct with a
new one with a read() function to read the whole thing from memory into the
struct's variables, and a write() function to dump the struct's variables
to memory. In fact, most of these write() functions remain unused.
If data is both read and written, I have replaced the struct with a class
with individual get/set functions to replace the old variables. This
manipulates memory directly.
Since I'm fairly sure that these structs are frequently stored as local
variables for a script, all script variables (both local and global) are
stored as little-endian and accessed through the READ/WRITE functions,
rather than being treated as arrays of 32-bit integers.
On a positive note, the functions for doing endian conversion of resources
and save games have been removed, and some general cleanups have been made
to assist in the rewrite.
Initial reports indicate that this patch indeed fixes alignment issues, and
that I have not - surprisingly - broken the game on big-endian platforms.
At least not in any immediately obvious way. And there's still plenty of
time to fix regressions before 0.9.0, too.
svn-id: r19366
2005-10-29 21:24:54 +00:00
|
|
|
};
|
2003-07-28 01:44:38 +00:00
|
|
|
|
2003-12-17 08:01:59 +00:00
|
|
|
struct BarData {
|
2003-09-20 15:34:53 +00:00
|
|
|
int16 x1;
|
2008-01-28 00:14:17 +00:00
|
|
|
int16 y1;
|
|
|
|
int16 x2;
|
2003-09-20 15:34:53 +00:00
|
|
|
int16 y2;
|
|
|
|
int16 xmin;
|
|
|
|
int16 ymin;
|
|
|
|
int16 xmax;
|
|
|
|
int16 ymax;
|
|
|
|
int16 dx; // x2 - x1
|
|
|
|
int16 dy; // y2 - y1
|
2006-04-01 12:47:09 +00:00
|
|
|
int32 co; // co = (y1*dx) - (x1*dy) from an equation for a line y*dx = x*dy + co
|
Applied my own patch #1341495, in an attempt to fix alignment issues
reported by Crilith.
To elaborate a bit, the engine no longer accesses resource data through
packed structs. Instead it uses memory streams and the READ/WRITE
functions.
If data is mainly read, not written, I have replaced the old struct with a
new one with a read() function to read the whole thing from memory into the
struct's variables, and a write() function to dump the struct's variables
to memory. In fact, most of these write() functions remain unused.
If data is both read and written, I have replaced the struct with a class
with individual get/set functions to replace the old variables. This
manipulates memory directly.
Since I'm fairly sure that these structs are frequently stored as local
variables for a script, all script variables (both local and global) are
stored as little-endian and accessed through the READ/WRITE functions,
rather than being treated as arrays of 32-bit integers.
On a positive note, the functions for doing endian conversion of resources
and save games have been removed, and some general cleanups have been made
to assist in the rewrite.
Initial reports indicate that this patch indeed fixes alignment issues, and
that I have not - surprisingly - broken the game on big-endian platforms.
At least not in any immediately obvious way. And there's still plenty of
time to fix regressions before 0.9.0, too.
svn-id: r19366
2005-10-29 21:24:54 +00:00
|
|
|
};
|
2003-07-28 01:44:38 +00:00
|
|
|
|
2003-12-17 08:01:59 +00:00
|
|
|
struct NodeData {
|
2003-09-20 15:34:53 +00:00
|
|
|
int16 x;
|
|
|
|
int16 y;
|
|
|
|
int16 level;
|
|
|
|
int16 prev;
|
|
|
|
int16 dist;
|
Applied my own patch #1341495, in an attempt to fix alignment issues
reported by Crilith.
To elaborate a bit, the engine no longer accesses resource data through
packed structs. Instead it uses memory streams and the READ/WRITE
functions.
If data is mainly read, not written, I have replaced the old struct with a
new one with a read() function to read the whole thing from memory into the
struct's variables, and a write() function to dump the struct's variables
to memory. In fact, most of these write() functions remain unused.
If data is both read and written, I have replaced the struct with a class
with individual get/set functions to replace the old variables. This
manipulates memory directly.
Since I'm fairly sure that these structs are frequently stored as local
variables for a script, all script variables (both local and global) are
stored as little-endian and accessed through the READ/WRITE functions,
rather than being treated as arrays of 32-bit integers.
On a positive note, the functions for doing endian conversion of resources
and save games have been removed, and some general cleanups have been made
to assist in the rewrite.
Initial reports indicate that this patch indeed fixes alignment issues, and
that I have not - surprisingly - broken the game on big-endian platforms.
At least not in any immediately obvious way. And there's still plenty of
time to fix regressions before 0.9.0, too.
svn-id: r19366
2005-10-29 21:24:54 +00:00
|
|
|
};
|
2003-07-28 01:44:38 +00:00
|
|
|
|
2003-10-12 14:40:04 +00:00
|
|
|
// because we only have 2 megas in the game!
|
|
|
|
#define TOTAL_ROUTE_SLOTS 2
|
|
|
|
|
|
|
|
#define MAX_FRAMES_PER_CYCLE 16
|
|
|
|
#define NO_DIRECTIONS 8
|
|
|
|
#define MAX_FRAMES_PER_CHAR (MAX_FRAMES_PER_CYCLE * NO_DIRECTIONS)
|
|
|
|
#define ROUTE_END_FLAG 255
|
|
|
|
|
|
|
|
#define MAX_WALKGRIDS 10
|
|
|
|
|
|
|
|
#define O_WALKANIM_SIZE 600 // max number of nodes in router output
|
|
|
|
#define O_GRID_SIZE 200 // max 200 lines & 200 points
|
|
|
|
#define O_ROUTE_SIZE 50 // max number of modules in a route
|
|
|
|
|
2003-12-17 08:01:59 +00:00
|
|
|
struct RouteData {
|
2003-10-12 14:40:04 +00:00
|
|
|
int32 x;
|
|
|
|
int32 y;
|
|
|
|
int32 dirS;
|
|
|
|
int32 dirD;
|
2003-12-17 08:01:59 +00:00
|
|
|
};
|
2003-10-12 14:40:04 +00:00
|
|
|
|
2003-12-17 08:01:59 +00:00
|
|
|
struct PathData {
|
2003-10-12 14:40:04 +00:00
|
|
|
int32 x;
|
|
|
|
int32 y;
|
|
|
|
int32 dir;
|
|
|
|
int32 num;
|
2003-12-17 08:01:59 +00:00
|
|
|
};
|
2003-10-12 14:40:04 +00:00
|
|
|
|
|
|
|
class Router {
|
|
|
|
private:
|
2003-11-16 14:18:29 +00:00
|
|
|
Sword2Engine *_vm;
|
|
|
|
|
2005-05-03 09:00:06 +00:00
|
|
|
int16 _standbyX; // see fnSetStandbyCoords()
|
|
|
|
int16 _standbyY;
|
|
|
|
int16 _standbyDir;
|
|
|
|
|
2003-10-12 14:40:04 +00:00
|
|
|
// stores pointers to mem blocks containing routes created & used by
|
|
|
|
// megas (NULL if slot not in use)
|
2004-04-23 07:02:11 +00:00
|
|
|
WalkData *_routeSlots[TOTAL_ROUTE_SLOTS];
|
2003-10-12 14:40:04 +00:00
|
|
|
|
2003-12-17 08:01:59 +00:00
|
|
|
BarData _bars[O_GRID_SIZE];
|
|
|
|
NodeData _node[O_GRID_SIZE];
|
2003-10-12 14:40:04 +00:00
|
|
|
|
|
|
|
int32 _walkGridList[MAX_WALKGRIDS];
|
|
|
|
|
2003-12-17 08:01:59 +00:00
|
|
|
int32 _nBars;
|
|
|
|
int32 _nNodes;
|
2003-10-12 14:40:04 +00:00
|
|
|
|
2006-04-01 12:47:09 +00:00
|
|
|
int32 _startX, _startY, _startDir;
|
|
|
|
int32 _targetX, _targetY, _targetDir;
|
|
|
|
int32 _scaleA, _scaleB;
|
2003-12-17 08:01:59 +00:00
|
|
|
|
|
|
|
RouteData _route[O_ROUTE_SIZE];
|
|
|
|
PathData _smoothPath[O_ROUTE_SIZE];
|
|
|
|
PathData _modularPath[O_ROUTE_SIZE];
|
2003-10-12 14:40:04 +00:00
|
|
|
int32 _routeLength;
|
|
|
|
|
|
|
|
int32 _framesPerStep;
|
|
|
|
int32 _framesPerChar;
|
|
|
|
|
Applied my own patch #1341495, in an attempt to fix alignment issues
reported by Crilith.
To elaborate a bit, the engine no longer accesses resource data through
packed structs. Instead it uses memory streams and the READ/WRITE
functions.
If data is mainly read, not written, I have replaced the old struct with a
new one with a read() function to read the whole thing from memory into the
struct's variables, and a write() function to dump the struct's variables
to memory. In fact, most of these write() functions remain unused.
If data is both read and written, I have replaced the struct with a class
with individual get/set functions to replace the old variables. This
manipulates memory directly.
Since I'm fairly sure that these structs are frequently stored as local
variables for a script, all script variables (both local and global) are
stored as little-endian and accessed through the READ/WRITE functions,
rather than being treated as arrays of 32-bit integers.
On a positive note, the functions for doing endian conversion of resources
and save games have been removed, and some general cleanups have been made
to assist in the rewrite.
Initial reports indicate that this patch indeed fixes alignment issues, and
that I have not - surprisingly - broken the game on big-endian platforms.
At least not in any immediately obvious way. And there's still plenty of
time to fix regressions before 0.9.0, too.
svn-id: r19366
2005-10-29 21:24:54 +00:00
|
|
|
ObjectWalkdata _walkData;
|
|
|
|
|
2003-10-12 14:40:04 +00:00
|
|
|
int8 _modX[NO_DIRECTIONS];
|
|
|
|
int8 _modY[NO_DIRECTIONS];
|
|
|
|
int32 _diagonalx;
|
|
|
|
int32 _diagonaly;
|
|
|
|
|
|
|
|
int32 _firstStandFrame;
|
|
|
|
|
|
|
|
int32 _firstStandingTurnLeftFrame;
|
|
|
|
int32 _firstStandingTurnRightFrame;
|
|
|
|
|
|
|
|
int32 _firstWalkingTurnLeftFrame; // left walking turn
|
|
|
|
int32 _firstWalkingTurnRightFrame; // right walking turn
|
|
|
|
|
|
|
|
uint32 _firstSlowInFrame[NO_DIRECTIONS];
|
2003-07-28 01:44:38 +00:00
|
|
|
|
2003-10-12 14:40:04 +00:00
|
|
|
int32 _firstSlowOutFrame;
|
2003-07-28 01:44:38 +00:00
|
|
|
|
2003-10-12 14:40:04 +00:00
|
|
|
// number of slow-out frames on for each leading-leg in each direction
|
|
|
|
// ie. total number of slow-out frames = (numberOfSlowOutFrames * 2 *
|
|
|
|
// NO_DIRECTIONS)
|
|
|
|
|
|
|
|
int32 _numberOfSlowOutFrames;
|
|
|
|
|
|
|
|
int32 _stepCount;
|
|
|
|
|
|
|
|
int32 _moduleX;
|
|
|
|
int32 _moduleY;
|
|
|
|
int32 _currentDir;
|
|
|
|
int32 _lastCount;
|
|
|
|
int32 _frame;
|
|
|
|
|
|
|
|
uint8 returnSlotNo(uint32 megaId);
|
|
|
|
|
2005-05-02 05:41:01 +00:00
|
|
|
int32 getRoute();
|
|
|
|
void extractRoute();
|
|
|
|
void loadWalkGrid();
|
Applied my own patch #1341495, in an attempt to fix alignment issues
reported by Crilith.
To elaborate a bit, the engine no longer accesses resource data through
packed structs. Instead it uses memory streams and the READ/WRITE
functions.
If data is mainly read, not written, I have replaced the old struct with a
new one with a read() function to read the whole thing from memory into the
struct's variables, and a write() function to dump the struct's variables
to memory. In fact, most of these write() functions remain unused.
If data is both read and written, I have replaced the struct with a class
with individual get/set functions to replace the old variables. This
manipulates memory directly.
Since I'm fairly sure that these structs are frequently stored as local
variables for a script, all script variables (both local and global) are
stored as little-endian and accessed through the READ/WRITE functions,
rather than being treated as arrays of 32-bit integers.
On a positive note, the functions for doing endian conversion of resources
and save games have been removed, and some general cleanups have been made
to assist in the rewrite.
Initial reports indicate that this patch indeed fixes alignment issues, and
that I have not - surprisingly - broken the game on big-endian platforms.
At least not in any immediately obvious way. And there's still plenty of
time to fix regressions before 0.9.0, too.
svn-id: r19366
2005-10-29 21:24:54 +00:00
|
|
|
void setUpWalkGrid(byte *ob_mega, int32 x, int32 y, int32 dir);
|
|
|
|
void loadWalkData(byte *ob_walkdata);
|
2003-12-17 08:01:59 +00:00
|
|
|
bool scan(int32 level);
|
2003-10-12 14:40:04 +00:00
|
|
|
|
|
|
|
int32 newCheck(int32 status, int32 x1, int32 y1, int32 x2, int32 y2);
|
2003-12-17 08:01:59 +00:00
|
|
|
bool lineCheck(int32 x1, int32 x2, int32 y1, int32 y2);
|
|
|
|
bool vertCheck(int32 x, int32 y1, int32 y2);
|
|
|
|
bool horizCheck(int32 x1, int32 y, int32 x2);
|
|
|
|
bool check(int32 x1, int32 y1, int32 x2, int32 y2);
|
2003-10-12 14:40:04 +00:00
|
|
|
int32 checkTarget(int32 x, int32 y);
|
|
|
|
|
2005-05-02 05:41:01 +00:00
|
|
|
int32 smoothestPath();
|
|
|
|
void slidyPath();
|
2003-10-12 14:40:04 +00:00
|
|
|
|
2009-10-20 19:12:31 +00:00
|
|
|
void smoothCheck(int32 &steps, int32 best, int32 p, int32 dirS, int32 dirD);
|
2003-10-12 14:40:04 +00:00
|
|
|
|
2003-12-17 08:01:59 +00:00
|
|
|
bool addSlowInFrames(WalkData *walkAnim);
|
|
|
|
void addSlowOutFrames(WalkData *walkAnim);
|
|
|
|
void slidyWalkAnimator(WalkData *walkAnim);
|
2003-10-12 14:40:04 +00:00
|
|
|
|
|
|
|
#ifndef FORCE_SLIDY
|
2006-04-01 12:47:09 +00:00
|
|
|
void solidPath();
|
2003-12-17 08:01:59 +00:00
|
|
|
int32 solidWalkAnimator(WalkData *walkAnim);
|
2003-10-12 14:40:04 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
void plotCross(int16 x, int16 y, uint8 colour);
|
|
|
|
|
|
|
|
public:
|
2003-11-25 15:18:47 +00:00
|
|
|
Router(Sword2Engine *vm) : _vm(vm), _diagonalx(0), _diagonaly(0) {
|
2003-11-08 15:47:51 +00:00
|
|
|
memset(_routeSlots, 0, sizeof(_routeSlots));
|
|
|
|
memset(_bars, 0, sizeof(_bars));
|
|
|
|
memset(_node, 0, sizeof(_node));
|
|
|
|
memset(_walkGridList, 0, sizeof(_walkGridList));
|
|
|
|
memset(_route, 0, sizeof(_route));
|
|
|
|
memset(_smoothPath, 0, sizeof(_smoothPath));
|
|
|
|
memset(_modularPath, 0, sizeof(_modularPath));
|
|
|
|
memset(_modX, 0, sizeof(_modX));
|
|
|
|
memset(_modY, 0, sizeof(_modY));
|
|
|
|
memset(_firstSlowInFrame, 0, sizeof(_firstSlowInFrame));
|
|
|
|
}
|
2003-10-12 14:40:04 +00:00
|
|
|
|
2005-05-03 09:00:06 +00:00
|
|
|
void setStandbyCoords(int16 x, int16 y, uint8 dir);
|
|
|
|
int whatTarget(int startX, int startY, int destX, int destY);
|
|
|
|
|
2005-05-12 06:30:16 +00:00
|
|
|
// Sprites
|
Applied my own patch #1341495, in an attempt to fix alignment issues
reported by Crilith.
To elaborate a bit, the engine no longer accesses resource data through
packed structs. Instead it uses memory streams and the READ/WRITE
functions.
If data is mainly read, not written, I have replaced the old struct with a
new one with a read() function to read the whole thing from memory into the
struct's variables, and a write() function to dump the struct's variables
to memory. In fact, most of these write() functions remain unused.
If data is both read and written, I have replaced the struct with a class
with individual get/set functions to replace the old variables. This
manipulates memory directly.
Since I'm fairly sure that these structs are frequently stored as local
variables for a script, all script variables (both local and global) are
stored as little-endian and accessed through the READ/WRITE functions,
rather than being treated as arrays of 32-bit integers.
On a positive note, the functions for doing endian conversion of resources
and save games have been removed, and some general cleanups have been made
to assist in the rewrite.
Initial reports indicate that this patch indeed fixes alignment issues, and
that I have not - surprisingly - broken the game on big-endian platforms.
At least not in any immediately obvious way. And there's still plenty of
time to fix regressions before 0.9.0, too.
svn-id: r19366
2005-10-29 21:24:54 +00:00
|
|
|
void setSpriteStatus(byte *ob_graph, uint32 type);
|
|
|
|
void setSpriteShading(byte *ob_graph, uint32 type);
|
2005-05-12 06:30:16 +00:00
|
|
|
|
|
|
|
// Animation
|
Applied my own patch #1341495, in an attempt to fix alignment issues
reported by Crilith.
To elaborate a bit, the engine no longer accesses resource data through
packed structs. Instead it uses memory streams and the READ/WRITE
functions.
If data is mainly read, not written, I have replaced the old struct with a
new one with a read() function to read the whole thing from memory into the
struct's variables, and a write() function to dump the struct's variables
to memory. In fact, most of these write() functions remain unused.
If data is both read and written, I have replaced the struct with a class
with individual get/set functions to replace the old variables. This
manipulates memory directly.
Since I'm fairly sure that these structs are frequently stored as local
variables for a script, all script variables (both local and global) are
stored as little-endian and accessed through the READ/WRITE functions,
rather than being treated as arrays of 32-bit integers.
On a positive note, the functions for doing endian conversion of resources
and save games have been removed, and some general cleanups have been made
to assist in the rewrite.
Initial reports indicate that this patch indeed fixes alignment issues, and
that I have not - surprisingly - broken the game on big-endian platforms.
At least not in any immediately obvious way. And there's still plenty of
time to fix regressions before 0.9.0, too.
svn-id: r19366
2005-10-29 21:24:54 +00:00
|
|
|
int doAnimate(byte *ob_logic, byte *ob_graph, int32 animRes, bool reverse);
|
|
|
|
int megaTableAnimate(byte *ob_logic, byte *ob_graph, byte *ob_mega, byte *animTable, bool reverse);
|
2005-05-12 06:30:16 +00:00
|
|
|
|
2005-05-03 09:00:06 +00:00
|
|
|
// Walking
|
Applied my own patch #1341495, in an attempt to fix alignment issues
reported by Crilith.
To elaborate a bit, the engine no longer accesses resource data through
packed structs. Instead it uses memory streams and the READ/WRITE
functions.
If data is mainly read, not written, I have replaced the old struct with a
new one with a read() function to read the whole thing from memory into the
struct's variables, and a write() function to dump the struct's variables
to memory. In fact, most of these write() functions remain unused.
If data is both read and written, I have replaced the struct with a class
with individual get/set functions to replace the old variables. This
manipulates memory directly.
Since I'm fairly sure that these structs are frequently stored as local
variables for a script, all script variables (both local and global) are
stored as little-endian and accessed through the READ/WRITE functions,
rather than being treated as arrays of 32-bit integers.
On a positive note, the functions for doing endian conversion of resources
and save games have been removed, and some general cleanups have been made
to assist in the rewrite.
Initial reports indicate that this patch indeed fixes alignment issues, and
that I have not - surprisingly - broken the game on big-endian platforms.
At least not in any immediately obvious way. And there's still plenty of
time to fix regressions before 0.9.0, too.
svn-id: r19366
2005-10-29 21:24:54 +00:00
|
|
|
int doWalk(byte *ob_logic, byte *ob_graph, byte *ob_mega, byte *ob_walkdata, int16 target_x, int16 target_y, uint8 target_dir);
|
|
|
|
int walkToAnim(byte *ob_logic, byte *ob_graph, byte *ob_mega, byte *ob_walkdata, uint32 animRes);
|
|
|
|
int walkToTalkToMega(byte *ob_logic, byte *ob_graph, byte *ob_mega, byte *ob_walkdata, uint32 megaId, uint32 separation);
|
2005-05-03 09:00:06 +00:00
|
|
|
|
|
|
|
// Turning
|
Applied my own patch #1341495, in an attempt to fix alignment issues
reported by Crilith.
To elaborate a bit, the engine no longer accesses resource data through
packed structs. Instead it uses memory streams and the READ/WRITE
functions.
If data is mainly read, not written, I have replaced the old struct with a
new one with a read() function to read the whole thing from memory into the
struct's variables, and a write() function to dump the struct's variables
to memory. In fact, most of these write() functions remain unused.
If data is both read and written, I have replaced the struct with a class
with individual get/set functions to replace the old variables. This
manipulates memory directly.
Since I'm fairly sure that these structs are frequently stored as local
variables for a script, all script variables (both local and global) are
stored as little-endian and accessed through the READ/WRITE functions,
rather than being treated as arrays of 32-bit integers.
On a positive note, the functions for doing endian conversion of resources
and save games have been removed, and some general cleanups have been made
to assist in the rewrite.
Initial reports indicate that this patch indeed fixes alignment issues, and
that I have not - surprisingly - broken the game on big-endian platforms.
At least not in any immediately obvious way. And there's still plenty of
time to fix regressions before 0.9.0, too.
svn-id: r19366
2005-10-29 21:24:54 +00:00
|
|
|
int doFace(byte *ob_logic, byte *ob_graph, byte *ob_mega, byte *ob_walkdata, uint8 target_dir);
|
|
|
|
int faceXY(byte *ob_logic, byte *ob_graph, byte *ob_mega, byte *ob_walkdata, int16 target_x, int16 target_y);
|
|
|
|
int faceMega(byte *ob_logic, byte *ob_graph, byte *ob_mega, byte *ob_walkdata, uint32 megaId);
|
2005-05-03 09:00:06 +00:00
|
|
|
|
|
|
|
// Standing
|
Applied my own patch #1341495, in an attempt to fix alignment issues
reported by Crilith.
To elaborate a bit, the engine no longer accesses resource data through
packed structs. Instead it uses memory streams and the READ/WRITE
functions.
If data is mainly read, not written, I have replaced the old struct with a
new one with a read() function to read the whole thing from memory into the
struct's variables, and a write() function to dump the struct's variables
to memory. In fact, most of these write() functions remain unused.
If data is both read and written, I have replaced the struct with a class
with individual get/set functions to replace the old variables. This
manipulates memory directly.
Since I'm fairly sure that these structs are frequently stored as local
variables for a script, all script variables (both local and global) are
stored as little-endian and accessed through the READ/WRITE functions,
rather than being treated as arrays of 32-bit integers.
On a positive note, the functions for doing endian conversion of resources
and save games have been removed, and some general cleanups have been made
to assist in the rewrite.
Initial reports indicate that this patch indeed fixes alignment issues, and
that I have not - surprisingly - broken the game on big-endian platforms.
At least not in any immediately obvious way. And there's still plenty of
time to fix regressions before 0.9.0, too.
svn-id: r19366
2005-10-29 21:24:54 +00:00
|
|
|
void standAt(byte *ob_graph, byte *ob_mega, int32 x, int32 y, int32 dir);
|
|
|
|
void standAfterAnim(byte *ob_graph, byte *ob_mega, uint32 animRes);
|
|
|
|
void standAtAnim(byte *ob_graph, byte *ob_mega, uint32 animRes);
|
2005-05-03 09:00:06 +00:00
|
|
|
|
Applied my own patch #1341495, in an attempt to fix alignment issues
reported by Crilith.
To elaborate a bit, the engine no longer accesses resource data through
packed structs. Instead it uses memory streams and the READ/WRITE
functions.
If data is mainly read, not written, I have replaced the old struct with a
new one with a read() function to read the whole thing from memory into the
struct's variables, and a write() function to dump the struct's variables
to memory. In fact, most of these write() functions remain unused.
If data is both read and written, I have replaced the struct with a class
with individual get/set functions to replace the old variables. This
manipulates memory directly.
Since I'm fairly sure that these structs are frequently stored as local
variables for a script, all script variables (both local and global) are
stored as little-endian and accessed through the READ/WRITE functions,
rather than being treated as arrays of 32-bit integers.
On a positive note, the functions for doing endian conversion of resources
and save games have been removed, and some general cleanups have been made
to assist in the rewrite.
Initial reports indicate that this patch indeed fixes alignment issues, and
that I have not - surprisingly - broken the game on big-endian platforms.
At least not in any immediately obvious way. And there's still plenty of
time to fix regressions before 0.9.0, too.
svn-id: r19366
2005-10-29 21:24:54 +00:00
|
|
|
int32 routeFinder(byte *ob_mega, byte *ob_walkdata, int32 x, int32 y, int32 dir);
|
2003-10-12 14:40:04 +00:00
|
|
|
|
Applied my own patch #1341495, in an attempt to fix alignment issues
reported by Crilith.
To elaborate a bit, the engine no longer accesses resource data through
packed structs. Instead it uses memory streams and the READ/WRITE
functions.
If data is mainly read, not written, I have replaced the old struct with a
new one with a read() function to read the whole thing from memory into the
struct's variables, and a write() function to dump the struct's variables
to memory. In fact, most of these write() functions remain unused.
If data is both read and written, I have replaced the struct with a class
with individual get/set functions to replace the old variables. This
manipulates memory directly.
Since I'm fairly sure that these structs are frequently stored as local
variables for a script, all script variables (both local and global) are
stored as little-endian and accessed through the READ/WRITE functions,
rather than being treated as arrays of 32-bit integers.
On a positive note, the functions for doing endian conversion of resources
and save games have been removed, and some general cleanups have been made
to assist in the rewrite.
Initial reports indicate that this patch indeed fixes alignment issues, and
that I have not - surprisingly - broken the game on big-endian platforms.
At least not in any immediately obvious way. And there's still plenty of
time to fix regressions before 0.9.0, too.
svn-id: r19366
2005-10-29 21:24:54 +00:00
|
|
|
void earlySlowOut(byte *ob_mega, byte *ob_walkdata);
|
2003-10-12 14:40:04 +00:00
|
|
|
|
2005-05-02 05:41:01 +00:00
|
|
|
void allocateRouteMem();
|
|
|
|
WalkData *getRouteMem();
|
|
|
|
void freeRouteMem();
|
|
|
|
void freeAllRouteMem();
|
2003-10-12 14:40:04 +00:00
|
|
|
void addWalkGrid(int32 gridResource);
|
|
|
|
void removeWalkGrid(int32 gridResource);
|
2005-05-02 05:41:01 +00:00
|
|
|
void clearWalkGridList();
|
2003-07-28 01:44:38 +00:00
|
|
|
|
2005-05-02 05:41:01 +00:00
|
|
|
void plotWalkGrid();
|
2003-10-12 14:40:04 +00:00
|
|
|
};
|
|
|
|
|
2003-10-04 00:52:27 +00:00
|
|
|
} // End of namespace Sword2
|
|
|
|
|
2003-07-28 01:44:38 +00:00
|
|
|
#endif
|