[Scummvm-cvs-logs] CVS: scummvm/bs2 resman.cpp,1.30,1.31 router.cpp,1.11,1.12 router.h,1.1,1.2
Oliver Kiehl
olki at users.sourceforge.net
Sat Sep 13 13:43:01 CEST 2003
Update of /cvsroot/scummvm/scummvm/bs2
In directory sc8-pr-cvs1:/tmp/cvs-serv12557
Modified Files:
resman.cpp router.cpp router.h
Log Message:
and another endian fix
Index: resman.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/bs2/resman.cpp,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -d -r1.30 -r1.31
--- resman.cpp 13 Sep 2003 17:36:31 -0000 1.30
+++ resman.cpp 13 Sep 2003 20:42:08 -0000 1.31
@@ -41,6 +41,7 @@
#include "resman.h"
#include "sound.h" // (James22july97) for Clear_fx_queue() called from CacheNewCluster()
#include "sword2.h" // (James11aug97) for CloseGame()
+#include "router.h"
// ---------------------------------------------------------------------------
// welcome to the easy resource manager - written in simple code for easy
@@ -391,6 +392,27 @@
SWAP32(walkGridHeader->numBars);
SWAP32(walkGridHeader->numNodes);
+
+ _barData *barData = (_barData *) (file + sizeof(_walkGridHeader));
+ for (i = 0; i < walkGridHeader->numBars; i++) {
+ SWAP16(barData->x1);
+ SWAP16(barData->y1);
+ SWAP16(barData->x2);
+ SWAP16(barData->y2);
+ SWAP16(barData->xmin);
+ SWAP16(barData->ymin);
+ SWAP16(barData->xmax);
+ SWAP16(barData->ymax);
+ SWAP16(barData->dx);
+ SWAP16(barData->dy);
+ SWAP32(barData->co);
+ barData++;
+ }
+
+ uint16 *node = (uint16 *) (file + sizeof(_walkGridHeader) + walkGridHeader->numBars * sizeof(_barData));
+ for (i = 0; i < walkGridHeader->numNodes*2; i++)
+ *node = SWAP_BYTES_16(*node++);
+
break;
}
case GLOBAL_VAR_FILE:
Index: router.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/bs2/router.cpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- router.cpp 13 Sep 2003 17:36:53 -0000 1.11
+++ router.cpp 13 Sep 2003 20:42:08 -0000 1.12
@@ -119,39 +119,6 @@
#define EXTRA_GRID_SIZE 20 // max 20 lines & 20 points
#define O_ROUTE_SIZE 50 // max number of modules in a route
-
-typedef struct
-{
- int16 x1;
- int16 y1;
- int16 x2;
- int16 y2;
- int16 xmin;
- int16 ymin;
- int16 xmax;
- int16 ymax;
- int16 dx; // x2 - x1
- int16 dy; // y2 - y1
- int32 co; // co = (y1 *dx)- (x1*dy) from an equation for a line y*dx = x*dy + co
-}_barData;
-
-typedef struct
-{
- int16 x;
- int16 y;
- int16 level;
- int16 prev;
- int16 dist;
-}_nodeData;
-
-typedef struct
-{
- int32 nbars;
- _barData *bars;
- int32 nnodes;
- _nodeData *node;
-} _floorData;
-
typedef struct
{
int32 x;
Index: router.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/bs2/router.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- router.h 28 Jul 2003 01:44:38 -0000 1.1
+++ router.h 13 Sep 2003 20:42:08 -0000 1.2
@@ -24,6 +24,9 @@
#include "memory.h"
#include "object.h"
+#if !defined(__GNUC__)
+ #pragma START_PACK_STRUCTS
+#endif
typedef struct _walkData
{
@@ -32,9 +35,35 @@
int16 y;
uint8 step;
uint8 dir;
-} _walkData;
+} GCC_PACK _walkData;
+typedef struct
+{
+ int16 x1;
+ int16 y1;
+ int16 x2;
+ int16 y2;
+ int16 xmin;
+ int16 ymin;
+ int16 xmax;
+ int16 ymax;
+ int16 dx; // x2 - x1
+ int16 dy; // y2 - y1
+ int32 co; // co = (y1 *dx)- (x1*dy) from an equation for a line y*dx = x*dy + co
+} GCC_PACK _barData;
+typedef struct
+{
+ int16 x;
+ int16 y;
+ int16 level;
+ int16 prev;
+ int16 dist;
+} GCC_PACK _nodeData;
+
+#if !defined(__GNUC__)
+ #pragma END_PACK_STRUCTS
+#endif
int32 RouteFinder(Object_mega *ob_mega, Object_walkdata *ob_walkdata, int32 x, int32 y, int32 dir);
More information about the Scummvm-git-logs
mailing list