SAGA2: Fix some global constructor warnings

This commit is contained in:
a/ 2021-07-01 04:11:46 +09:00 committed by Eugene Sandulenko
parent 4048869485
commit 19c3be9104
No known key found for this signature in database
GPG Key ID: 014D387312D34F08
6 changed files with 30 additions and 24 deletions

View File

@ -110,27 +110,27 @@ x Single
Motion Constants
* ===================================================================== */
TilePoint dirTable[8] = {
TilePoint(2, 2, 0),
TilePoint(0, 3, 0),
TilePoint(-2, 2, 0),
TilePoint(-3, 0, 0),
TilePoint(-2, -2, 0),
TilePoint(0, -3, 0),
TilePoint(2, -2, 0),
TilePoint(3, 0, 0)
const StaticTilePoint dirTable[8] = {
{ 2, 2, 0},
{ 0, 3, 0},
{-2, 2, 0},
{-3, 0, 0},
{-2, -2, 0},
{ 0, -3, 0},
{ 2, -2, 0},
{ 3, 0, 0}
};
// Incremental direction table
TilePoint incDirTable[8] = {
TilePoint(1, 1, 0),
TilePoint(0, 1, 0),
TilePoint(-1, 1, 0),
TilePoint(-1, 0, 0),
TilePoint(-1, -1, 0),
TilePoint(0, -1, 0),
TilePoint(1, -1, 0),
TilePoint(1, 0, 0)
const StaticTilePoint incDirTable[8] = {
{ 1, 1, 0},
{ 0, 1, 0},
{-1, 1, 0},
{-1, 0, 0},
{-1, -1, 0},
{ 0, -1, 0},
{ 1, -1, 0},
{ 1, 0, 0}
};
extern uint16 uMaxMasks[4],

View File

@ -34,7 +34,8 @@ namespace Saga2 {
class PathRequest;
struct StandingTileInfo;
extern TilePoint dirTable[];
extern const StaticTilePoint dirTable[];
extern const StaticTilePoint incDirTable[];
const int gravity = 2;

View File

@ -146,8 +146,6 @@ extern ObjectID pickedObject;
const uint32 imageGroupID = MKTAG('I', 'M', 'A', 'G');
extern TilePoint incDirTable[];
bool unstickObject(GameObject *obj);
/* ===================================================================== *

View File

@ -55,8 +55,6 @@ extern PlayerActor playerList[]; // Master list of all PlayerActors
extern ObjectSoundFXs *objectSoundFXTable; // the global object sound effects table
extern TilePoint incDirTable[];
#if DEBUG
extern bool massAndBulkCount;
#endif

View File

@ -193,7 +193,7 @@ int16 scriptActorMove(int16 *args) {
// parameter is for actor facing, only used by actors)
// void "c" moveRel( GameObject id baseObj, int angle, int distance, ... );
extern TilePoint dirTable[8];
extern const StaticTilePoint dirTable[8];
int16 scriptActorMoveRel(int16 *args) {
OBJLOG(MoveRel);

View File

@ -79,6 +79,15 @@ struct StaticTilePoint {
return p;
}
friend StaticTilePoint operator/(StaticTilePoint a, int b) {
int16 nu = a.u / b;
int16 nv = a.v / b;
int16 nz = a.z / b;
StaticTilePoint p = {nu, nv, nz};
return p;
}
void operator+=(StaticTilePoint a) {
u += a.u;
v += a.v;