aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--actor.cpp1
-rw-r--r--boxes.cpp112
-rw-r--r--boxes.h30
-rw-r--r--costume.cpp1
-rw-r--r--guimaps.h4
-rw-r--r--scumm.h84
6 files changed, 83 insertions, 149 deletions
diff --git a/actor.cpp b/actor.cpp
index 1bf8af1ad8..1d1e56039f 100644
--- a/actor.cpp
+++ b/actor.cpp
@@ -24,6 +24,7 @@
#include "scumm.h"
#include "actor.h"
#include "akos.h"
+#include "costume.h"
#include <math.h>
diff --git a/boxes.cpp b/boxes.cpp
index 55d5fc9bec..8f2c4a986d 100644
--- a/boxes.cpp
+++ b/boxes.cpp
@@ -26,6 +26,38 @@
#include <math.h>
+#if !defined(__GNUC__)
+ #pragma START_PACK_STRUCTS
+#endif
+
+struct Box { /* Internal walkbox file format */
+ int16 ulx, uly;
+ int16 urx, ury;
+ int16 lrx, lry;
+ int16 llx, lly;
+ byte mask;
+ byte flags;
+ uint16 scale;
+} GCC_PACK;
+
+#if !defined(__GNUC__)
+ #pragma END_PACK_STRUCTS
+#endif
+
+struct PathNode { /* Linked list of walkpath nodes */
+ uint index;
+ struct PathNode *left, *right;
+};
+
+struct PathVertex { /* Linked list of walkpath nodes */
+ PathNode *left;
+ PathNode *right;
+};
+
+
+PathVertex *unkMatrixProc1(PathVertex *vtx, PathNode *node);
+
+
byte Scumm::getMaskFromBox(int box)
{
Box *ptr = getBoxBaseAddr(box);
@@ -106,23 +138,23 @@ bool Scumm::checkXYInBoxBounds(int b, int x, int y)
getBoxCoordinates(b, &box);
- if (x < box.ul.x && x < box.ur.x && x < box.ll.x && x < box.lr.x)
+ if (x < box.ul.x && x < box.ur.x && x < box.lr.x && x < box.ll.x)
return 0;
- if (x > box.ul.x && x > box.ur.x && x > box.ll.x && x > box.lr.x)
+ if (x > box.ul.x && x > box.ur.x && x > box.lr.x && x > box.ll.x)
return 0;
- if (y < box.ul.y && y < box.ur.y && y < box.ll.y && y < box.lr.y)
+ if (y < box.ul.y && y < box.ur.y && y < box.lr.y && y < box.ll.y)
return 0;
- if (y > box.ul.y && y > box.ur.y && y > box.ll.y && y > box.lr.y)
+ if (y > box.ul.y && y > box.ur.y && y > box.lr.y && y > box.ll.y)
return 0;
- if (box.ul.x == box.ur.x && box.ul.y == box.ur.y && box.ll.x == box.lr.x && box.ll.y == box.lr.y ||
- box.ul.x == box.lr.x && box.ul.y == box.lr.y && box.ur.x == box.ll.x && box.ur.y == box.ll.y) {
+ if (box.ul.x == box.ur.x && box.ul.y == box.ur.y && box.lr.x == box.ll.x && box.lr.y == box.ll.y ||
+ box.ul.x == box.ll.x && box.ul.y == box.ll.y && box.ur.x == box.lr.x && box.ur.y == box.lr.y) {
ScummPoint pt;
- pt = closestPtOnLine(box.ul.x, box.ul.y, box.ll.x, box.ll.y, x, y);
+ pt = closestPtOnLine(box.ul.x, box.ul.y, box.lr.x, box.lr.y, x, y);
if (distanceFromPt(x, y, pt.x, pt.y) <= 4)
return 1;
}
@@ -130,13 +162,13 @@ bool Scumm::checkXYInBoxBounds(int b, int x, int y)
if (!compareSlope(box.ul.x, box.ul.y, box.ur.x, box.ur.y, x, y))
return 0;
- if (!compareSlope(box.ur.x, box.ur.y, box.ll.x, box.ll.y, x, y))
+ if (!compareSlope(box.ur.x, box.ur.y, box.lr.x, box.lr.y, x, y))
return 0;
- if (!compareSlope(box.lr.x, box.lr.y, x, y, box.ll.x, box.ll.y))
+ if (!compareSlope(box.ll.x, box.ll.y, x, y, box.lr.x, box.lr.y))
return 0;
- if (!compareSlope(box.ul.x, box.ul.y, x, y, box.lr.x, box.lr.y))
+ if (!compareSlope(box.ul.x, box.ul.y, x, y, box.ll.x, box.ll.y))
return 0;
return 1;
@@ -266,19 +298,19 @@ bool Scumm::inBoxQuickReject(int b, int x, int y, int threshold)
return 1;
t = x - threshold;
- if (t > box.ul.x && t > box.ur.x && t > box.ll.x && t > box.lr.x)
+ if (t > box.ul.x && t > box.ur.x && t > box.lr.x && t > box.ll.x)
return 0;
t = x + threshold;
- if (t < box.ul.x && t < box.ur.x && t < box.ll.x && t < box.lr.x)
+ if (t < box.ul.x && t < box.ur.x && t < box.lr.x && t < box.ll.x)
return 0;
t = y - threshold;
- if (t > box.ul.y && t > box.ur.y && t > box.ll.y && t > box.lr.y)
+ if (t > box.ul.y && t > box.ur.y && t > box.lr.y && t > box.ll.y)
return 0;
t = y + threshold;
- if (t < box.ul.y && t < box.ur.y && t < box.ll.y && t < box.lr.y)
+ if (t < box.ul.y && t < box.ur.y && t < box.lr.y && t < box.ll.y)
return 0;
return 1;
@@ -302,7 +334,7 @@ AdjustBoxResult Scumm::getClosestPtOnBox(int b, int x, int y)
best.y = pt.y;
}
- pt = closestPtOnLine(box.ur.x, box.ur.y, box.ll.x, box.ll.y, x, y);
+ pt = closestPtOnLine(box.ur.x, box.ur.y, box.lr.x, box.lr.y, x, y);
dist = distanceFromPt(x, y, pt.x, pt.y);
if (dist < bestdist) {
bestdist = dist;
@@ -310,7 +342,7 @@ AdjustBoxResult Scumm::getClosestPtOnBox(int b, int x, int y)
best.y = pt.y;
}
- pt = closestPtOnLine(box.ll.x, box.ll.y, box.lr.x, box.lr.y, x, y);
+ pt = closestPtOnLine(box.lr.x, box.lr.y, box.ll.x, box.ll.y, x, y);
dist = distanceFromPt(x, y, pt.x, pt.y);
if (dist < bestdist) {
bestdist = dist;
@@ -318,7 +350,7 @@ AdjustBoxResult Scumm::getClosestPtOnBox(int b, int x, int y)
best.y = pt.y;
}
- pt = closestPtOnLine(box.lr.x, box.lr.y, box.ul.x, box.ul.y, x, y);
+ pt = closestPtOnLine(box.ll.x, box.ll.y, box.ul.x, box.ul.y, x, y);
dist = distanceFromPt(x, y, pt.x, pt.y);
if (dist < bestdist) {
bestdist = dist;
@@ -488,15 +520,15 @@ int Scumm::findPathTowards(Actor *a, byte box1nr, byte box2nr, byte box3nr)
}
tmp = box1.ul;
box1.ul = box1.ur;
- box1.ur = box1.ll;
- box1.ll = box1.lr;
- box1.lr = tmp;
+ box1.ur = box1.lr;
+ box1.lr = box1.ll;
+ box1.ll = tmp;
}
tmp = box2.ul;
box2.ul = box2.ur;
- box2.ur = box2.ll;
- box2.ll = box2.lr;
- box2.lr = tmp;
+ box2.ur = box2.lr;
+ box2.lr = box2.ll;
+ box2.ll = tmp;
}
return 0;
}
@@ -651,7 +683,7 @@ void Scumm::createBoxMatrix()
nukeResource(rtMatrix, 3);
}
-PathVertex *Scumm::unkMatrixProc1(PathVertex *vtx, PathNode *node)
+PathVertex *unkMatrixProc1(PathVertex *vtx, PathNode *node)
{
if (node == NULL || vtx == NULL)
return NULL;
@@ -790,24 +822,24 @@ bool Scumm::areBoxesNeighbours(int box1nr, int box2nr)
tmp_y = box2.ul.y;
box2.ul.x = box2.ur.x;
box2.ul.y = box2.ur.y;
- box2.ur.x = box2.ll.x;
- box2.ur.y = box2.ll.y;
- box2.ll.x = box2.lr.x;
- box2.ll.y = box2.lr.y;
- box2.lr.x = tmp_x;
- box2.lr.y = tmp_y;
+ box2.ur.x = box2.lr.x;
+ box2.ur.y = box2.lr.y;
+ box2.lr.x = box2.ll.x;
+ box2.lr.y = box2.ll.y;
+ box2.ll.x = tmp_x;
+ box2.ll.y = tmp_y;
} while (--k);
tmp_x = box.ul.x;
tmp_y = box.ul.y;
box.ul.x = box.ur.x;
box.ul.y = box.ur.y;
- box.ur.x = box.ll.x;
- box.ur.y = box.ll.y;
- box.ll.x = box.lr.x;
- box.ll.y = box.lr.y;
- box.lr.x = tmp_x;
- box.lr.y = tmp_y;
+ box.ur.x = box.lr.x;
+ box.ur.y = box.lr.y;
+ box.lr.x = box.ll.x;
+ box.lr.y = box.ll.y;
+ box.ll.x = tmp_x;
+ box.ll.y = tmp_y;
} while (--j);
return result;
@@ -901,8 +933,8 @@ void Scumm::getGates(int trap1, int trap2, ScummPoint gateA[2], ScummPoint gateB
getBoxCoordinates(trap1, &box);
poly[0] = box.ul;
poly[1] = box.ur;
- poly[2] = box.ll;
- poly[3] = box.lr;
+ poly[2] = box.lr;
+ poly[3] = box.ll;
for (i = 0; i < 4; i++) {
abr = getClosestPtOnBox(trap2, poly[i].x, poly[i].y);
Dist[i] = abr.dist;
@@ -914,8 +946,8 @@ void Scumm::getGates(int trap1, int trap2, ScummPoint gateA[2], ScummPoint gateB
getBoxCoordinates(trap2, &box);
poly[4] = box.ul;
poly[5] = box.ur;
- poly[6] = box.ll;
- poly[7] = box.lr;
+ poly[6] = box.lr;
+ poly[7] = box.ll;
for (i = 4; i < 8; i++) {
abr = getClosestPtOnBox(trap1, poly[i].x, poly[i].y);
Dist[i] = abr.dist;
diff --git a/boxes.h b/boxes.h
index b2287ba590..4e627cbf41 100644
--- a/boxes.h
+++ b/boxes.h
@@ -20,24 +20,10 @@
*
*/
-#if !defined(__GNUC__)
- #pragma START_PACK_STRUCTS
-#endif
+#ifndef BOXES_H
+#define BOXES_H
#define SIZEOF_BOX 20
-struct Box { /* Internal walkbox file format */
- int16 ulx,uly;
- int16 urx,ury;
- int16 llx,lly;
- int16 lrx,lry;
- byte mask;
- byte flags;
- uint16 scale;
-} GCC_PACK;
-
-#if !defined(__GNUC__)
- #pragma END_PACK_STRUCTS
-#endif
struct AdjustBoxResult { /* Result type of AdjustBox functions */
int16 x,y;
@@ -51,12 +37,8 @@ struct BoxCoords { /* Box coordinates */
ScummPoint lr;
};
-struct PathNode { /* Linked list of walkpath nodes */
- uint index;
- struct PathNode *left, *right;
-};
+struct Box;
+struct PathNode;
+struct PathVertex;
-struct PathVertex { /* Linked list of walkpath nodes */
- PathNode *left;
- PathNode *right;
-};
+#endif
diff --git a/costume.cpp b/costume.cpp
index 6ca5f5618d..10e632f0d2 100644
--- a/costume.cpp
+++ b/costume.cpp
@@ -23,6 +23,7 @@
#include "stdafx.h"
#include "scumm.h"
#include "actor.h"
+#include "costume.h"
const byte revBitMask[8] = { 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01 };
diff --git a/guimaps.h b/guimaps.h
index fdf1bba1f2..181dbb6bc9 100644
--- a/guimaps.h
+++ b/guimaps.h
@@ -37,7 +37,7 @@ static const char* string_map_table_custom[] = {
"Keys", //6
"About", //7
"Pocket ScummVM", //8
- "Build " SCUMMVM_VERSION "(" SCUMMVM_CVS ")", //9
+ "Build " SCUMMVM_VERSION " (" SCUMMVM_CVS ")", //9
"ScummVM http://scummvm.sourceforge.net", //10
"All games (c) LucasArts", //11
"Quit", //12
@@ -48,7 +48,7 @@ static const char* string_map_table_custom[] = {
"Options", //17
"Misc", //18
"Show speech subtitles", //19
- "Amiga pallette conversion", //20
+ "Amiga palette conversion", //20
"Except:", //21
"Simon the Sorcerer (c) Adventuresoft", //22
"Close" //23
diff --git a/scumm.h b/scumm.h
index 563c70a42d..69a84d1403 100644
--- a/scumm.h
+++ b/scumm.h
@@ -28,7 +28,7 @@
#include "sound/mixer.h"
#define SCUMMVM_VERSION "0.2.2 CVS"
-#define SCUMMVM_CVS "070802"
+#define SCUMMVM_CVS "2002-07-16"
#define SWAP(a,b) do{int tmp=a; a=b; b=tmp; } while(0)
#define ARRAYSIZE(x) (sizeof(x)/sizeof(x[0]))
@@ -351,87 +351,6 @@ struct CharsetRenderer {
void addLinebreaks(int a, byte *str, int pos, int maxwidth);
};
-class LoadedCostume {
-protected:
- Scumm *_vm;
-
-public:
- byte *_ptr;
- byte *_dataptr;
- byte _numColors;
-
- LoadedCostume(Scumm *vm) : _vm(vm), _ptr(0), _dataptr(0), _numColors(0) {}
-
- void loadCostume(int id);
- byte increaseAnims(Actor *a);
-
-protected:
- byte increaseAnim(Actor *a, int slot);
-};
-
-class CostumeRenderer {
-protected:
- Scumm *_vm;
-
- LoadedCostume _loaded;
-
-public:
- byte *_shadow_table;
-
- byte *_frameptr;
- byte *_srcptr;
- byte *_bgbak_ptr, *_backbuff_ptr, *_mask_ptr, *_mask_ptr_dest;
- int _actorX, _actorY;
- byte _zbuf;
- uint _scaleX, _scaleY;
- int _xmove, _ymove;
- bool _mirror;
- byte _maskval;
- byte _shrval;
- byte _width2;
- int _width;
- byte _height2;
- int _height;
- int _xpos, _ypos;
-
- uint _outheight;
- int _scaleIndexXStep;
- int _scaleIndexYStep;
- byte _scaleIndexX; /* must wrap at 256 */
- byte _scaleIndexY, _scaleIndexYTop;
- int _left, _right;
- int _dir2;
- int _top, _bottom;
- int _ypostop;
- int _ypitch;
- byte _docontinue;
- int _imgbufoffs;
- byte _repcolor;
- byte _replen;
- byte _palette[32];
- byte _transEffect[0x100];
-
- void proc6();
- void proc5();
- void proc4();
- void proc3();
- void proc2();
- void proc1();
- void proc_special(Actor *a, byte mask);
- byte mainRoutine(Actor *a, int slot, int frame);
- void ignorePakCols(int num);
-
- byte drawOneSlot(Actor *a, int slot);
- byte drawCostume(Actor *a);
-
- void setPalette(byte *palette);
- void setFacing(uint16 facing);
- void setCostume(int costume);
-
-public:
- CostumeRenderer(Scumm *vm) : _vm(vm), _loaded(vm) {}
-};
-
#define ARRAY_HDR_SIZE 6
struct ArrayHeader {
int16 dim1_size;
@@ -1183,7 +1102,6 @@ public:
uint16 _extraBoxFlags[65];
int16 _foundPathX, _foundPathY;
- PathVertex *unkMatrixProc1(PathVertex *vtx, PathNode *node);
PathNode *unkMatrixProc2(PathVertex *vtx, int i);
bool areBoxesNeighbours(int i, int j);
void addToBoxMatrix(byte b);