Initial commit

This commit is contained in:
2026-02-02 04:50:13 +01:00
commit 5b11698731
22592 changed files with 7677434 additions and 0 deletions

View File

@@ -0,0 +1,139 @@
/* 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.
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef ULTIMA8_MISC_BOX_H
#define ULTIMA8_MISC_BOX_H
#include "common/scummsys.h"
namespace Ultima {
namespace Ultima8 {
/**
* Represents a worldspace bounding box and manipulation of those bounds.
* The box is built from a world point and positive dimensions
* The box has reversed coordinates for x and y, meaning those dimensions are
* subtracted from primary world point to calculate other points.
*/
struct Box {
int32 _x, _y, _z;
int32 _xd, _yd, _zd;
Box() : _x(0), _y(0), _z(0), _xd(0), _yd(0), _zd(0) {}
Box(int nx, int ny, int nz, int nxd, int nyd, int nzd)
: _x(nx), _y(ny), _z(nz), _xd(nxd), _yd(nyd), _zd(nzd) {}
// Check if the Box is empty (its width, height, or depth is 0) or invalid (its width, height, or depth are negative).
bool isEmpty() const {
return _xd <= 0 || _yd <= 0 || _zd <= 0;
}
// Check to see if a Box is 'valid'
bool isValid() const {
return _xd >= 0 && _yd >= 0 && _zd >= 0;
}
// Check to see if a point is within the Box
bool contains(int32 px, int32 py, int32 pz) const {
return px > _x - _xd && px <= _x &&
py > _y - _yd && py <= _y &&
pz >= _z && pz < _z + _zd;
}
// Check to see if a 2d point is within the XY of the Box
bool containsXY(int32 px, int32 py) const {
return px > _x - _xd && px <= _x &&
py > _y - _yd && py <= _y;
}
// Check to see if the box is below a point
bool isBelow(int32 px, int32 py, int32 pz) const {
return px > _x - _xd && px <= _x &&
py > _y - _yd && py <= _y &&
pz >= _z + _zd;
}
// Move the Box (Relative)
void translate(int32 dx, int32 dy, int32 dz) {
_x += dx;
_y += dy;
_z += dz;
}
// Move the Box (Absolute)
void moveTo(int32 nx, int32 ny, int32 nz) {
_x = nx;
_y = ny;
_z = nz;
}
// Resize the Box (Absolute)
void resize(int32 nxd, int32 nyd, int32 nzd) {
_xd = nxd;
_yd = nyd;
_zd = nzd;
}
bool overlaps(const Box &o) const {
if (_x <= o._x - o._xd || o._x <= _x - _xd)
return false;
if (_y <= o._y - o._yd || o._y <= _y - _yd)
return false;
if (_z + _zd <= o._z || o._z + o._zd <= _z)
return false;
return true;
}
bool overlapsXY(const Box& o) const {
if (_x <= o._x - o._xd || o._x <= _x - _xd)
return false;
if (_y <= o._y - o._yd || o._y <= _y - _yd)
return false;
return true;
}
void extend(const Box &o) {
int32 x2 = MIN(_x - _xd, o._x - o._xd);
int32 y2 = MIN(_y - _yd, o._y - o._yd);
int32 z2 = MAX(_z + _zd, o._z + o._zd);
_x = MAX(_x, o._x);
_y = MAX(_y, o._y);
_z = MIN(_z, o._z);
_xd = _x - x2;
_yd = _y - y2;
_zd = z2 - _z;
}
bool operator==(const Box &rhs) const { return equals(rhs); }
bool operator!=(const Box &rhs) const { return !equals(rhs); }
bool equals(const Box &o) const {
return (_x == o._x && _y == o._y && _z == o._z &&
_xd == o._xd && _yd == o._yd && _zd == o._zd);
}
};
} // End of namespace Ultima8
} // End of namespace Ultima
#endif

View File

@@ -0,0 +1,51 @@
/* 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.
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef ULTIMA8_MISC_CLASSTYPE_H
#define ULTIMA8_MISC_CLASSTYPE_H
namespace Ultima {
namespace Ultima8 {
// This is 'type' used to differentiate each class.
// The class name is used primarily to define entities in game saves
struct RunTimeClassType {
const char *_className;
inline bool operator == (const RunTimeClassType &other) const {
return this == &other;
}
};
#define ENABLE_RUNTIME_CLASSTYPE() \
static const RunTimeClassType ClassType; \
const RunTimeClassType & GetClassType() const override { return ClassType; }
#define ENABLE_RUNTIME_CLASSTYPE_BASE() \
static const RunTimeClassType ClassType; \
virtual const RunTimeClassType & GetClassType() const { return ClassType; }
#define DEFINE_RUNTIME_CLASSTYPE_CODE(Classname) \
const RunTimeClassType Classname::ClassType = { #Classname };
} // End of namespace Ultima8
} // End of namespace Ultima
#endif

View File

@@ -0,0 +1,42 @@
/* 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.
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef ULTIMA8_MISC_COMMON_TYPES_H
#define ULTIMA8_MISC_COMMON_TYPES_H
#include "common/scummsys.h"
namespace Ultima {
namespace Ultima8 {
// ObjId and ProcId
//! 16-Bit ID of an Object
typedef uint16 ObjId;
//! 16-Bit ID of a Process
typedef uint16 ProcId;
} // End of namespace Ultima8
} // End of namespace Ultima
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,153 @@
/* 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.
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef ULTIMA_ULTIMA8_ENGINE_DEBUGGER_H
#define ULTIMA_ULTIMA8_ENGINE_DEBUGGER_H
#include "ultima/ultima8/misc/common_types.h"
#include "ultima/shared/std/containers.h"
#include "common/debug.h"
#include "common/stream.h"
#include "gui/debugger.h"
namespace Ultima {
namespace Ultima8 {
/**
* Debugger base class
*/
class Debugger : public GUI::Debugger {
private:
const char *strBool(bool flag) {
return flag ? "true" : "false";
}
// Engine
bool cmdSaveGame(int argc, const char **argv);
bool cmdLoadGame(int argc, const char **argv);
bool cmdNewGame(int argc, const char **argv);
bool cmdQuit(int argc, const char **argv);
bool cmdSetVideoMode(int argc, const char **argv);
bool cmdEngineStats(int argc, const char **argv);
bool cmdAvatarInStasis(int argc, const char **argv);
bool cmdShowEditorItems(int argc, const char **argv);
bool cmdShowTouchingItems(int argc, const char **argv);
bool cmdCloseItemGumps(int argc, const char **argv);
bool cmdCameraOnAvatar(int argc, const char **argv);
// Audio Process
bool cmdListSFX(int argc, const char **argv);
bool cmdStopSFX(int argc, const char **argv);
bool cmdPlaySFX(int argc, const char **argv);
// Cheats
bool cmdCheatMode(int argc, const char **argv);
bool cmdCheatItems(int argc, const char **argv);
bool cmdCheatEquip(int argc, const char **argv);
bool cmdMaxStats(int argc, const char **argv);
bool cmdHeal(int argc, const char **argv);
bool cmdInvincibility(int argc, const char **argv);
bool cmdHackMover(int argc, const char **argv);
// Game Map Gump
bool cmdHighlightItems(int argc, const char **argv);
bool cmdFootpads(int argc, const char **argv);
bool cmdGridlines(int argc, const char **argv);
bool cmdDumpMap(int argc, const char **argvv);
bool cmdDumpAllMaps(int argc, const char **argv);
bool cmdIncrementSortOrder(int argc, const char **argv);
bool cmdDecrementSortOrder(int argc, const char **argv);
// Kernel
bool cmdProcessTypes(int argc, const char **argv);
bool cmdListProcesses(int argc, const char **argv);
bool cmdProcessInfo(int argc, const char **argv);
bool cmdFrameByFrame(int argc, const char **argv);
bool cmdAdvanceFrame(int argc, const char **argv);
// Main Actor
bool cmdTeleport(int argc, const char **argv);
bool cmdMark(int argc, const char **argv);
bool cmdRecall(int argc, const char **argv);
bool cmdListMarks(int argc, const char **argv);
bool cmdName(int argc, const char **argv);
bool cmdUseBackpack(int argc, const char **argv);
bool cmdUseInventory(int argc, const char **argv);
bool cmdUseRecall(int argc, const char **argv);
bool cmdUseBedroll(int argc, const char **argv);
bool cmdUseKeyring(int argc, const char **argv);
bool cmdNextInventory(int argc, const char **argv);
bool cmdNextWeapon(int argc, const char **argv);
bool cmdCombat(int argc, const char **argv);
bool cmdUseInventoryItem(int argc, const char **argv);
bool cmdUseMedikit(int argc, const char **argv);
bool cmdUseEnergyCube(int argc, const char **argv);
bool cmdDetonateBomb(int argc, const char **argv);
bool cmdDropWeapon(int argc, const char **argv);
bool cmdStartSelection(int argc, const char **argv);
bool cmdUseSelection(int argc, const char **argv);
bool cmdGrabItems(int argc, const char **argv);
// Object Manager
bool cmdObjectTypes(int argc, const char **argv);
bool cmdObjectInfo(int argc, const char **argv);
// Quick Avatar Mover Process
bool cmdQuickMover(int argc, const char **argv);
bool cmdClipping(int argc, const char **argv);
// UCMachine
bool cmdGetGlobal(int argc, const char **argv);
bool cmdSetGlobal(int argc, const char **argv);
bool cmdTracePID(int argc, const char **argv);
bool cmdTraceObjID(int argc, const char **argv);
bool cmdTraceClass(int argc, const char **argv);
bool cmdTraceAll(int argc, const char **argv);
bool cmdStopTrace(int argc, const char **argv);
// Miscellaneous
bool cmdToggleFastArea(int argc, const char **argv);
bool cmdVerifyQuit(int argc, const char **argv);
bool cmdU8ShapeViewer(int argc, const char **argv);
bool cmdShowMenu(int argc, const char **argv);
bool cmdToggleMinimap(int argc, const char **argv);
bool cmdGenerateMinimap(int argc, const char **argv);
bool cmdClearMinimap(int argc, const char **argv);
bool cmdInvertScreen(int argc, const char **argv);
bool cmdPlayMovie(int argc, const char **argv);
bool cmdPlayMusic(int argc, const char **argv);
bool cmdBenchmarkRenderSurface(int argc, const char **argv);
bool cmdVisualDebugPathfinder(int argc, const char **argv);
void dumpCurrentMap(); // helper function
public:
Debugger();
~Debugger() override;
};
extern Debugger *g_debugger;
} // End of namespace Ultima8
} // End of namespace Ultima
#endif

View File

@@ -0,0 +1,60 @@
/* 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.
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef ULTIMA8_MISC_DIRECTION_H
#define ULTIMA8_MISC_DIRECTION_H
namespace Ultima {
namespace Ultima8 {
/*
* Directions:
*/
enum Direction {
dir_north = 0,
dir_nne = 1,
dir_northeast = 2,
dir_ene = 3,
dir_east = 4,
dir_ese = 5,
dir_southeast = 6,
dir_sse = 7,
dir_south = 8,
dir_ssw = 9,
dir_southwest = 10,
dir_wsw = 11,
dir_west = 12,
dir_wnw = 13,
dir_northwest = 14,
dir_nnw = 15,
dir_current = 16,
dir_invalid = 100
};
enum DirectionMode {
dirmode_8dirs,
dirmode_16dirs
};
} // End of namespace Ultima8
} // End of namespace Ultima
#endif

View File

@@ -0,0 +1,276 @@
/* 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.
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef ULTIMA8_MISC_DIRECTIONUTIL_H
#define ULTIMA8_MISC_DIRECTIONUTIL_H
#include "ultima/ultima8/misc/direction.h"
#include "ultima/ultima8/ultima8.h"
#include "math/utils.h"
namespace Ultima {
namespace Ultima8 {
/*
* Tables to map a Direction to x/y deltas
*/
inline int Direction_XFactor(Direction dir) {
static const int _x_fact[] = { 0, +1, +1, +1, 0, -1, -1, -1 };
static const int _x_fact16[] = { 0, +1, +1, +2, +1, +2, +1, +1, 0, -1, -1, -2, -1, -2, -1, -1, 0 };
assert((int)dir >= 0 && (int)dir < 16);
if (GAME_IS_U8)
return _x_fact[(int)dir / 2];
else
return _x_fact16[(int)dir];
}
inline int Direction_YFactor(Direction dir) {
static const int _y_fact[] = { -1, -1, 0, +1, +1, +1, 0, -1 };
static const int _y_fact16[] = { -1, -2, -1, -1, 0, +1, +1, +2, +1, +2, +1, +1, 0, -1, -1, -2, 0 };
assert((int)dir >= 0 && (int)dir < 16);
if (GAME_IS_U8)
return _y_fact[(int)dir / 2];
else
return _y_fact16[(int)dir];
}
//! Convert a direction to hundreths of degrees (rotated by 90 degrees)
inline int32 Direction_ToCentidegrees(Direction dir) {
return static_cast<int>(dir) * 2250;
}
//! Convert from centidegrees to a direction.
inline Direction Direction_FromCentidegrees(int32 cds) {
return static_cast<Direction>(((cds + 1125) / 2250) % 16);
}
/**
* Return the direction for a given slope (0-7).
* NOTE: Assumes cartesian coords, NOT screen coords. (which have y
* growing downwards).
*
* NOTE: The returned direction is rotated 45 degrees clockwise! This is
* how U8 things should be.
*/
inline Direction Direction_Get(int deltay, int deltax, DirectionMode dirmode) {
if (deltax == 0)
return deltay > 0 ? dir_northwest : dir_southeast;
if (dirmode == dirmode_8dirs) {
int dydx = (1024 * deltay) / deltax; // Figure 1024*tan.
if (dydx >= 0)
if (deltax > 0) // Top-right
return dydx <= 424 ? dir_northeast : dydx <= 2472 ? dir_north
: dir_northwest;
else // Bottom-left.
return dydx <= 424 ? dir_southwest : dydx <= 2472 ? dir_south
: dir_southeast;
else if (deltax > 0) // Bottom-right.
return dydx >= -424 ? dir_northeast : dydx >= -2472 ? dir_east
: dir_southeast;
else // Top-left
return dydx >= -424 ? dir_southwest : dydx >= -2472 ? dir_west
: dir_northwest;
} else {
double angle = Math::rad2deg(atan2(deltay, deltax));
if (angle < -168.75) return dir_southwest;
else if (angle < -146.25) return dir_ssw;
else if (angle < -123.75) return dir_south;
else if (angle < -101.25) return dir_sse;
else if (angle < -78.75) return dir_southeast;
else if (angle < -56.25) return dir_ese;
else if (angle < -33.75) return dir_east;
else if (angle < -11.25) return dir_ene;
else if (angle < 11.25) return dir_northeast;
else if (angle < 33.75) return dir_nne;
else if (angle < 56.25) return dir_north;
else if (angle < 78.75) return dir_nnw;
else if (angle < 101.25) return dir_northwest;
else if (angle < 123.75) return dir_wnw;
else if (angle < 146.25) return dir_west;
else if (angle < 168.75) return dir_wsw;
return dir_southwest;
}
}
// Note that for WorldDir, Y goes down, so a positive Y points south.
inline Direction Direction_GetWorldDir(int deltay, int deltax, DirectionMode dirmode) {
if (deltax == 0) {
if (deltay == 0) return dir_northeast; // for better compatibility with U8
return deltay > 0 ? dir_south : dir_north;
}
if (dirmode == dirmode_8dirs) {
int dydx = (1024 * deltay) / deltax;
if (dydx >= 0)
if (deltax > 0) // south-east
return dydx <= 424 ? dir_east : dydx <= 2472 ? dir_southeast : dir_south;
else // north-west
return dydx <= 424 ? dir_west : dydx <= 2472 ? dir_northwest : dir_north;
else if (deltax > 0) // north-east
return dydx >= -424 ? dir_east : dydx >= -2472 ? dir_northeast : dir_north;
else // south-west
return dydx >= -424 ? dir_west : dydx >= -2472 ? dir_southwest : dir_south;
} else {
double angle = Math::rad2deg(atan2(deltay, deltax));
if (angle < -168.75) return dir_west;
else if (angle < -146.25) return dir_wnw;
else if (angle < -123.75) return dir_northwest;
else if (angle < -101.25) return dir_nnw;
else if (angle < -78.75) return dir_north;
else if (angle < -56.25) return dir_nne;
else if (angle < -33.75) return dir_northeast;
else if (angle < -11.25) return dir_ene;
else if (angle < 11.25) return dir_east;
else if (angle < 33.75) return dir_ese;
else if (angle < 56.25) return dir_southeast;
else if (angle < 78.75) return dir_sse;
else if (angle < 101.25) return dir_south;
else if (angle < 123.75) return dir_ssw;
else if (angle < 146.25) return dir_southwest;
else if (angle < 168.75) return dir_wsw;
return dir_west;
}
}
inline Direction Direction_GetWorldDirInRange(int deltay, int deltax, DirectionMode dirmode, Direction mindir, Direction maxdir) {
int ndirs = (dirmode == dirmode_8dirs ? 8 : 16);
Direction dir = Direction_GetWorldDir(deltay, deltax, dirmode);
if ((dir < mindir) || (dir > maxdir)) {
int32 dmin1 = dir - mindir;
int32 dmin2 = mindir - dir;
if (dmin1 < 0) {
dmin1 = dmin1 + ndirs;
}
if (dmin2 < 0) {
dmin2 = dmin2 + ndirs;
}
int32 dist_to_min = MIN(dmin1, dmin2);
int dmax1 = dir - maxdir;
int dmax2 = maxdir - dir;
if (dmax1 < 0) {
dmax1 = dmax1 + ndirs;
}
if (dmax2 < 0) {
dmax2 = dmax2 + ndirs;
}
int32 dist_to_max = MIN(dmax1, dmax2);
if (dist_to_min < dist_to_max) {
return mindir;
} else {
return maxdir;
}
}
return dir;
}
inline Direction Direction_Invert(Direction dir) {
assert(dir != dir_current);
switch (dir) {
case dir_north: return dir_south;
case dir_nne: return dir_ssw;
case dir_northeast: return dir_southwest;
case dir_ene: return dir_wsw;
case dir_east: return dir_west;
case dir_ese: return dir_wnw;
case dir_southeast: return dir_northwest;
case dir_sse: return dir_nnw;
case dir_south: return dir_north;
case dir_ssw: return dir_nne;
case dir_southwest: return dir_northeast;
case dir_wsw: return dir_ene;
case dir_west: return dir_east;
case dir_wnw: return dir_ese;
case dir_northwest: return dir_southeast;
case dir_nnw: return dir_sse;
default: return dir_north;
}
}
//! Return the direction one left (aka counter-clockwise) of the input
inline Direction Direction_OneLeft(Direction dir, DirectionMode mode) {
if (mode == dirmode_8dirs)
return static_cast<Direction>((static_cast<int>(dir) + 14) % 16);
else
return static_cast<Direction>((static_cast<int>(dir) + 15) % 16);
}
//! Return the direction one right (aka clockwise) of the input
inline Direction Direction_OneRight(Direction dir, DirectionMode mode) {
if (mode == dirmode_8dirs)
return static_cast<Direction>((static_cast<int>(dir) + 2) % 16);
else
return static_cast<Direction>((static_cast<int>(dir) + 1) % 16);
}
inline Direction Direction_TurnByDelta(Direction dir, int delta, DirectionMode mode) {
if (delta > 0) {
for (int i = 0; i < delta; i++)
dir = Direction_OneRight(dir, mode);
} else if (delta < 0) {
for (int i = 0; i < -delta; i++)
dir = Direction_OneLeft(dir, mode);
}
return dir;
}
//! Get a turn delta (-1 for left, +1 for right) to turn the fastest
//! way from one direction to another
inline int Direction_GetShorterTurnDelta(Direction from, Direction to) {
if ((from - to + 16) % 16 < 8)
return -1;
return 1;
}
inline uint32 Direction_ToUsecodeDir(Direction dir) {
if (GAME_IS_U8) {
return static_cast<int32>(dir / 2);
} else {
return static_cast<int32>(dir);
}
}
inline Direction Direction_FromUsecodeDir(uint32 dir) {
if (GAME_IS_U8) {
return static_cast<Direction>(dir * 2);
} else {
return static_cast<Direction>(dir);
}
}
} // End of namespace Ultima8
} // End of namespace Ultima
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,44 @@
/* 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.
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef ULTIMA8_MISC_ENCODING_H
#define ULTIMA8_MISC_ENCODING_H
#include "common/scummsys.h"
namespace Ultima {
namespace Ultima8 {
extern const uint8 reverse_encoding[256];
extern const uint16 encoding[256];
// first byte in shift_jis character stream encoded as LSbyte in sjis
// if first byte is >= 0x80 then second byte in character stream as MSB in sjis
// return value is index in U8's japanese font. 0 for missing codepoints
uint16 shiftjis_to_ultima8(uint16 sjis);
uint32 shiftjis_to_unicode(uint16 sjis);
} // End of namespace Ultima8
} // End of namespace Ultima
#endif

View File

@@ -0,0 +1,228 @@
/* 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.
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*
*/
#include "ultima/ultima8/misc/debugger.h"
#include "ultima/ultima8/misc/id_man.h"
namespace Ultima {
namespace Ultima8 {
idMan::idMan(uint16 begin, uint16 maxEnd, uint16 startCount)
: _begin(begin), _maxEnd(maxEnd), _startCount(startCount) {
// 0 is always reserved, as is 65535
if (_begin == 0) _begin = 1;
if (_maxEnd == 65535) _maxEnd = 65534;
if (_startCount == 0) _startCount = _maxEnd - _begin + 1;
_end = _begin + _startCount - 1;
if (_end > _maxEnd) _end = _maxEnd;
_ids.resize(_end + 1);
clearAll();
}
idMan::~idMan() {
}
void idMan::clearAll(uint16 new_max) {
if (new_max)
_maxEnd = new_max;
_end = _begin + _startCount - 1;
if (_end > _maxEnd) _end = _maxEnd;
_ids.resize(_end + 1);
_first = _begin;
_last = _end;
_usedCount = 0;
uint16 i;
for (i = 0; i < _first; i++) _ids[i] = 0; // NPCs always used
for (; i < _last; i++) _ids[i] = i + 1; // Free IDs
_ids[_last] = 0; // Terminates the list
}
uint16 idMan::getNewID() {
// more than 75% used and room to expand?
if (_usedCount * 4 > (_end - _begin + 1) * 3 && _end < _maxEnd) {
expand();
}
// Uh oh, what to do when there is none
if (!_first) {
warning("Unable to allocate id (max = %d)", _maxEnd);
return 0;
}
// Get the next id
uint16 id = _first;
// Set the _first in the list to next
_first = _ids[id];
// Set us to used
_ids[id] = 0;
// If there is no _first, there is no list, cause there's none left
// So clear the _last pointer
if (!_first) _last = 0;
_usedCount++;
return id;
}
void idMan::expand() {
if (_end == _maxEnd) return;
uint16 old_end = _end;
unsigned int new_end = _end * 2;
if (new_end > _maxEnd) new_end = _maxEnd;
_end = new_end;
_ids.resize(_end + 1);
#if 0
debug(1, "Expanding idMan from (%u-%u) to (%u-%u)",
_begin, old_end, _begin, _end);
#endif
// insert the new free IDs at the start
for (uint16 i = old_end + 1; i < _end; ++i) {
_ids[i] = i + 1;
}
_ids[_end] = _first;
_first = old_end + 1;
}
bool idMan::reserveID(uint16 id) {
if (id < _begin || id > _maxEnd) {
return false;
}
// expand until we're big enough to reserve this ID
while (id > _end) {
expand();
}
if (isIDUsed(id))
return false; // already used
_usedCount++;
// more than 75% used and room to expand?
if (_usedCount * 4 > (_end - _begin + 1) * 3 && _end < _maxEnd) {
expand();
}
if (id == _first) {
_first = _ids[id];
_ids[id] = 0;
if (!_first) _last = 0;
return true;
}
uint16 node = _ids[_first];
uint16 prev = _first;
while (node != id && node != 0) {
prev = node;
node = _ids[node];
}
assert(node != 0); // list corrupt...
_ids[prev] = _ids[node];
_ids[node] = 0;
if (_last == node)
_last = prev;
return true;
}
void idMan::clearID(uint16 id) {
// Only clear IF it is used. We don't want to screw up the linked list
// if an id gets cleared twice
if (isIDUsed(id)) {
// If there is a _last, then set the _last's next to us
// or if there isn't a _last, obviously no list exists,
// so set the _first to us
if (_last) _ids[_last] = id;
else _first = id;
// Set the _end to us
_last = id;
// Set our next to terminate
_ids[id] = 0;
_usedCount--;
}
// double-check we didn't break the list
assert(!_first || _last);
}
void idMan::save(Common::WriteStream *ws) const {
ws->writeUint16LE(_begin);
ws->writeUint16LE(_end);
ws->writeUint16LE(_maxEnd);
ws->writeUint16LE(_startCount);
ws->writeUint16LE(_usedCount);
uint16 cur = _first;
while (cur) {
ws->writeUint16LE(cur);
cur = _ids[cur];
}
ws->writeUint16LE(0); // terminator
}
bool idMan::load(Common::ReadStream *rs, uint32 version) {
_begin = rs->readUint16LE();
_end = rs->readUint16LE();
_maxEnd = rs->readUint16LE();
_startCount = rs->readUint16LE();
uint16 realusedcount = rs->readUint16LE();
_ids.resize(_end + 1);
for (unsigned int i = 0; i <= _end; ++i) {
_ids[i] = 0;
}
_first = _last = 0;
uint16 cur = rs->readUint16LE();
while (cur) {
clearID(cur);
cur = rs->readUint16LE();
}
_usedCount = realusedcount;
// Integrity check
if (_begin > _end || _begin > _maxEnd) {
warning("begin > end loading ids, corrupt save?");
return false;
}
return true;
}
} // End of namespace Ultima8
} // End of namespace Ultima

View File

@@ -0,0 +1,107 @@
/* 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.
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef ULTIMA8_MISC_IDMAN_H
#define ULTIMA8_MISC_IDMAN_H
#include "ultima/shared/std/containers.h"
namespace Ultima {
namespace Ultima8 {
//
// idMan. Used to allocate and keep track of unused ids.
// Supposed to be used by Kernel and World for pID and ObjId
//
// The idMan itself uses a nifty linked list that is also an array.
// As such it has the advantages of both. Adds and removals are fast,
// As is checking to see if an ID is used.
//
// idMan works as a LILO (last in last out) for id recycling. So an id that has
// been cleared will not be used until all other currently unused ids have been
// allocated.
//
class idMan {
uint16 _begin; //!< start of the available range of IDs
uint16 _end; //!< current end of the range
uint16 _maxEnd; //!< end of the available range
uint16 _startCount; //!< number of IDs to make available initially
uint16 _usedCount; //!< number of IDs currently in use
Std::vector<uint16> _ids; //!< the 'next' field in a list of free IDs
uint16 _first; //!< the first ID in the free list
uint16 _last; //!< the last ID in the last list
public:
//! \param begin start of the range of available IDs
//! \param max_end end of the range of available IDs
//! \param startcount number of IDs to make available initially (0 = all)
idMan(uint16 begin, uint16 max_end, uint16 startcount = 0);
~idMan();
//! check if this idMan is full
bool isFull() const {
return _first == 0 && _end >= _maxEnd;
}
//! clear all IDs, reset size to the startcount, and set max_end to new_max
void clearAll(uint16 new_max = 0);
//! get a free ID
//! \return a free ID, or 0 if none are available
uint16 getNewID();
//! mark a given ID as used, expanding if necessary.
//! Note: reserveID is O(n), so don't use too often.
//! \return false if the ID was already used or is out of range
bool reserveID(uint16 id);
//! release an id
void clearID(uint16 id);
//! check if an ID is in use
bool isIDUsed(uint16 id) const {
return id >= _begin && id <= _end && _ids[id] == 0 && id != _last;
}
//! increase the maximum size
//! Note: this shouldn't be used in normal circumstances.
//! It exists for dumpMap currently. If that is rewritten not
//! to need more than 32768 object IDs, this function should be
//! deleted.
void setNewMax(uint16 maxEnd) {
_maxEnd = maxEnd;
}
void save(Common::WriteStream *ws) const;
bool load(Common::ReadStream *rs, uint32 version);
private:
//! double the amount of available IDs (up to the maximum passed
//! to the constructor)
void expand();
};
} // End of namespace Ultima8
} // End of namespace Ultima
#endif

View File

@@ -0,0 +1,99 @@
/* 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.
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef ULTIMA8_MISC_POINT3_H
#define ULTIMA8_MISC_POINT3_H
namespace Ultima {
namespace Ultima8 {
struct Point3 {
int32 x, y, z;
Point3() : x(0), y(0), z(0) {}
Point3(int32 nx, int32 ny, int32 nz) : x(nx), y(ny), z(nz) {}
bool operator==(const Point3 &rhs) const { return equals(rhs); }
bool operator!=(const Point3 &rhs) const { return !equals(rhs); }
bool equals(const Point3 &p) const {
return (x == p.x && y == p.y && z == p.z);
}
Point3 operator+(const Point3 &delta) const { return Point3(x + delta.x, y + delta.y, z + delta.z); }
Point3 operator-(const Point3 &delta) const { return Point3(x - delta.x, y - delta.y, z - delta.z); }
void operator+=(const Point3 &delta) {
x += delta.x;
y += delta.y;
z += delta.z;
}
void operator-=(const Point3 &delta) {
x -= delta.x;
y -= delta.y;
z -= delta.z;
}
int maxDistXYZ(const Point3 &other) const {
int xdiff = abs(x - other.x);
int ydiff = abs(y - other.y);
int zdiff = abs(z - other.z);
return MAX(xdiff, MAX(ydiff, zdiff));
}
uint32 sqrDist(const Point3 &other) const {
int xdiff = abs(x - other.x);
int ydiff = abs(y - other.y);
int zdiff = abs(z - other.z);
return uint32(xdiff * xdiff + ydiff * ydiff + zdiff * zdiff);
}
void set(int32 nx, int32 ny, int32 nz) {
x = nx;
y = ny;
z = nz;
}
void translate(int32 dx, int32 dy, int32 dz) {
x += dx;
y += dy;
z += dz;
}
bool loadData(Common::ReadStream *rs, uint32 version) {
x = rs->readSint32LE();
y = rs->readSint32LE();
z = rs->readSint32LE();
return true;
}
void saveData(Common::WriteStream *ws) {
ws->writeSint32LE(x);
ws->writeSint32LE(y);
ws->writeSint32LE(z);
}
};
} // End of namespace Ultima8
} // End of namespace Ultima
#endif

View File

@@ -0,0 +1,97 @@
/* 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.
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef ULTIMA8_MISC_PRIORITY_QUEUE_H
#define ULTIMA8_MISC_PRIORITY_QUEUE_H
#include "common/algorithm.h"
#include "common/util.h"
namespace Ultima {
namespace Ultima8 {
/**
* Queue ordered by a provided priority function
* NOTE: Unlike in the C std library, we have to provde a comparitor that sorts
* the array so that the smallest priority comes last
*/
template <class _Ty, class _Container, class _Pr>
class PriorityQueue {
public:
PriorityQueue() : c(), comp() {}
explicit PriorityQueue(const _Pr &_Pred) : c(), comp(_Pred) {}
PriorityQueue(const _Pr &_Pred, const _Container &_Cont) : c(_Cont), comp(_Pred) {
make_heap(c.begin(), c.end(), comp);
}
template <class _InIt>
PriorityQueue(_InIt _First, _InIt _Last, const _Pr &_Pred, const _Container &_Cont) : c(_Cont), comp(_Pred) {
c.insert(c.end(), _First, _Last);
make_heap(c.begin(), c.end(), comp);
}
template <class _InIt>
PriorityQueue(_InIt _First, _InIt _Last) : c(_First, _Last), comp() {
make_heap(c.begin(), c.end(), comp);
}
template <class _InIt>
PriorityQueue(_InIt _First, _InIt _Last, const _Pr &_Pred) : c(_First, _Last), comp(_Pred) {
make_heap(c.begin(), c.end(), comp);
}
bool empty() const {
return c.empty();
}
size_t size() const {
return c.size();
}
typename _Container::const_reference top() const {
return c.back();
}
void push(const typename _Container::value_type &_Val) {
c.push_back(_Val);
Common::sort(c.begin(), c.end(), comp);
}
void pop() {
c.pop_back();
}
void swap(PriorityQueue &_Right) {
SWAP(c, _Right.c);
SWAP(comp, _Right.comp);
}
protected:
_Container c;
_Pr comp;
};
} // End of namespace Ultima8
} // End of namespace Ultima
#endif

View File

@@ -0,0 +1,100 @@
/* 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.
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef ULTIMA8_MISC_SET_H
#define ULTIMA8_MISC_SET_H
#include "common/algorithm.h"
#include "common/array.h"
namespace Ultima {
namespace Ultima8 {
template<class T>
class Set {
struct Comparitor {
bool operator()(const T &a, const T &b) const {
return a == b;
}
};
private:
Common::Array<T> _items;
Comparitor _comparitor;
public:
typedef T *iterator;
typedef const T *const_iterator;
iterator begin() { return _items.begin(); }
iterator end() { return _items.end(); }
const_iterator begin() const { return _items.begin(); }
const_iterator end() const { return _items.end(); }
/**
* Clear the set
*/
void clear() {
_items.clear();
}
/**
* Inserts a new item
*/
void insert(T val) {
_items.push_back(val);
Common::sort(begin(), end(), _comparitor);
}
/**
* Inserts a range of items
*/
void insert(iterator first, iterator last) {
for (; first != last; ++first)
_items.push_back(*first);
Common::sort(begin(), end(), _comparitor);
}
/**
* Swaps a set
*/
void swap(Set<T> &arr) {
_items.swap(arr);
}
/**
* Find an item
*/
iterator find(const T item) {
iterator it = begin();
for (; it != end() && *it != item; ++it) {}
return it;
}
const_iterator find(const T item) const {
const_iterator it = begin();
for (; it != end() && *it != item; ++it) {
}
return it;
}
};
} // End of namespace Ultima8
} // End of namespace Ultima
#endif

View File

@@ -0,0 +1,72 @@
/* 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.
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef ULTIMA8_MISC_STREAM_H
#define ULTIMA8_MISC_STREAM_H
#include "common/stream.h"
namespace Ultima {
namespace Ultima8 {
// Read a 3-byte value, lsb first.
inline uint32 readUint24LE(Common::ReadStream &rs) {
uint32 val = 0;
val |= static_cast<uint32>(rs.readByte());
val |= static_cast<uint32>(rs.readByte() << 8);
val |= static_cast<uint32>(rs.readByte() << 16);
return val;
}
inline uint32 readX(Common::ReadStream &rs, uint32 num_bytes) {
assert(num_bytes > 0 && num_bytes <= 4);
if (num_bytes == 1) return rs.readByte();
else if (num_bytes == 2) return rs.readUint16LE();
else if (num_bytes == 3) return readUint24LE(rs);
else return rs.readUint32LE();
}
inline int32 readXS(Common::ReadStream &rs, uint32 num_bytes) {
assert(num_bytes > 0 && num_bytes <= 4);
if (num_bytes == 1) return static_cast<int8>(rs.readByte());
else if (num_bytes == 2) return static_cast<int16>(rs.readUint16LE());
else if (num_bytes == 3) return (((static_cast<int32>(readUint24LE(rs))) << 8) >> 8);
else return static_cast<int32>(rs.readUint32LE());
}
inline void writeUint24LE(Common::WriteStream &ws, uint32 val) {
ws.writeByte(static_cast<byte>(val & 0xff));
ws.writeByte(static_cast<byte>((val >> 8) & 0xff));
ws.writeByte(static_cast<byte>((val >> 16) & 0xff));
}
inline void writeX(Common::WriteStream &ws, uint32 val, uint32 num_bytes) {
assert(num_bytes > 0 && num_bytes <= 4);
if (num_bytes == 1) ws.writeByte(static_cast<byte>(val));
else if (num_bytes == 2) ws.writeUint16LE(static_cast<uint16>(val));
else if (num_bytes == 3) writeUint24LE(ws, val);
else ws.writeUint32LE(val);
}
} // End of namespace Ultima8
} // End of namespace Ultima
#endif

View File

@@ -0,0 +1,145 @@
/* 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.
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*
*/
#include "ultima/shared/std/string.h"
#include "ultima/ultima8/misc/util.h"
namespace Ultima {
namespace Ultima8 {
template<class T> void StringToArgv(const T &args, Common::Array<T> &argv) {
// Clear the vector
argv.clear();
bool quoted = false;
typename T::const_iterator it;
int ch;
T arg;
for (it = args.begin(); it != args.end(); ++it) {
ch = *it;
// Toggle quoted string handling
if (ch == '\"') {
quoted = !quoted;
continue;
}
// Handle \\, \", \', \n, \r, \t
if (ch == '\\') {
typename T::const_iterator next = it + 1;
if (next != args.end()) {
if (*next == '\\' || *next == '\"' || *next == '\'') {
ch = *next;
++it;
} else if (*next == 'n') {
ch = '\n';
++it;
} else if (*next == 'r') {
ch = '\r';
++it;
} else if (*next == 't') {
ch = '\t';
++it;
} else if (*next == ' ') {
ch = ' ';
++it;
}
}
}
// A space, a tab, line feed, carriage return
if (!quoted && (ch == ' ' || ch == '\t' || ch == '\n' || ch == '\r')) {
// If we are not empty then we are at the end of the arg
// otherwise we will ignore the extra chars
if (!arg.empty()) {
argv.push_back(arg);
arg.clear();
}
continue;
}
// Add the charater to the string
arg += ch;
}
// Push any arg if it's left
if (!arg.empty()) argv.push_back(arg);
}
template void StringToArgv<Common::String>(const Common::String &args, Common::Array<Common::String> &argv);
template<class T> void SplitString(const T &args, char sep,
Std::vector<T> &argv) {
// Clear the vector
argv.clear();
if (args.empty()) return;
typename T::size_type pos, start;
start = 0;
while (start != T::npos) {
pos = args.find(sep, start);
if (pos == T::npos) {
argv.push_back(args.substr(start));
start = pos;
} else {
argv.push_back(args.substr(start, pos - start));
start = pos + 1;
}
}
}
template void SplitString<Std::string>(const Std::string &args, char sep, Std::vector<Std::string> &argv);
template<class T> void SplitStringKV(const T &args, char sep,
Std::vector<Common::Pair<T, T> > &argv) {
// Clear the vector
argv.clear();
if (args.empty()) return;
Std::vector<T> keyvals;
SplitString(args, sep, keyvals);
for (unsigned int i = 0; i < keyvals.size(); ++i) {
Common::Pair<T, T> keyval;
typename T::size_type pos;
pos = keyvals[i].find('=');
keyval.first = keyvals[i].substr(0, pos);
keyval.first.trim();
if (pos == T::npos) {
keyval.second = "";
} else {
keyval.second = keyvals[i].substr(pos + 1);
keyval.second.trim();
}
if (!(keyval.first.empty() && keyval.second.empty()))
argv.push_back(keyval);
}
}
template void SplitStringKV<Std::string>(const Std::string &args, char sep, Std::vector<Common::Pair<Std::string, Std::string> > &argv);
} // End of namespace Ultima8
} // End of namespace Ultima

View File

@@ -0,0 +1,40 @@
/* 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.
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef ULTIMA8_MISC_UTIL_H
#define ULTIMA8_MISC_UTIL_H
#include "ultima/shared/std/containers.h"
namespace Ultima {
namespace Ultima8 {
template<class T> void StringToArgv(const T &args, Common::Array<T> &argv);
template<class T> void SplitString(const T &args, char sep, Std::vector<T> &argv);
template<class T> void SplitStringKV(const T &args, char sep,
Std::vector<Common::Pair<T, T> > &argv);
} // End of namespace Ultima8
} // End of namespace Ultima
#endif