PRINCE: Code clean-up
This commit is contained in:
parent
b3589c76da
commit
3c29d61f67
41 changed files with 394 additions and 600 deletions
|
@ -192,5 +192,3 @@ Graphics::Surface *Animation::getFrame(int frameIndex) {
|
|||
}
|
||||
|
||||
} // End of namespace Prince
|
||||
|
||||
/* vim: set tabstop=4 noexpandtab: */
|
||||
|
|
|
@ -73,8 +73,6 @@ private:
|
|||
int16 _baseY;
|
||||
};
|
||||
|
||||
}
|
||||
} // End of namespace Prince
|
||||
|
||||
#endif
|
||||
|
||||
/* vim: set tabstop=4 noexpandtab: */
|
||||
|
|
|
@ -60,7 +60,7 @@ bool PtcArchive::open(const Common::String &filename) {
|
|||
|
||||
_stream->seek(fileTableOffset);
|
||||
|
||||
byte *fileTable = new byte[fileTableSize];
|
||||
byte *fileTable = (byte *)malloc(fileTableSize);
|
||||
byte *fileTableEnd = fileTable + fileTableSize;
|
||||
_stream->read(fileTable, fileTableSize);
|
||||
decrypt(fileTable, fileTableSize);
|
||||
|
@ -74,7 +74,7 @@ bool PtcArchive::open(const Common::String &filename) {
|
|||
_items[name] = item;
|
||||
}
|
||||
|
||||
delete[] fileTable;
|
||||
free(fileTable);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -141,6 +141,4 @@ Common::SeekableReadStream *PtcArchive::createReadStreamForMember(const Common::
|
|||
return new Common::MemoryReadStream(buffer, size, DisposeAfterUse::YES);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* vim: set tabstop=4 noexpandtab: */
|
||||
} // End of namespace Prince
|
||||
|
|
|
@ -59,5 +59,3 @@ private:
|
|||
} // End of namespace Prince
|
||||
|
||||
#endif
|
||||
|
||||
/* vim: set tabstop=4 noexpandtab: */
|
||||
|
|
|
@ -26,22 +26,20 @@
|
|||
namespace Prince {
|
||||
|
||||
enum Direction {
|
||||
kDirLD = 0,
|
||||
kDirL = 1,
|
||||
kDirLU = 2,
|
||||
kDirRD = 3,
|
||||
kDirR = 4,
|
||||
kDirRU = 5,
|
||||
kDirUL = 6,
|
||||
kDirU = 7,
|
||||
kDirUR = 8,
|
||||
kDirDL = 9,
|
||||
kDirD = 10,
|
||||
kDirDR = 11
|
||||
kDirLD,
|
||||
kDirL,
|
||||
kDirLU,
|
||||
kDirRD,
|
||||
kDirR,
|
||||
kDirRU,
|
||||
kDirUL,
|
||||
kDirU,
|
||||
kDirUR,
|
||||
kDirDL,
|
||||
kDirD,
|
||||
kDirDR
|
||||
};
|
||||
|
||||
}
|
||||
} // End of namespace Prince
|
||||
|
||||
#endif
|
||||
|
||||
/* vim: set tabstop=4 noexpandtab: */
|
||||
|
|
|
@ -23,32 +23,32 @@
|
|||
#include "prince/cursor.h"
|
||||
|
||||
#include "common/debug.h"
|
||||
#include "common/stream.h"
|
||||
|
||||
namespace Prince {
|
||||
|
||||
Cursor::Cursor() : _surface(NULL) {
|
||||
Cursor::Cursor() : _surface(nullptr) {
|
||||
}
|
||||
|
||||
Cursor::~Cursor() {
|
||||
if (_surface != nullptr) {
|
||||
_surface->free();
|
||||
delete _surface;
|
||||
_surface = NULL;
|
||||
_surface = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
bool Cursor::loadFromStream(Common::SeekableReadStream &stream) {
|
||||
stream.skip(4);
|
||||
uint16 w = stream.readUint16LE();
|
||||
uint16 h = stream.readUint16LE();
|
||||
uint16 width = stream.readUint16LE();
|
||||
uint16 heigth = stream.readUint16LE();
|
||||
|
||||
_surface = new Graphics::Surface();
|
||||
_surface->create(w, h, Graphics::PixelFormat::createFormatCLUT8());
|
||||
_surface->create(width, heigth, Graphics::PixelFormat::createFormatCLUT8());
|
||||
|
||||
for (int ih = 0; ih < h; ++ih)
|
||||
stream.read(_surface->getBasePtr(0, ih), w);
|
||||
for (int h = 0; h < heigth; h++) {
|
||||
stream.read(_surface->getBasePtr(0, h), width);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* vim: set tabstop=4 noexpandtab: */
|
||||
} // End of namespace Prince
|
||||
|
|
|
@ -25,9 +25,7 @@
|
|||
|
||||
#include "graphics/surface.h"
|
||||
|
||||
namespace Common {
|
||||
class SeekableReadStream;
|
||||
}
|
||||
#include "common/stream.h"
|
||||
|
||||
namespace Prince {
|
||||
|
||||
|
@ -43,8 +41,6 @@ private:
|
|||
Graphics::Surface *_surface;
|
||||
};
|
||||
|
||||
}
|
||||
} // End of namespace Prince
|
||||
|
||||
#endif
|
||||
|
||||
/* vim: set tabstop=4 expandtab!: */
|
||||
|
|
|
@ -171,6 +171,4 @@ bool Debugger::Cmd_AddItem(int argc, const char **argv) {
|
|||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* vim: set tabstop=4 noexpandtab: */
|
||||
} // End of namespace Prince
|
||||
|
|
|
@ -53,8 +53,6 @@ private:
|
|||
InterpreterFlags *_flags;
|
||||
};
|
||||
|
||||
}
|
||||
} // End of namespace Prince
|
||||
|
||||
#endif
|
||||
|
||||
/* vim: set tabstop=4 noexpandtab: */
|
||||
|
|
|
@ -71,5 +71,3 @@ REGISTER_PLUGIN_DYNAMIC(PRINCE, PLUGIN_TYPE_ENGINE, Prince::PrinceMetaEngine);
|
|||
#else
|
||||
REGISTER_PLUGIN_STATIC(PRINCE, PLUGIN_TYPE_ENGINE, Prince::PrinceMetaEngine);
|
||||
#endif
|
||||
|
||||
/* vim: set tabstop=4 noexpandtab: */
|
||||
|
|
|
@ -24,8 +24,7 @@
|
|||
|
||||
namespace Prince {
|
||||
|
||||
const char *Flags::getFlagName(uint16 flagId)
|
||||
{
|
||||
const char *Flags::getFlagName(uint16 flagId) {
|
||||
switch (flagId) {
|
||||
default: return "unknown_flag";
|
||||
case FLAGA1: return "FLAGA1";
|
||||
|
@ -401,6 +400,4 @@ const char *Flags::getFlagName(uint16 flagId)
|
|||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* vim: set tabstop=4 noexpandtab: */
|
||||
} // End of namespace Prince
|
||||
|
|
|
@ -410,7 +410,6 @@ struct Flags {
|
|||
};
|
||||
};
|
||||
|
||||
}
|
||||
#endif
|
||||
/* vim: set tabstop=4 noexpandtab: */
|
||||
} // End of namespace Prince
|
||||
|
||||
#endif
|
||||
|
|
|
@ -23,24 +23,25 @@
|
|||
#include "common/archive.h"
|
||||
#include "common/debug.h"
|
||||
#include "common/stream.h"
|
||||
#include "common/str.h"
|
||||
|
||||
#include "graphics/surface.h"
|
||||
|
||||
#include "prince/font.h"
|
||||
|
||||
namespace Prince {
|
||||
|
||||
Font::Font() {
|
||||
Font::Font() : _fontData(nullptr) {
|
||||
}
|
||||
|
||||
Font::~Font() {
|
||||
delete [] _fontData;
|
||||
if (_fontData != nullptr) {
|
||||
free(_fontData);
|
||||
_fontData = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
bool Font::loadFromStream(Common::SeekableReadStream &stream) {
|
||||
stream.seek(0);
|
||||
_fontData = new byte[stream.size()];
|
||||
uint32 dataSize = stream.size();
|
||||
_fontData = (byte *)malloc(dataSize);
|
||||
stream.read(_fontData, stream.size());
|
||||
return true;
|
||||
}
|
||||
|
@ -72,8 +73,8 @@ int Font::getCharWidth(uint32 chr) const {
|
|||
void Font::drawChar(Graphics::Surface *dst, uint32 chr, int posX, int posY, uint32 color) const {
|
||||
const ChrData chrData = getChrData(chr);
|
||||
|
||||
for (int y = 0; y < chrData._height; ++y) {
|
||||
for (int x = 0; x < chrData._width; ++x) {
|
||||
for (int y = 0; y < chrData._height; y++) {
|
||||
for (int x = 0; x < chrData._width; x++) {
|
||||
byte d = chrData._pixels[x + (chrData._width * y)];
|
||||
if (d == 0) d = 255;
|
||||
else if (d == 1) d = 0;
|
||||
|
@ -86,6 +87,4 @@ void Font::drawChar(Graphics::Surface *dst, uint32 chr, int posX, int posY, uint
|
|||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* vim: set tabstop=4 expandtab!: */
|
||||
} // End of namespace Prince
|
||||
|
|
|
@ -23,14 +23,9 @@
|
|||
#define PRINCE_FONT_H
|
||||
|
||||
#include "graphics/font.h"
|
||||
#include "graphics/surface.h"
|
||||
|
||||
namespace Graphics {
|
||||
struct Surface;
|
||||
}
|
||||
|
||||
namespace Common {
|
||||
class String;
|
||||
}
|
||||
#include "common/str.h"
|
||||
|
||||
namespace Prince {
|
||||
|
||||
|
@ -63,8 +58,6 @@ private:
|
|||
byte *_fontData;
|
||||
};
|
||||
|
||||
}
|
||||
} // End of namespace Prince
|
||||
|
||||
#endif
|
||||
|
||||
/* vim: set tabstop=4 expandtab!: */
|
||||
|
|
|
@ -21,9 +21,7 @@
|
|||
*/
|
||||
|
||||
#include "prince/graphics.h"
|
||||
|
||||
#include "prince/prince.h"
|
||||
|
||||
#include "prince/mhwanh.h"
|
||||
|
||||
#include "graphics/palette.h"
|
||||
|
@ -32,28 +30,34 @@
|
|||
|
||||
namespace Prince {
|
||||
|
||||
GraphicsMan::GraphicsMan(PrinceEngine *vm)
|
||||
: _vm(vm), _changed(false) {
|
||||
GraphicsMan::GraphicsMan(PrinceEngine *vm) : _vm(vm), _changed(false) {
|
||||
initGraphics(640, 480, true);
|
||||
|
||||
_frontScreen = new Graphics::Surface();
|
||||
_frontScreen->create(640, 480, Graphics::PixelFormat::createFormatCLUT8());
|
||||
|
||||
_screenForInventory = new Graphics::Surface();
|
||||
_screenForInventory->create(640, 480, Graphics::PixelFormat::createFormatCLUT8());
|
||||
|
||||
_mapScreen = new Graphics::Surface();
|
||||
_mapScreen->create(640, 480, Graphics::PixelFormat::createFormatCLUT8());
|
||||
_shadowTable70 = new byte[256];
|
||||
_shadowTable50 = new byte[256];
|
||||
|
||||
_shadowTable70 = (byte *)malloc(256);
|
||||
_shadowTable50 = (byte *)malloc(256);
|
||||
}
|
||||
|
||||
GraphicsMan::~GraphicsMan() {
|
||||
_frontScreen->free();
|
||||
delete _frontScreen;
|
||||
|
||||
_screenForInventory->free();
|
||||
delete _screenForInventory;
|
||||
|
||||
_mapScreen->free();
|
||||
delete _mapScreen;
|
||||
delete[] _shadowTable70;
|
||||
delete[] _shadowTable50;
|
||||
|
||||
free(_shadowTable70);
|
||||
free(_shadowTable50);
|
||||
}
|
||||
|
||||
void GraphicsMan::update(Graphics::Surface *screen) {
|
||||
|
@ -382,5 +386,3 @@ void GraphicsMan::makeShadowTable(int brightness, byte *shadowPalette) {
|
|||
}
|
||||
|
||||
} // End of namespace Prince
|
||||
|
||||
/* vim: set tabstop=4 noexpandtab: */
|
||||
|
|
|
@ -28,8 +28,8 @@
|
|||
namespace Prince {
|
||||
|
||||
class PrinceEngine;
|
||||
struct DrawNode;
|
||||
class MhwanhDecoder;
|
||||
struct DrawNode;
|
||||
|
||||
class GraphicsMan {
|
||||
public:
|
||||
|
@ -68,12 +68,10 @@ public:
|
|||
void drawPixel(Graphics::Surface *screen, int32 posX, int32 posY);
|
||||
|
||||
private:
|
||||
|
||||
PrinceEngine *_vm;
|
||||
|
||||
bool _changed;
|
||||
};
|
||||
|
||||
}
|
||||
} // End of namespace Prince
|
||||
|
||||
#endif
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "common/debug.h"
|
||||
#include "common/random.h"
|
||||
|
||||
|
@ -33,21 +34,24 @@
|
|||
|
||||
namespace Prince {
|
||||
|
||||
Hero::Hero(PrinceEngine *vm, GraphicsMan *graph) : _vm(vm), _graph(graph)
|
||||
, _number(0), _visible(false), _state(kHeroStateStay), _middleX(0), _middleY(0)
|
||||
, _boreNum(1), _currHeight(0), _moveDelay(0), _shadMinus(0), _moveSetType(0), _zoomedHeroSurface(nullptr)
|
||||
, _lastDirection(kHeroDirDown), _destDirection(kHeroDirDown), _talkTime(0), _boredomTime(0), _phase(0)
|
||||
, _specAnim(nullptr), _drawX(0), _drawY(0), _drawZ(0), _zoomFactor(0), _scaleValue(0)
|
||||
, _shadZoomFactor(0), _shadScaleValue(0), _shadLineLen(0), _shadDrawX(0), _shadDrawY(0)
|
||||
, _frameXSize(0), _frameYSize(0), _scaledFrameXSize(0), _scaledFrameYSize(0), _color(0)
|
||||
, _coords(nullptr), _dirTab(nullptr), _currCoords(nullptr), _currDirTab(nullptr), _step(0)
|
||||
, _maxBoredom(200), _turnAnim(0), _leftRightMainDir(0), _upDownMainDir(0), _animSetNr(0)
|
||||
Hero::Hero(PrinceEngine *vm, GraphicsMan *graph) : _vm(vm), _graph(graph),
|
||||
_number(0), _visible(false), _state(kHeroStateStay), _middleX(0), _middleY(0),
|
||||
_boreNum(1), _currHeight(0), _moveDelay(0), _shadMinus(0), _moveSetType(0), _zoomedHeroSurface(nullptr),
|
||||
_lastDirection(kHeroDirDown), _destDirection(kHeroDirDown), _talkTime(0), _boredomTime(0), _phase(0),
|
||||
_specAnim(nullptr), _drawX(0), _drawY(0), _drawZ(0), _zoomFactor(0), _scaleValue(0),
|
||||
_shadZoomFactor(0), _shadScaleValue(0), _shadLineLen(0), _shadDrawX(0), _shadDrawY(0),
|
||||
_frameXSize(0), _frameYSize(0), _scaledFrameXSize(0), _scaledFrameYSize(0), _color(0),
|
||||
_coords(nullptr), _dirTab(nullptr), _currCoords(nullptr), _currDirTab(nullptr), _step(0),
|
||||
_maxBoredom(200), _turnAnim(0), _leftRightMainDir(0), _upDownMainDir(0), _animSetNr(0)
|
||||
{
|
||||
_shadowLine = new byte[kShadowLineArraySize];
|
||||
_shadowLine = (byte *)malloc(kShadowLineArraySize);
|
||||
}
|
||||
|
||||
Hero::~Hero() {
|
||||
delete[] _shadowLine;
|
||||
if (_shadowLine != nullptr) {
|
||||
free(_shadowLine);
|
||||
_shadowLine = nullptr;
|
||||
}
|
||||
freeHeroAnim();
|
||||
freeOldMove();
|
||||
freeZoomedSurface();
|
||||
|
@ -477,7 +481,7 @@ void Hero::showHeroShadow(Graphics::Surface *heroFrame) {
|
|||
}
|
||||
}
|
||||
//krap2
|
||||
shadWallDestAddr -= kScreenWidth;
|
||||
shadWallDestAddr -= _vm->kNormalWidth;
|
||||
shadWallBitAddr -= _vm->kMaxPicWidth / 8;
|
||||
shadWallPosY--;
|
||||
}
|
||||
|
@ -1027,6 +1031,4 @@ void Hero::freeZoomedSurface() {
|
|||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* vim: set tabstop=4 noexpandtab: */
|
||||
} // End of namespace Prince
|
||||
|
|
|
@ -41,7 +41,6 @@ class Hero {
|
|||
public:
|
||||
static const uint32 kMoveSetSize = 26;
|
||||
static const int16 kShadowLineArraySize = 2 * 1280 * 4;
|
||||
static const int16 kScreenWidth = 640;
|
||||
static const int16 kStepLeftRight = 8;
|
||||
static const int16 kStepUpDown = 4;
|
||||
|
||||
|
@ -189,8 +188,6 @@ public:
|
|||
uint32 _shadMinus;
|
||||
};
|
||||
|
||||
}
|
||||
} // End of namespace Prince
|
||||
|
||||
#endif
|
||||
|
||||
/* vim: set tabstop=4 noexpandtab: */
|
||||
|
|
|
@ -1,243 +0,0 @@
|
|||
|
||||
/* 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 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
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "prince/hero_set.h"
|
||||
#include "common/scummsys.h"
|
||||
|
||||
namespace Prince {
|
||||
|
||||
static HeroSetAnimNames heroSet5 = {
|
||||
"SL_DIAB.ANI",
|
||||
"SR_DIAB.ANI",
|
||||
"SU_DIAB.ANI",
|
||||
"SD_DIAB.ANI",
|
||||
NULL,
|
||||
NULL,
|
||||
"MU_DIAB.ANI",
|
||||
"MD_DIAB.ANI",
|
||||
"TL_DIAB.ANI",
|
||||
"TR_DIAB.ANI",
|
||||
"TU_DIAB.ANI",
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
static HeroSetAnimNames heroSet1 = {
|
||||
"SL_HERO1.ANI",
|
||||
"SR_HERO1.ANI",
|
||||
"SU_HERO1.ANI",
|
||||
"SD_HERO1.ANI",
|
||||
"ML_HERO1.ANI",
|
||||
"MR_HERO1.ANI",
|
||||
"MU_HERO1.ANI",
|
||||
"MD_HERO1.ANI",
|
||||
"TL_HERO1.ANI",
|
||||
"TR_HERO1.ANI",
|
||||
"TU_HERO1.ANI",
|
||||
"TD_HERO1.ANI",
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
"KSI_KURZ.ANI",
|
||||
"KS_WLOSY.ANI"
|
||||
};
|
||||
|
||||
static HeroSetAnimNames heroSet2 = {
|
||||
"SL_HERO2.ANI",
|
||||
"SR_HERO2.ANI",
|
||||
"SU_HERO2.ANI",
|
||||
"SD_HERO2.ANI",
|
||||
"ML_HERO2.ANI",
|
||||
"MR_HERO2.ANI",
|
||||
"MU_HERO2.ANI",
|
||||
"MD_HERO2.ANI",
|
||||
"TL_HERO2.ANI",
|
||||
"TR_HERO2.ANI",
|
||||
"TU_HERO2.ANI",
|
||||
"TD_HERO2.ANI",
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
"KSI_KU_S.ANI",
|
||||
"KS_WLO_S.ANI"
|
||||
};
|
||||
|
||||
static HeroSetAnimNames heroSet3 = {
|
||||
"SL_BEAR.ANI",
|
||||
"SR_BEAR.ANI",
|
||||
"SU_BEAR.ANI",
|
||||
"SD_BEAR.ANI",
|
||||
"NIED-LEW.ANI",
|
||||
"NIED-PRW.ANI",
|
||||
"NIED-TYL.ANI",
|
||||
"NIED-PRZ.ANI",
|
||||
"SL_BEAR.ANI",
|
||||
"SR_BEAR.ANI",
|
||||
"SU_BEAR.ANI",
|
||||
"SD_BEAR.ANI",
|
||||
"N_LW-TYL.ANI",
|
||||
"N_LW-PRZ.ANI",
|
||||
"N_LW-PR.ANI",
|
||||
"N_PR-TYL.ANI",
|
||||
"N_PR-PRZ.ANI",
|
||||
"N_PR-LW.ANI",
|
||||
"N_TYL-LW.ANI",
|
||||
"N_TYL-PR.ANI",
|
||||
"N_TL-PRZ.ANI",
|
||||
"N_PRZ-LW.ANI",
|
||||
"N_PRZ-PR.ANI",
|
||||
"N_PRZ-TL.ANI",
|
||||
NULL,
|
||||
NULL,
|
||||
};
|
||||
|
||||
static HeroSetAnimNames shanSet1 = {
|
||||
"SL_SHAN.ANI",
|
||||
"SR_SHAN.ANI",
|
||||
"SU_SHAN.ANI",
|
||||
"SD_SHAN.ANI",
|
||||
"ML_SHAN.ANI",
|
||||
"MR_SHAN.ANI",
|
||||
"MU_SHAN.ANI",
|
||||
"MD_SHAN.ANI",
|
||||
"TL_SHAN.ANI",
|
||||
"TR_SHAN.ANI",
|
||||
"TU_SHAN.ANI",
|
||||
"TD_SHAN.ANI",
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
"B1_SHAN.ANI",
|
||||
"B2_SHAN.ANI",
|
||||
};
|
||||
|
||||
static HeroSetAnimNames shanSet2 = {
|
||||
"SL_SHAN2.ANI",
|
||||
"SR_SHAN2.ANI",
|
||||
"SU_SHAN.ANI",
|
||||
"SD_SHAN2.ANI",
|
||||
"ML_SHAN2.ANI",
|
||||
"MR_SHAN2.ANI",
|
||||
"MU_SHAN.ANI",
|
||||
"MD_SHAN2.ANI",
|
||||
"TL_SHAN2.ANI",
|
||||
"TR_SHAN2.ANI",
|
||||
"TU_SHAN.ANI",
|
||||
"TD_SHAN2.ANI",
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
"B1_SHAN2.ANI",
|
||||
"B2_SHAN2.ANI"
|
||||
};
|
||||
|
||||
static HeroSetAnimNames arivSet1 = {
|
||||
"SL_ARIV.ANI",
|
||||
"SR_ARIV.ANI",
|
||||
"SU_ARIV.ANI",
|
||||
"SD_ARIV.ANI",
|
||||
"ML_ARIV.ANI",
|
||||
"MR_ARIV.ANI",
|
||||
"MU_ARIV.ANI",
|
||||
"MD_ARIV.ANI",
|
||||
"TL_ARIV.ANI",
|
||||
"TR_ARIV.ANI",
|
||||
"TU_ARIV.ANI",
|
||||
"TD_ARIV.ANI",
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
const HeroSetAnimNames *heroSetTable[7] = {
|
||||
&heroSet1,
|
||||
&heroSet2,
|
||||
&heroSet3,
|
||||
&shanSet1,
|
||||
&arivSet1,
|
||||
&heroSet5,
|
||||
&shanSet2,
|
||||
};
|
||||
|
||||
}
|
||||
/* vim: set tabstop=4 noexpandtab: */
|
|
@ -20,12 +20,225 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include "common/scummsys.h"
|
||||
|
||||
namespace Prince {
|
||||
|
||||
const int heroSetBack[7] = { 0, 0, 10, 0, 6, 0, 0 };
|
||||
|
||||
typedef const char *HeroSetAnimNames[26];
|
||||
|
||||
const int heroSetBack[7] = { 0, 0, 10, 0, 6, 0, 0 };
|
||||
extern const HeroSetAnimNames *heroSetTable[7];
|
||||
static HeroSetAnimNames heroSet5 = {
|
||||
"SL_DIAB.ANI",
|
||||
"SR_DIAB.ANI",
|
||||
"SU_DIAB.ANI",
|
||||
"SD_DIAB.ANI",
|
||||
NULL,
|
||||
NULL,
|
||||
"MU_DIAB.ANI",
|
||||
"MD_DIAB.ANI",
|
||||
"TL_DIAB.ANI",
|
||||
"TR_DIAB.ANI",
|
||||
"TU_DIAB.ANI",
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
}
|
||||
/* vim: set tabstop=4 noexpandtab: */
|
||||
static HeroSetAnimNames heroSet1 = {
|
||||
"SL_HERO1.ANI",
|
||||
"SR_HERO1.ANI",
|
||||
"SU_HERO1.ANI",
|
||||
"SD_HERO1.ANI",
|
||||
"ML_HERO1.ANI",
|
||||
"MR_HERO1.ANI",
|
||||
"MU_HERO1.ANI",
|
||||
"MD_HERO1.ANI",
|
||||
"TL_HERO1.ANI",
|
||||
"TR_HERO1.ANI",
|
||||
"TU_HERO1.ANI",
|
||||
"TD_HERO1.ANI",
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
"KSI_KURZ.ANI",
|
||||
"KS_WLOSY.ANI"
|
||||
};
|
||||
|
||||
static HeroSetAnimNames heroSet2 = {
|
||||
"SL_HERO2.ANI",
|
||||
"SR_HERO2.ANI",
|
||||
"SU_HERO2.ANI",
|
||||
"SD_HERO2.ANI",
|
||||
"ML_HERO2.ANI",
|
||||
"MR_HERO2.ANI",
|
||||
"MU_HERO2.ANI",
|
||||
"MD_HERO2.ANI",
|
||||
"TL_HERO2.ANI",
|
||||
"TR_HERO2.ANI",
|
||||
"TU_HERO2.ANI",
|
||||
"TD_HERO2.ANI",
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
"KSI_KU_S.ANI",
|
||||
"KS_WLO_S.ANI"
|
||||
};
|
||||
|
||||
static HeroSetAnimNames heroSet3 = {
|
||||
"SL_BEAR.ANI",
|
||||
"SR_BEAR.ANI",
|
||||
"SU_BEAR.ANI",
|
||||
"SD_BEAR.ANI",
|
||||
"NIED-LEW.ANI",
|
||||
"NIED-PRW.ANI",
|
||||
"NIED-TYL.ANI",
|
||||
"NIED-PRZ.ANI",
|
||||
"SL_BEAR.ANI",
|
||||
"SR_BEAR.ANI",
|
||||
"SU_BEAR.ANI",
|
||||
"SD_BEAR.ANI",
|
||||
"N_LW-TYL.ANI",
|
||||
"N_LW-PRZ.ANI",
|
||||
"N_LW-PR.ANI",
|
||||
"N_PR-TYL.ANI",
|
||||
"N_PR-PRZ.ANI",
|
||||
"N_PR-LW.ANI",
|
||||
"N_TYL-LW.ANI",
|
||||
"N_TYL-PR.ANI",
|
||||
"N_TL-PRZ.ANI",
|
||||
"N_PRZ-LW.ANI",
|
||||
"N_PRZ-PR.ANI",
|
||||
"N_PRZ-TL.ANI",
|
||||
NULL,
|
||||
NULL,
|
||||
};
|
||||
|
||||
static HeroSetAnimNames shanSet1 = {
|
||||
"SL_SHAN.ANI",
|
||||
"SR_SHAN.ANI",
|
||||
"SU_SHAN.ANI",
|
||||
"SD_SHAN.ANI",
|
||||
"ML_SHAN.ANI",
|
||||
"MR_SHAN.ANI",
|
||||
"MU_SHAN.ANI",
|
||||
"MD_SHAN.ANI",
|
||||
"TL_SHAN.ANI",
|
||||
"TR_SHAN.ANI",
|
||||
"TU_SHAN.ANI",
|
||||
"TD_SHAN.ANI",
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
"B1_SHAN.ANI",
|
||||
"B2_SHAN.ANI",
|
||||
};
|
||||
|
||||
static HeroSetAnimNames shanSet2 = {
|
||||
"SL_SHAN2.ANI",
|
||||
"SR_SHAN2.ANI",
|
||||
"SU_SHAN.ANI",
|
||||
"SD_SHAN2.ANI",
|
||||
"ML_SHAN2.ANI",
|
||||
"MR_SHAN2.ANI",
|
||||
"MU_SHAN.ANI",
|
||||
"MD_SHAN2.ANI",
|
||||
"TL_SHAN2.ANI",
|
||||
"TR_SHAN2.ANI",
|
||||
"TU_SHAN.ANI",
|
||||
"TD_SHAN2.ANI",
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
"B1_SHAN2.ANI",
|
||||
"B2_SHAN2.ANI"
|
||||
};
|
||||
|
||||
static HeroSetAnimNames arivSet1 = {
|
||||
"SL_ARIV.ANI",
|
||||
"SR_ARIV.ANI",
|
||||
"SU_ARIV.ANI",
|
||||
"SD_ARIV.ANI",
|
||||
"ML_ARIV.ANI",
|
||||
"MR_ARIV.ANI",
|
||||
"MU_ARIV.ANI",
|
||||
"MD_ARIV.ANI",
|
||||
"TL_ARIV.ANI",
|
||||
"TR_ARIV.ANI",
|
||||
"TU_ARIV.ANI",
|
||||
"TD_ARIV.ANI",
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
const HeroSetAnimNames *heroSetTable[7] = {
|
||||
&heroSet1,
|
||||
&heroSet2,
|
||||
&heroSet3,
|
||||
&shanSet1,
|
||||
&arivSet1,
|
||||
&heroSet5,
|
||||
&shanSet2,
|
||||
};
|
||||
|
||||
} // End of namespace Prince
|
||||
|
|
|
@ -28,8 +28,7 @@
|
|||
|
||||
namespace Prince {
|
||||
|
||||
MhwanhDecoder::MhwanhDecoder()
|
||||
: _surface(NULL), _palette(0), _paletteColorCount(0) {
|
||||
MhwanhDecoder::MhwanhDecoder() : _surface(nullptr), _palette(nullptr) {
|
||||
}
|
||||
|
||||
MhwanhDecoder::~MhwanhDecoder() {
|
||||
|
@ -37,38 +36,36 @@ MhwanhDecoder::~MhwanhDecoder() {
|
|||
}
|
||||
|
||||
void MhwanhDecoder::destroy() {
|
||||
if (_surface) {
|
||||
if (_surface != nullptr) {
|
||||
_surface->free();
|
||||
delete _surface;
|
||||
_surface = 0;
|
||||
_surface = nullptr;
|
||||
}
|
||||
if (_palette != nullptr) {
|
||||
free(_palette);
|
||||
_palette = nullptr;
|
||||
}
|
||||
|
||||
delete [] _palette; _palette = 0;
|
||||
_paletteColorCount = 0;
|
||||
}
|
||||
|
||||
bool MhwanhDecoder::loadStream(Common::SeekableReadStream &stream) {
|
||||
destroy();
|
||||
_paletteColorCount = 256;
|
||||
stream.seek(0);
|
||||
stream.skip(0x20);
|
||||
// Read the palette
|
||||
_palette = new byte[_paletteColorCount * 3];
|
||||
for (uint16 i = 0; i < _paletteColorCount; i++) {
|
||||
_palette[i * 3 + 0] = stream.readByte();
|
||||
_palette = (byte *)malloc(kPaletteColorCount * 3);
|
||||
for (uint16 i = 0; i < kPaletteColorCount; i++) {
|
||||
_palette[i * 3] = stream.readByte();
|
||||
_palette[i * 3 + 1] = stream.readByte();
|
||||
_palette[i * 3 + 2] = stream.readByte();
|
||||
}
|
||||
|
||||
_surface = new Graphics::Surface();
|
||||
_surface->create(640, 480, Graphics::PixelFormat::createFormatCLUT8());
|
||||
for (int h = 0; h < 480; ++h) {
|
||||
for (int h = 0; h < 480; h++) {
|
||||
stream.read(_surface->getBasePtr(0, h), 640);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* vim: set tabstop=4 noexpandtab: */
|
||||
} // End of namespace Prince
|
||||
|
|
|
@ -25,7 +25,9 @@
|
|||
|
||||
#include "image/image_decoder.h"
|
||||
#include "image/bmp.h"
|
||||
|
||||
#include "graphics/surface.h"
|
||||
|
||||
#include "resource.h"
|
||||
|
||||
namespace Prince {
|
||||
|
@ -40,12 +42,12 @@ public:
|
|||
virtual bool loadStream(Common::SeekableReadStream &stream);
|
||||
virtual Graphics::Surface *getSurface() const { return _surface; }
|
||||
virtual const byte *getPalette() const { return _palette; }
|
||||
uint16 getPaletteCount() const { return _paletteColorCount; }
|
||||
uint16 getPaletteCount() const { return kPaletteColorCount; }
|
||||
static const uint16 kPaletteColorCount = 256;
|
||||
|
||||
private:
|
||||
Graphics::Surface *_surface;
|
||||
byte *_palette;
|
||||
uint16 _paletteColorCount;
|
||||
};
|
||||
|
||||
namespace Resource {
|
||||
|
@ -60,8 +62,6 @@ namespace Resource {
|
|||
}
|
||||
}
|
||||
|
||||
}
|
||||
} // End of namespace Prince
|
||||
|
||||
#endif
|
||||
|
||||
/* vim: set tabstop=4 noexpandtab: */
|
||||
|
|
|
@ -22,8 +22,6 @@
|
|||
|
||||
#include "prince/mob.h"
|
||||
|
||||
#include "common/stream.h"
|
||||
|
||||
namespace Prince {
|
||||
|
||||
bool Mob::loadFromStream(Common::SeekableReadStream &stream) {
|
||||
|
@ -107,6 +105,4 @@ uint16 Mob::getData(AttrId dataId) {
|
|||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* vim: set tabstop=4 noexpandtab: */
|
||||
} // End of namespace Prince
|
||||
|
|
|
@ -26,13 +26,10 @@
|
|||
#include "common/scummsys.h"
|
||||
#include "common/rect.h"
|
||||
#include "common/str.h"
|
||||
#include "common/stream.h"
|
||||
|
||||
#include "prince/common.h"
|
||||
|
||||
namespace Common {
|
||||
class SeekableReadStream;
|
||||
}
|
||||
|
||||
namespace Prince {
|
||||
|
||||
class Mob {
|
||||
|
@ -79,8 +76,6 @@ public:
|
|||
Common::String _examText;
|
||||
};
|
||||
|
||||
}
|
||||
} // End of namespace Prince
|
||||
|
||||
#endif
|
||||
|
||||
/* vim: set tabstop=4 noexpandtab: */
|
||||
|
|
|
@ -17,7 +17,6 @@ MODULE_OBJS = \
|
|||
archive.o \
|
||||
decompress.o \
|
||||
hero.o \
|
||||
hero_set.o \
|
||||
cursor.o \
|
||||
pscr.o \
|
||||
saveload.o
|
||||
|
|
|
@ -84,4 +84,4 @@ enum RoomMus {
|
|||
ROOM61MUS = 0
|
||||
};
|
||||
|
||||
}
|
||||
} // End of namespace Prince
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
#include "common/debug.h"
|
||||
#include "common/stream.h"
|
||||
|
||||
|
||||
#include "graphics/surface.h"
|
||||
|
||||
#include "prince/object.h"
|
||||
|
@ -65,8 +64,9 @@ void Object::loadSurface(Common::SeekableReadStream &stream) {
|
|||
bool Object::loadFromStream(Common::SeekableReadStream &stream) {
|
||||
int32 pos = stream.pos();
|
||||
uint16 x = stream.readUint16LE();
|
||||
if (x == 0xFFFF)
|
||||
if (x == 0xFFFF) {
|
||||
return false;
|
||||
}
|
||||
_x = x;
|
||||
_y = stream.readSint16LE(); // skull mini-game has some signed y coords
|
||||
|
||||
|
@ -82,8 +82,6 @@ bool Object::loadFromStream(Common::SeekableReadStream &stream) {
|
|||
|
||||
stream.seek(pos + 16);
|
||||
|
||||
//debug("Object x %d, y %d, z %d overlay %d", _x, _y, _z, _mask);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -112,5 +110,4 @@ int32 Object::getData(AttrId dataId) {
|
|||
}
|
||||
}
|
||||
|
||||
}
|
||||
/* vim: set tabstop=4 noexpandtab: */
|
||||
} // End of namespace Prince
|
||||
|
|
|
@ -65,7 +65,6 @@ private:
|
|||
Graphics::Surface *_surface;
|
||||
};
|
||||
|
||||
}
|
||||
} // End of namespace Prince
|
||||
|
||||
#endif
|
||||
/* vim: set tabstop=4 noexpandtab: */
|
||||
|
|
|
@ -82,5 +82,4 @@ const char *optionsTextEN[] = {
|
|||
"Talk to"
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
} // End of namespace Prince
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
*/
|
||||
|
||||
#include "common/scummsys.h"
|
||||
|
||||
#include "common/config-manager.h"
|
||||
#include "common/debug-channels.h"
|
||||
#include "common/debug.h"
|
||||
|
@ -77,8 +76,8 @@ void PrinceEngine::debugEngine(const char *s, ...) {
|
|||
|
||||
PrinceEngine::PrinceEngine(OSystem *syst, const PrinceGameDescription *gameDesc) :
|
||||
Engine(syst), _gameDescription(gameDesc), _graph(nullptr), _script(nullptr), _interpreter(nullptr), _flags(nullptr),
|
||||
_locationNr(0), _debugger(nullptr), _midiPlayer(nullptr), _room(nullptr), testAnimNr(0), testAnimFrame(0),
|
||||
_frameNr(0), _cursor1(nullptr), _cursor2(nullptr), _cursor3(nullptr), _font(nullptr),
|
||||
_locationNr(0), _debugger(nullptr), _midiPlayer(nullptr), _room(nullptr), _frameNr(0),
|
||||
_cursor1(nullptr), _cursor2(nullptr), _cursor3(nullptr), _font(nullptr),
|
||||
_suitcaseBmp(nullptr), _roomBmp(nullptr), _cursorNr(0), _picWindowX(0), _picWindowY(0), _randomSource("prince"),
|
||||
_invLineX(134), _invLineY(176), _invLine(5), _invLines(3), _invLineW(70), _invLineH(76), _maxInvW(72), _maxInvH(76),
|
||||
_invLineSkipX(2), _invLineSkipY(3), _showInventoryFlag(false), _inventoryBackgroundRemember(false),
|
||||
|
@ -121,9 +120,9 @@ PrinceEngine::~PrinceEngine() {
|
|||
delete _roomBmp;
|
||||
delete _suitcaseBmp;
|
||||
delete _variaTxt;
|
||||
delete[] _talkTxt;
|
||||
delete[] _invTxt;
|
||||
delete[] _dialogDat;
|
||||
free(_talkTxt);
|
||||
free(_invTxt);
|
||||
free(_dialogDat);
|
||||
delete _graph;
|
||||
delete _room;
|
||||
|
||||
|
@ -137,7 +136,7 @@ PrinceEngine::~PrinceEngine() {
|
|||
}
|
||||
_objList.clear();
|
||||
|
||||
delete[] _objSlot;
|
||||
free(_objSlot);
|
||||
|
||||
for (uint32 i = 0; i < _pscrList.size(); i++) {
|
||||
delete _pscrList[i];
|
||||
|
@ -258,7 +257,7 @@ void PrinceEngine::init() {
|
|||
return;
|
||||
}
|
||||
_talkTxtSize = talkTxtStream->size();
|
||||
_talkTxt = new byte[_talkTxtSize];
|
||||
_talkTxt = (byte *)malloc(_talkTxtSize);
|
||||
talkTxtStream->read(_talkTxt, _talkTxtSize);
|
||||
|
||||
delete talkTxtStream;
|
||||
|
@ -269,7 +268,7 @@ void PrinceEngine::init() {
|
|||
return;
|
||||
}
|
||||
_invTxtSize = invTxtStream->size();
|
||||
_invTxt = new byte[_invTxtSize];
|
||||
_invTxt = (byte *)malloc(_invTxtSize);
|
||||
invTxtStream->read(_invTxt, _invTxtSize);
|
||||
|
||||
delete invTxtStream;
|
||||
|
@ -282,7 +281,7 @@ void PrinceEngine::init() {
|
|||
return;
|
||||
}
|
||||
_dialogDatSize = dialogDatStream->size();
|
||||
_dialogDat = new byte[_dialogDatSize];
|
||||
_dialogDat = (byte *)malloc(_dialogDatSize);
|
||||
dialogDatStream->read(_dialogDat, _dialogDatSize);
|
||||
|
||||
delete dialogDatStream;
|
||||
|
@ -325,7 +324,7 @@ void PrinceEngine::init() {
|
|||
_normAnimList.push_back(tempAnim);
|
||||
}
|
||||
|
||||
_objSlot = new int[kMaxObjects];
|
||||
_objSlot = (uint16 *)malloc(kMaxObjects * sizeof(uint16));
|
||||
for (int i = 0; i < kMaxObjects; i++) {
|
||||
_objSlot[i] = 0xFF;
|
||||
}
|
||||
|
@ -551,10 +550,10 @@ void PrinceEngine::makeInvCursor(int itemNr) {
|
|||
byte *src1 = (byte *)itemSurface->getBasePtr(0, 0);
|
||||
byte *dst1 = (byte *)_cursor2->getBasePtr(cur1W, cur1H);
|
||||
|
||||
if (itemH % 2 != 0) {
|
||||
if (itemH % 2) {
|
||||
itemH--;
|
||||
}
|
||||
if (itemW % 2 != 0) {
|
||||
if (itemW % 2) {
|
||||
itemW--;
|
||||
}
|
||||
|
||||
|
@ -564,7 +563,7 @@ void PrinceEngine::makeInvCursor(int itemNr) {
|
|||
if (y % 2 == 0) {
|
||||
for (int x = 0; x < itemW; x++, src2++) {
|
||||
if (x % 2 == 0) {
|
||||
if (*src2 != 0) {
|
||||
if (*src2) {
|
||||
*dst2 = *src2;
|
||||
} else {
|
||||
*dst2 = 255;
|
||||
|
@ -880,81 +879,9 @@ void PrinceEngine::keyHandler(Common::Event event) {
|
|||
getDebugger()->attach();
|
||||
}
|
||||
break;
|
||||
case Common::KEYCODE_LEFT:
|
||||
if(testAnimNr > 0) {
|
||||
testAnimNr--;
|
||||
}
|
||||
debug("testAnimNr: %d", testAnimNr);
|
||||
break;
|
||||
case Common::KEYCODE_RIGHT:
|
||||
testAnimNr++;
|
||||
debug("testAnimNr: %d", testAnimNr);
|
||||
break;
|
||||
case Common::KEYCODE_ESCAPE:
|
||||
_flags->setFlagValue(Flags::ESCAPED2, 1);
|
||||
break;
|
||||
case Common::KEYCODE_UP:
|
||||
_mainHero->_phase++;
|
||||
debugEngine("%d", _mainHero->_phase);
|
||||
testAnimFrame++;
|
||||
break;
|
||||
case Common::KEYCODE_DOWN:
|
||||
if(_mainHero->_phase > 0) {
|
||||
_mainHero->_phase--;
|
||||
}
|
||||
if (testAnimFrame > 0) {
|
||||
testAnimFrame--;
|
||||
}
|
||||
debugEngine("%d", _mainHero->_phase);
|
||||
break;
|
||||
case Common::KEYCODE_w:
|
||||
_mainHero->_lastDirection = _mainHero->kHeroDirUp;
|
||||
debugEngine("UP");
|
||||
break;
|
||||
case Common::KEYCODE_s:
|
||||
_mainHero->_lastDirection = _mainHero->kHeroDirDown;
|
||||
debugEngine("DOWN");
|
||||
break;
|
||||
case Common::KEYCODE_a:
|
||||
_mainHero->_lastDirection = _mainHero->kHeroDirLeft;
|
||||
debugEngine("LEFT");
|
||||
break;
|
||||
case Common::KEYCODE_f:
|
||||
_mainHero->_lastDirection = _mainHero->kHeroDirRight;
|
||||
debugEngine("RIGHT");
|
||||
break;
|
||||
case Common::KEYCODE_1:
|
||||
if(_mainHero->_state > 0) {
|
||||
_mainHero->_state--;
|
||||
}
|
||||
debugEngine("%d", _mainHero->_state);
|
||||
break;
|
||||
case Common::KEYCODE_2:
|
||||
_mainHero->_state++;
|
||||
debugEngine("%d", _mainHero->_state);
|
||||
break;
|
||||
case Common::KEYCODE_i:
|
||||
_mainHero->_middleY -= 5;
|
||||
break;
|
||||
case Common::KEYCODE_k:
|
||||
_mainHero->_middleY += 5;
|
||||
break;
|
||||
case Common::KEYCODE_j:
|
||||
_mainHero->_middleX -= 5;
|
||||
break;
|
||||
case Common::KEYCODE_l:
|
||||
_mainHero->_middleX += 5;
|
||||
break;
|
||||
case Common::KEYCODE_EQUALS:
|
||||
if (_debugger->_locationNr > 1) {
|
||||
_debugger->_locationNr--;
|
||||
}
|
||||
break;
|
||||
case Common::KEYCODE_BACKSPACE:
|
||||
if (_debugger->_locationNr < 43) {
|
||||
_debugger->_locationNr++;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1144,10 +1071,11 @@ void PrinceEngine::printAt(uint32 slot, uint8 color, char *s, uint16 x, uint16 y
|
|||
text._x = x;
|
||||
text._y = y;
|
||||
text._color = color;
|
||||
text._time = calcText(s) * 30;
|
||||
int lines = calcTextLines(s);
|
||||
text._time = calcTextTime(lines);
|
||||
}
|
||||
|
||||
int PrinceEngine::calcText(const char *s) {
|
||||
int PrinceEngine::calcTextLines(const char *s) {
|
||||
int lines = 1;
|
||||
while (*s) {
|
||||
if (*s == '\n') {
|
||||
|
@ -1156,7 +1084,10 @@ int PrinceEngine::calcText(const char *s) {
|
|||
s++;
|
||||
}
|
||||
return lines;
|
||||
//time = lines * 30
|
||||
}
|
||||
|
||||
int PrinceEngine::calcTextTime(int numberOfLines) {
|
||||
return numberOfLines * 30;
|
||||
}
|
||||
|
||||
uint32 PrinceEngine::getTextWidth(const char *s) {
|
||||
|
@ -1742,7 +1673,7 @@ void PrinceEngine::showParallax() {
|
|||
if (pscrSurface != nullptr) {
|
||||
int x = _pscrList[i]->_x - (_pscrList[i]->_step * _picWindowX / 4);
|
||||
int y = _pscrList[i]->_y;
|
||||
int z = 1000;
|
||||
int z = PScr::kPScrZ;
|
||||
if (spriteCheck(pscrSurface->w, pscrSurface->h, x, y)) {
|
||||
showSprite(pscrSurface, x, y, z);
|
||||
}
|
||||
|
@ -2355,24 +2286,17 @@ void PrinceEngine::inventoryLeftMouseButton() {
|
|||
}
|
||||
|
||||
if (_optionsFlag == 1) {
|
||||
//check_opt
|
||||
if (_selectedMob != -1) {
|
||||
//inv_check_mob
|
||||
if (_optionEnabled < _invOptionsNumber) {
|
||||
_optionsFlag = 0;
|
||||
//do_option
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
error("PrinceEngine::inventoryLeftMouseButton() - optionsFlag = 1, selectedMob = 0");
|
||||
// test bx, RMBMask 7996 ? right mouse button here? - > return;
|
||||
//disable_use
|
||||
if (_currentPointerNumber == 2) {
|
||||
//disableuseuse
|
||||
changeCursor(1);
|
||||
_currentPointerNumber = 1;
|
||||
//exit_normally
|
||||
_selectedMob = -1;
|
||||
_optionsMob = -1;
|
||||
return;
|
||||
|
@ -2389,7 +2313,6 @@ void PrinceEngine::inventoryLeftMouseButton() {
|
|||
// map item
|
||||
_optionEnabled = 1;
|
||||
}
|
||||
//do_option
|
||||
} else {
|
||||
//use_item_on_item
|
||||
int invObjUU = _script->scanMobEventsWithItem(_invMobList[_selectedMob]._mask, _script->_scriptInfo.invObjUU, _selectedItem);
|
||||
|
@ -2402,15 +2325,12 @@ void PrinceEngine::inventoryLeftMouseButton() {
|
|||
printAt(0, 216, (char *)_variaTxt->getString(textNr - 80000), kNormalWidth / 2, 100);
|
||||
setVoice(0, 28, 1);
|
||||
playSample(28, 0);
|
||||
//exit_normally
|
||||
_selectedMob = -1;
|
||||
_optionsMob = -1;
|
||||
return;
|
||||
} else {
|
||||
//store_new_pc
|
||||
_interpreter->storeNewPC(invObjUU);
|
||||
_flags->setFlagValue(Flags::CURRMOB, _invMobList[_selectedMob]._mask);
|
||||
//byeinv
|
||||
_showInventoryFlag = false;
|
||||
}
|
||||
}
|
||||
|
@ -2430,12 +2350,9 @@ void PrinceEngine::inventoryLeftMouseButton() {
|
|||
// disableuseuse
|
||||
changeCursor(0);
|
||||
_currentPointerNumber = 1;
|
||||
//exit_normally
|
||||
} else {
|
||||
//store_new_pc
|
||||
_interpreter->storeNewPC(invObjExamEvent);
|
||||
_flags->setFlagValue(Flags::CURRMOB, _invMobList[_selectedMob]._mask);
|
||||
//bye_inv
|
||||
_showInventoryFlag = false;
|
||||
}
|
||||
} else if (_optionEnabled == 1) {
|
||||
|
@ -2448,23 +2365,18 @@ void PrinceEngine::inventoryLeftMouseButton() {
|
|||
makeInvCursor(_invMobList[_selectedMob]._mask);
|
||||
_currentPointerNumber = 2;
|
||||
changeCursor(2);
|
||||
//exit_normally
|
||||
} else {
|
||||
//store_new_pc
|
||||
_interpreter->storeNewPC(invObjUse);
|
||||
_flags->setFlagValue(Flags::CURRMOB, _invMobList[_selectedMob]._mask);
|
||||
//bye_inv
|
||||
_showInventoryFlag = false;
|
||||
}
|
||||
} else if (_optionEnabled == 4) {
|
||||
// not_use_inv
|
||||
// do_standard_give
|
||||
_selectedMode = 1;
|
||||
_selectedItem = _invMobList[_selectedMob]._mask;
|
||||
makeInvCursor(_invMobList[_selectedMob]._mask);
|
||||
_currentPointerNumber = 2;
|
||||
changeCursor(2);
|
||||
//exit_normally
|
||||
} else {
|
||||
// use_item_on_item
|
||||
int invObjUU = _script->scanMobEventsWithItem(_invMobList[_selectedMob]._mask, _script->_scriptInfo.invObjUU, _selectedItem);
|
||||
|
@ -2477,16 +2389,12 @@ void PrinceEngine::inventoryLeftMouseButton() {
|
|||
printAt(0, 216, (char *)_variaTxt->getString(textNr - 80000), kNormalWidth / 2, 100);
|
||||
setVoice(0, 28, 1);
|
||||
playSample(28, 0);
|
||||
//exit_normally
|
||||
} else {
|
||||
//store_new_pc
|
||||
_interpreter->storeNewPC(invObjUU);
|
||||
_flags->setFlagValue(Flags::CURRMOB, _invMobList[_selectedMob]._mask);
|
||||
//byeinv
|
||||
_showInventoryFlag = false;
|
||||
}
|
||||
}
|
||||
//exit_normally
|
||||
_selectedMob = -1;
|
||||
_optionsMob = -1;
|
||||
}
|
||||
|
@ -2733,7 +2641,7 @@ void PrinceEngine::createDialogBox(int dialogBoxNr) {
|
|||
while ((sentenceNumber = *dialogText) != 0xFF) {
|
||||
dialogText++;
|
||||
if (!(dialogDataValue & (1 << sentenceNumber))) {
|
||||
_dialogLines += calcText((const char *)dialogText);
|
||||
_dialogLines += calcTextLines((const char *)dialogText);
|
||||
amountOfDialogOptions++;
|
||||
}
|
||||
do {
|
||||
|
@ -2756,7 +2664,7 @@ void PrinceEngine::runDialog() {
|
|||
while (!shouldQuit()) {
|
||||
|
||||
drawScreen();
|
||||
// background iterpreter?
|
||||
// TODO - background iterpreter?
|
||||
|
||||
int dialogX = (640 - _dialogWidth) / 2;
|
||||
int dialogY = 460 - _dialogHeight;
|
||||
|
@ -2849,7 +2757,6 @@ void PrinceEngine::runDialog() {
|
|||
_dialogImage->free();
|
||||
delete _dialogImage;
|
||||
_dialogFlag = false;
|
||||
// cursor?
|
||||
}
|
||||
|
||||
void PrinceEngine::dialogLeftMouseButton(byte *string, int dialogSelected) {
|
||||
|
@ -2873,7 +2780,7 @@ void PrinceEngine::dialogLeftMouseButton(byte *string, int dialogSelected) {
|
|||
void PrinceEngine::talkHero(int slot) {
|
||||
// heroSlot = textSlot (slot 0 or 1)
|
||||
Text &text = _textSlots[slot];
|
||||
int lines = calcText((const char *)_interpreter->getString());
|
||||
int lines = calcTextLines((const char *)_interpreter->getString());
|
||||
int time = lines * 30;
|
||||
|
||||
if (slot == 0) {
|
||||
|
@ -2896,7 +2803,7 @@ void PrinceEngine::talkHero(int slot) {
|
|||
|
||||
void PrinceEngine::doTalkAnim(int animNumber, int slot, AnimType animType) {
|
||||
Text &text = _textSlots[slot];
|
||||
int lines = calcText((const char *)_interpreter->getString());
|
||||
int lines = calcTextLines((const char *)_interpreter->getString());
|
||||
int time = lines * 30;
|
||||
if (animType == kNormalAnimation) {
|
||||
Anim &normAnim = _normAnimList[animNumber];
|
||||
|
@ -4545,5 +4452,3 @@ void PrinceEngine::mainLoop() {
|
|||
}
|
||||
|
||||
} // End of namespace Prince
|
||||
|
||||
/* vim: set tabstop=4 expandtab!: */
|
||||
|
|
|
@ -49,7 +49,6 @@
|
|||
#include "prince/object.h"
|
||||
#include "prince/pscr.h"
|
||||
|
||||
|
||||
namespace Prince {
|
||||
|
||||
struct PrinceGameDescription;
|
||||
|
@ -301,7 +300,8 @@ public:
|
|||
|
||||
void changeCursor(uint16 curId);
|
||||
void printAt(uint32 slot, uint8 color, char *s, uint16 x, uint16 y);
|
||||
int calcText(const char *s);
|
||||
int calcTextLines(const char *s);
|
||||
int calcTextTime(int numberOfLines);
|
||||
|
||||
static const uint8 kMaxTexts = 32;
|
||||
Text _textSlots[kMaxTexts];
|
||||
|
@ -355,7 +355,7 @@ public:
|
|||
Common::Array<uint32> _mobPriorityList;
|
||||
Common::Array<Mask> _maskList;
|
||||
Common::Array<Object *> _objList;
|
||||
int *_objSlot;
|
||||
uint16 *_objSlot;
|
||||
|
||||
void freeNormAnim(int slot);
|
||||
void freeAllNormAnims();
|
||||
|
@ -563,9 +563,6 @@ public:
|
|||
int checkRightDownDir();
|
||||
int checkRightUpDir();
|
||||
|
||||
int testAnimNr;
|
||||
int testAnimFrame;
|
||||
|
||||
private:
|
||||
bool playNextFrame();
|
||||
void keyHandler(Common::Event event);
|
||||
|
@ -620,5 +617,3 @@ private:
|
|||
} // End of namespace Prince
|
||||
|
||||
#endif
|
||||
|
||||
/* vim: set tabstop=4 noexpandtab: */
|
||||
|
|
|
@ -21,17 +21,13 @@
|
|||
*/
|
||||
|
||||
#include "common/archive.h"
|
||||
#include "common/debug-channels.h"
|
||||
#include "common/debug.h"
|
||||
#include "common/stream.h"
|
||||
|
||||
#include "graphics/surface.h"
|
||||
|
||||
#include "prince/pscr.h"
|
||||
|
||||
namespace Prince {
|
||||
|
||||
PScr::PScr() :_file(0), _x(0), _y(0), _step(0), _addr(0), _len(0), _surface(nullptr)
|
||||
PScr::PScr() : _x(0), _y(0), _step(0), _surface(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -58,15 +54,14 @@ void PScr::loadSurface(Common::SeekableReadStream &stream) {
|
|||
bool PScr::loadFromStream(Common::SeekableReadStream &stream) {
|
||||
int32 pos = stream.pos();
|
||||
uint16 file = stream.readUint16LE();
|
||||
if (file == 0xFFFF)
|
||||
if (file == 0xFFFF) {
|
||||
return false;
|
||||
_file = file;
|
||||
}
|
||||
_x = stream.readUint16LE();
|
||||
_y = stream.readUint16LE();
|
||||
_step = stream.readUint16LE();
|
||||
_addr = stream.readUint32LE();
|
||||
|
||||
const Common::String pscrStreamName = Common::String::format("PS%02d", _file);
|
||||
const Common::String pscrStreamName = Common::String::format("PS%02d", file);
|
||||
Common::SeekableReadStream *pscrStream = SearchMan.createReadStreamForMember(pscrStreamName);
|
||||
if (pscrStream != nullptr) {
|
||||
loadSurface(*pscrStream);
|
||||
|
@ -74,9 +69,7 @@ bool PScr::loadFromStream(Common::SeekableReadStream &stream) {
|
|||
delete pscrStream;
|
||||
stream.seek(pos + 12); // size of PScrList struct
|
||||
|
||||
debug("Parallex nr %d, x %d, y %d, step %d", _file, _x, _y, _step);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
} // End of namespace Prince
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
#ifndef PRINCE_PSCR_H
|
||||
#define PRINCE_PSCR_H
|
||||
|
||||
#include "image/image_decoder.h"
|
||||
#include "graphics/surface.h"
|
||||
|
||||
namespace Prince {
|
||||
|
@ -32,13 +31,10 @@ class PScr {
|
|||
public:
|
||||
PScr();
|
||||
~PScr();
|
||||
|
||||
int16 _file;
|
||||
int16 _x;
|
||||
int16 _y;
|
||||
int16 _step;
|
||||
int32 _addr;
|
||||
byte _len;
|
||||
static const int16 kPScrZ = 1000;
|
||||
|
||||
bool loadFromStream(Common::SeekableReadStream &stream);
|
||||
Graphics::Surface *getSurface() const { return _surface; }
|
||||
|
@ -47,7 +43,6 @@ private:
|
|||
Graphics::Surface *_surface;
|
||||
};
|
||||
|
||||
}
|
||||
} // End of namespace Prince
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -95,8 +95,6 @@ namespace Resource {
|
|||
|
||||
}
|
||||
|
||||
}
|
||||
} // End of namespace Prince
|
||||
|
||||
#endif
|
||||
|
||||
/* vim: set tabstop=4 noexpandtab: */
|
||||
|
|
|
@ -26,10 +26,12 @@
|
|||
#include "prince/flags.h"
|
||||
#include "prince/script.h"
|
||||
#include "prince/hero.h"
|
||||
|
||||
#include "common/savefile.h"
|
||||
#include "common/system.h"
|
||||
#include "common/config-manager.h"
|
||||
#include "common/memstream.h"
|
||||
|
||||
#include "graphics/thumbnail.h"
|
||||
#include "graphics/surface.h"
|
||||
#include "graphics/palette.h"
|
||||
|
|
|
@ -31,7 +31,6 @@
|
|||
|
||||
#include "common/debug.h"
|
||||
#include "common/debug-channels.h"
|
||||
#include "common/stream.h"
|
||||
#include "common/archive.h"
|
||||
#include "common/memstream.h"
|
||||
|
||||
|
@ -90,20 +89,24 @@ Script::Script(PrinceEngine *vm) : _vm(vm), _data(nullptr), _dataSize(0) {
|
|||
}
|
||||
|
||||
Script::~Script() {
|
||||
delete[] _data;
|
||||
if (_data != nullptr) {
|
||||
free(_data);
|
||||
_dataSize = 0;
|
||||
_data = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
bool Script::loadFromStream(Common::SeekableReadStream &stream) {
|
||||
_dataSize = stream.size();
|
||||
if (!_dataSize)
|
||||
if (!_dataSize) {
|
||||
return false;
|
||||
}
|
||||
|
||||
_data = new byte[_dataSize];
|
||||
_data = (byte *)malloc(_dataSize);
|
||||
|
||||
if (!_data)
|
||||
if (!_data) {
|
||||
return false;
|
||||
}
|
||||
|
||||
stream.read(_data, _dataSize);
|
||||
|
||||
|
@ -2015,6 +2018,4 @@ Interpreter::OpcodeFunc Interpreter::_opcodes[kNumOpcodes] = {
|
|||
&Interpreter::O_BREAK_POINT,
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
/* vim: set tabstop=4 noexpandtab: */
|
||||
} // End of namespace Prince
|
||||
|
|
|
@ -26,13 +26,10 @@
|
|||
#include "common/random.h"
|
||||
#include "common/endian.h"
|
||||
#include "common/array.h"
|
||||
#include "common/stream.h"
|
||||
|
||||
#include "prince/flags.h"
|
||||
|
||||
namespace Common {
|
||||
class SeekableReadStream;
|
||||
}
|
||||
|
||||
namespace Prince {
|
||||
|
||||
class PrinceEngine;
|
||||
|
@ -42,9 +39,9 @@ struct Anim;
|
|||
struct BackgroundAnim;
|
||||
struct Mask;
|
||||
|
||||
// TODO - change this to sth else?
|
||||
namespace Detail {
|
||||
template <typename T> T LittleEndianReader(void *data);
|
||||
template <> inline uint8 LittleEndianReader<uint8>(void *data) { return *(uint8*)(data); }
|
||||
template <> inline uint16 LittleEndianReader<uint16>(void *data) { return READ_LE_UINT16(data); }
|
||||
template <> inline uint32 LittleEndianReader<uint32>(void *data) { return READ_LE_UINT32(data); }
|
||||
}
|
||||
|
@ -233,7 +230,6 @@ private:
|
|||
uint32 currentString;
|
||||
} _stringStack;
|
||||
uint8 _stacktop;
|
||||
//uint8 _savedStacktop;
|
||||
uint32 _waitFlag;
|
||||
|
||||
byte *_string;
|
||||
|
@ -404,8 +400,6 @@ private:
|
|||
|
||||
};
|
||||
|
||||
}
|
||||
} // End of namespace Prince
|
||||
|
||||
#endif
|
||||
|
||||
/* vim: set tabstop=4 noexpandtab: */
|
||||
|
|
|
@ -217,6 +217,4 @@ void MusicPlayer::sendToChannel(byte channel, uint32 b) {
|
|||
_channelsTable[channel]->send(b);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* vim: set tabstop=4 expandtab!: */
|
||||
} // End of namespace Prince
|
||||
|
|
|
@ -70,5 +70,3 @@ public:
|
|||
} // End of namespace Prince
|
||||
|
||||
#endif
|
||||
|
||||
/* vim: set tabstop=4 expandtab!: */
|
||||
|
|
|
@ -25,19 +25,21 @@
|
|||
|
||||
namespace Prince {
|
||||
|
||||
VariaTxt::VariaTxt() : _dataSize(0), _data(NULL) {
|
||||
VariaTxt::VariaTxt() : _dataSize(0), _data(nullptr) {
|
||||
}
|
||||
|
||||
VariaTxt::~VariaTxt() {
|
||||
_dataSize = 0;
|
||||
delete[] _data;
|
||||
_data = NULL;
|
||||
if (_data != nullptr) {
|
||||
free(_data);
|
||||
_data = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool VariaTxt::loadFromStream(Common::SeekableReadStream &stream) {
|
||||
_dataSize = stream.size();
|
||||
_data = new byte [_dataSize];
|
||||
_data = (byte *)malloc(_dataSize);
|
||||
stream.read(_data, _dataSize);
|
||||
return true;
|
||||
}
|
||||
|
@ -50,6 +52,4 @@ byte *VariaTxt::getString(uint32 stringId) {
|
|||
return _data + stringOffset;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* vim: set tabstop=4 noexpandtab: */
|
||||
} // End of namespace Prince
|
||||
|
|
|
@ -27,11 +27,9 @@ namespace Prince {
|
|||
class VariaTxt {
|
||||
public:
|
||||
VariaTxt();
|
||||
|
||||
~VariaTxt();
|
||||
|
||||
bool loadFromStream(Common::SeekableReadStream &stream);
|
||||
|
||||
byte *getString(uint32 stringId);
|
||||
|
||||
private:
|
||||
|
@ -39,6 +37,4 @@ private:
|
|||
byte *_data;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
/* vim: set tabstop=4 noexpandtab: */
|
||||
} // End of namespace Prince
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue