HOPKINS: Merge 'remotes/dreammaster/hopkins' into hopkins

Conflicts:
	engines/hopkins/lines.cpp
	engines/hopkins/lines.h
	engines/hopkins/objects.cpp
This commit is contained in:
Willem Jan Palenstijn 2013-02-18 23:52:55 +01:00
commit 81bb4d4374
15 changed files with 780 additions and 776 deletions

View file

@ -532,10 +532,10 @@ int AnimationManager::loadSpriteBank(int idx, const Common::String &filename) {
byte *ofsData = _vm->_fileManager.loadFile(ofsFilename);
byte *curOfsData = ofsData;
for (int objIdx = 0; objIdx < _vm->_globals.Bank[idx]._objDataIdx; ++objIdx, curOfsData += 8) {
int x1 = (int16)READ_LE_UINT16(curOfsData);
int y1 = (int16)READ_LE_UINT16(curOfsData + 2);
int x2 = (int16)READ_LE_UINT16(curOfsData + 4);
int y2 = (int16)READ_LE_UINT16(curOfsData + 6);
int x1 = READ_LE_INT16(curOfsData);
int y1 = READ_LE_INT16(curOfsData + 2);
int x2 = READ_LE_INT16(curOfsData + 4);
int y2 = READ_LE_INT16(curOfsData + 6);
_vm->_objectsManager.setOffsetXY(_vm->_globals.Bank[idx]._data, objIdx, x1, y1, 0);
if (_vm->_globals.Bank[idx]._fileHeader == 2)

View file

@ -659,36 +659,46 @@ void ComputerManager::displayBricks() {
_breakoutBrickNbr = 0;
_breakoutSpeed = 1;
int16 *level = _breakoutLevel;
int levelIdx = 0;
int cellLeft;
int cellTop;
int cellType;
do {
for (int levelIdx = 0; ; levelIdx += 6) {
cellLeft = level[levelIdx];
if (cellLeft == -1)
break;
cellTop = level[levelIdx + 1];
cellType = level[levelIdx + 4];
if (cellLeft != -1) {
if (cellType <= 6)
++_breakoutBrickNbr;
if (cellType == 3)
_vm->_graphicsManager.AFFICHE_SPEEDVGA(_breakoutSpr, cellLeft, cellTop, 17);
else if (cellType == 6)
_vm->_graphicsManager.AFFICHE_SPEEDVGA(_breakoutSpr, cellLeft, cellTop, 18);
else if (cellType == 5)
_vm->_graphicsManager.AFFICHE_SPEEDVGA(_breakoutSpr, cellLeft, cellTop, 19);
else if (cellType == 4)
_vm->_graphicsManager.AFFICHE_SPEEDVGA(_breakoutSpr, cellLeft, cellTop, 20);
else if (cellType == 1)
_vm->_graphicsManager.AFFICHE_SPEEDVGA(_breakoutSpr, cellLeft, cellTop, 21);
else if (cellType == 2)
_vm->_graphicsManager.AFFICHE_SPEEDVGA(_breakoutSpr, cellLeft, cellTop, 22);
else if (cellType == 31)
_vm->_graphicsManager.AFFICHE_SPEEDVGA(_breakoutSpr, cellLeft, cellTop, 23);
if (cellType <= 6)
++_breakoutBrickNbr;
switch (cellType) {
case 1:
_vm->_graphicsManager.AFFICHE_SPEEDVGA(_breakoutSpr, cellLeft, cellTop, 21);
break;
case 2:
_vm->_graphicsManager.AFFICHE_SPEEDVGA(_breakoutSpr, cellLeft, cellTop, 22);
break;
case 3:
_vm->_graphicsManager.AFFICHE_SPEEDVGA(_breakoutSpr, cellLeft, cellTop, 17);
break;
case 4:
_vm->_graphicsManager.AFFICHE_SPEEDVGA(_breakoutSpr, cellLeft, cellTop, 20);
break;
case 5:
_vm->_graphicsManager.AFFICHE_SPEEDVGA(_breakoutSpr, cellLeft, cellTop, 19);
break;
case 6:
_vm->_graphicsManager.AFFICHE_SPEEDVGA(_breakoutSpr, cellLeft, cellTop, 18);
break;
case 31:
_vm->_graphicsManager.AFFICHE_SPEEDVGA(_breakoutSpr, cellLeft, cellTop, 23);
break;
}
levelIdx += 6;
} while (cellLeft != -1);
}
displayScore();
}
@ -1042,18 +1052,17 @@ int ComputerManager::moveBall() {
_vm->_soundManager.playSample(2, 6);
_ballPosition.x = randVal + 6;
_ballRightFl = !_ballRightFl;
}
if (_ballPosition.x > 307) {
} else if (_ballPosition.x > 307) {
_vm->_soundManager.playSample(2, 6);
_ballPosition.x = 307 - randVal;
_ballRightFl = !_ballRightFl;
}
if (_ballPosition.y <= 6) {
_vm->_soundManager.playSample(2, 6);
_ballPosition.y = randVal + 7;
_ballUpFl = !_ballUpFl;
}
if (_ballPosition.y >= 186 && _ballPosition.y <= 194) {
} else if (_ballPosition.y >= 186 && _ballPosition.y <= 194) {
_vm->_soundManager.playSample(2, 6);
int ballPosXRight = _ballPosition.x + 6;
if ((_ballPosition.x > _padPositionX - 2) && (ballPosXRight < _padPositionX + 36)) {

View file

@ -320,7 +320,7 @@ void DialogsManager::showInventory() {
_vm->_eventsManager.getMouseY();
_vm->_eventsManager.VBL();
}
_vm->_dialogsManager._inventWin1 = g_PTRNUL;
_inventWin1 = g_PTRNUL;
bool loopFl;
do {
@ -352,18 +352,18 @@ void DialogsManager::showInventory() {
error("Error opening file - %s", filename.c_str());
size_t filesize = f.size();
_vm->_dialogsManager._inventWin1 = _vm->_globals.allocMemory(filesize);
_vm->_fileManager.readStream(f, _vm->_dialogsManager._inventWin1, filesize);
_inventWin1 = _vm->_globals.allocMemory(filesize);
_vm->_fileManager.readStream(f, _inventWin1, filesize);
f.close();
_inventBuf2 = _vm->_fileManager.loadFile("INVENT2.SPR");
_inventX = _vm->_graphicsManager._scrollOffset + 152;
_inventY = 114;
_inventWidth = _vm->_objectsManager.getWidth(_vm->_dialogsManager._inventWin1, 0);
_inventHeight = _vm->_objectsManager.getHeight(_vm->_dialogsManager._inventWin1, 0);
_inventWidth = _vm->_objectsManager.getWidth(_inventWin1, 0);
_inventHeight = _vm->_objectsManager.getHeight(_inventWin1, 0);
_vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager._vesaBuffer, _vm->_dialogsManager._inventWin1, _inventX + 300, 414, 0, 0, 0, false);
_vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager._vesaBuffer, _inventWin1, _inventX + 300, 414, 0, 0, 0, false);
int curPosY = 0;
int inventCount = 0;
for (int inventLine = 1; inventLine <= 5; inventLine++) {
@ -382,7 +382,7 @@ void DialogsManager::showInventory() {
};
curPosY += 38;
}
_vm->_graphicsManager.Capture_Mem(_vm->_graphicsManager._vesaBuffer, _vm->_dialogsManager._inventWin1, _inventX, _inventY, _inventWidth, _inventHeight);
_vm->_graphicsManager.Capture_Mem(_vm->_graphicsManager._vesaBuffer, _inventWin1, _inventX, _inventY, _inventWidth, _inventHeight);
_vm->_eventsManager._curMouseButton = 0;
int newInventoryItem = 0;
@ -433,7 +433,7 @@ void DialogsManager::showInventory() {
_vm->_globals._exitId = 0;
_inventBuf2 = _vm->_globals.freeMemory(_inventBuf2);
_vm->_dialogsManager._inventWin1 = _vm->_globals.freeMemory(_vm->_dialogsManager._inventWin1);
_inventWin1 = _vm->_globals.freeMemory(_inventWin1);
loopFl = true;
break;
} else
@ -455,15 +455,15 @@ void DialogsManager::showInventory() {
_vm->_objectsManager.BOBTOUS = true;
}
_vm->_dialogsManager._inventWin1 = _vm->_globals.freeMemory(_vm->_dialogsManager._inventWin1);
_inventWin1 = _vm->_globals.freeMemory(_inventWin1);
_inventBuf2 = _vm->_globals.freeMemory(_inventBuf2);
if (_vm->_eventsManager._mouseCursorId == 1)
showOptionsDialog();
else if (_vm->_eventsManager._mouseCursorId == 3)
_vm->_dialogsManager.showLoadGame();
showLoadGame();
else if (_vm->_eventsManager._mouseCursorId == 2)
_vm->_dialogsManager.showSaveGame();
showSaveGame();
_vm->_eventsManager._mouseCursorId = 4;
_vm->_eventsManager.changeMouseCursor(4);
@ -535,21 +535,21 @@ void DialogsManager::testDialogOpening() {
switch (key) {
case KEY_INVENTORY:
_vm->_dialogsManager.showInventory();
showInventory();
break;
case KEY_OPTIONS:
_vm->_graphicsManager._scrollStatus = 1;
_vm->_dialogsManager.showOptionsDialog();
showOptionsDialog();
_vm->_graphicsManager._scrollStatus = 0;
break;
case KEY_LOAD:
_vm->_graphicsManager._scrollStatus = 1;
_vm->_dialogsManager.showLoadGame();
showLoadGame();
_vm->_graphicsManager._scrollStatus = 0;
break;
case KEY_SAVE:
_vm->_graphicsManager._scrollStatus = 1;
_vm->_dialogsManager.showSaveGame();
showSaveGame();
_vm->_graphicsManager._scrollStatus = 0;
break;
default:

View file

@ -210,7 +210,7 @@ void FontManager::box(int idx, int messageId, const Common::String &filename, in
_tempText = _vm->_globals.allocMemory(110);
Common::fill(&_tempText[0], &_tempText[110], 0);
memcpy(_tempText, _vm->_globals.BUF_ZONE + _index[messageId], 96);
WRITE_LE_UINT16((uint16 *)_tempText + 48, (int16)READ_LE_UINT16(_vm->_globals.BUF_ZONE + _index[messageId] + 96));
WRITE_LE_UINT16((uint16 *)_tempText + 48, READ_LE_INT16(_vm->_globals.BUF_ZONE + _index[messageId] + 96));
}
byte *curTempTextPtr = _tempText;
for (int i = 0; i < bufSize; i++) {

View file

@ -103,9 +103,9 @@ Globals::Globals() {
_linuxEndDemoFl = false;
_speed = 1;
_oldFrameIndex = 0;
_oldDirection = 0;
_oldDirection = DIR_NONE;
_oldDirectionSpriteIdx = 59;
_lastDirection = 0;
_lastDirection = DIR_NONE;
NUM_FICHIER_OBJ = 0;
nbrligne = 0;
_boxWidth = 0;
@ -130,8 +130,7 @@ Globals::Globals() {
PERSO_TYPE = 0;
GOACTION = false;
Compteur = 0;
_actionDirection = 0;
_actionDirection = 0;
_actionDirection = DIR_NONE;
Credit_bx = -1;
Credit_bx1 = -1;
@ -142,7 +141,7 @@ Globals::Globals() {
memset(_creditsItem, 0, 12000);
_creditsStep = 0;
_oceanDirection = 0;
_oceanDirection = DIR_NONE;
// Initialize pointers
BUF_ZONE = NULL;
@ -177,7 +176,6 @@ Globals::Globals() {
_oldMouseY = 0;
compteur_71 = 0;
_forceHideText = false;
j_104 = 0;
}
Globals::~Globals() {
@ -284,7 +282,7 @@ void Globals::loadCharacterData() {
}
_oldFrameIndex = -1;
_oldDirection = -1;
_oldDirection = DIR_NONE;
}
void Globals::INIT_ANIM() {
@ -414,10 +412,10 @@ void Globals::loadCache(const Common::String &file) {
CACHE_BANQUE[1] = spriteData;
int curBufIdx = 60;
for (int i = 0; i <= 21; i++) {
Cache[i]._spriteIndex = (int16)READ_LE_UINT16((uint16 *)ptr + curBufIdx);
Cache[i]._x = (int16)READ_LE_UINT16((uint16 *)ptr + curBufIdx + 1);
Cache[i]._y = (int16)READ_LE_UINT16((uint16 *)ptr + curBufIdx + 2);
Cache[i].field14 = (int16)READ_LE_UINT16((uint16 *)ptr + curBufIdx + 4);
Cache[i]._spriteIndex = READ_LE_INT16((uint16 *)ptr + curBufIdx);
Cache[i]._x = READ_LE_INT16((uint16 *)ptr + curBufIdx + 1);
Cache[i]._y = READ_LE_INT16((uint16 *)ptr + curBufIdx + 2);
Cache[i].field14 = READ_LE_INT16((uint16 *)ptr + curBufIdx + 4);
if (spriteData == g_PTRNUL) {
Cache[i]._useCount = 0;
} else {

View file

@ -192,8 +192,6 @@ enum SauvegardeOffset {
, svField401 = 401
};
enum PlayerCharacter { CHARACTER_HOPKINS = 0, CHARACTER_HOPKINS_CLONE = 1, CHARACTER_SAMANTHA = 2 };
// TODO: Sauvegrade1 fields should really be mapped into data array
struct Sauvegarde {
byte _data[2050];
@ -215,6 +213,21 @@ struct CreditItem {
enum Language { LANG_EN = 0, LANG_FR = 1, LANG_SP = 2};
enum PlayerCharacter { CHARACTER_HOPKINS = 0, CHARACTER_HOPKINS_CLONE = 1, CHARACTER_SAMANTHA = 2 };
enum Directions {
DIR_NONE = -1,
DIR_UP = 1,
DIR_UP_RIGHT = 2,
DIR_RIGHT = 3,
DIR_DOWN_RIGHT = 4,
DIR_DOWN = 5,
DIR_DOWN_LEFT = 6,
DIR_LEFT = 7,
DIR_UP_LEFT = 8
};
class HopkinsEngine;
/**
@ -238,10 +251,11 @@ public:
bool _cacheFl;
bool _forceHideText;
int _exitId;
int _oceanDirection;
int _oldDirection, _oldDirectionSpriteIdx;
Directions _oceanDirection;
Directions _oldDirection;
int _oldDirectionSpriteIdx;
int _actionDirection;
int _lastDirection;
Directions _lastDirection;
int _oldFrameIndex;
int _hotspotTextColor;
int _inventory[36];
@ -312,7 +326,6 @@ public:
int compteur_71;
Common::String FICH_ZONE;
bool GOACTION;
int j_104;
Common::String FICH_TEXTE;
Globals();

View file

@ -1246,9 +1246,9 @@ void GraphicsManager::Affiche_Perfect(byte *surface, const byte *srcData, int xp
spriteStartP += READ_LE_UINT32(spriteStartP) + 16;
const byte *spriteSizeP = spriteStartP + 4;
int spriteWidth = (int16)READ_LE_UINT16(spriteSizeP);
int spriteWidth = READ_LE_INT16(spriteSizeP);
spriteSizeP += 2;
int spriteHeight2 = (int16)READ_LE_UINT16(spriteSizeP);
int spriteHeight2 = READ_LE_INT16(spriteSizeP);
int spriteHeight1 = spriteHeight2;
const byte *spritePixelsP = spriteSizeP + 10;
_posXClipped = 0;
@ -1639,9 +1639,9 @@ void GraphicsManager::displayFont(byte *surface, const byte *spriteData, int xp,
int spriteWidth = 0;
int spriteHeight = 0;
const byte *spriteSizeP = spriteDataP + 4;
spriteWidth = (int16)READ_LE_UINT16(spriteSizeP);
spriteWidth = READ_LE_INT16(spriteSizeP);
spriteSizeP += 2;
spriteHeight = (int16)READ_LE_UINT16(spriteSizeP);
spriteHeight = READ_LE_INT16(spriteSizeP);
const byte *spritePixelsP = spriteSizeP + 10;
byte *destP = surface + xp + _lineNbr2 * yp;
_width = spriteWidth;

View file

@ -1285,55 +1285,55 @@ bool HopkinsEngine::runFull() {
break;
case 77:
OCEAN(77, "OCEAN01", 3, 0, 84, 0, 0, 25);
OCEAN(77, "OCEAN01", DIR_RIGHT, 0, 84, 0, 0, 25);
break;
case 78:
OCEAN(78, "OCEAN02", 1, 0, 91, 84, 0, 25);
OCEAN(78, "OCEAN02", DIR_UP, 0, 91, 84, 0, 25);
break;
case 79:
OCEAN(79, "OCEAN03", 7, 87, 0, 0, 83, 25);
OCEAN(79, "OCEAN03", DIR_LEFT, 87, 0, 0, 83, 25);
break;
case 80:
OCEAN(80, "OCEAN04", 1, 86, 88, 0, 81, 25);
OCEAN(80, "OCEAN04", DIR_UP, 86, 88, 0, 81, 25);
break;
case 81:
OCEAN(81, "OCEAN05", 1, 91, 82, 80, 85, 25);
OCEAN(81, "OCEAN05", DIR_UP, 91, 82, 80, 85, 25);
break;
case 82:
OCEAN(82, "OCEAN06", 7, 81, 0, 88, 0, 25);
OCEAN(82, "OCEAN06", DIR_LEFT, 81, 0, 88, 0, 25);
break;
case 83:
OCEAN(83, "OCEAN07", 1, 89, 0, 79, 88, 25);
OCEAN(83, "OCEAN07", DIR_UP, 89, 0, 79, 88, 25);
break;
case 84:
OCEAN(84, "OCEAN08", 1, 77, 0, 0, 78, 25);
OCEAN(84, "OCEAN08", DIR_UP, 77, 0, 0, 78, 25);
break;
case 85:
OCEAN(85, "OCEAN09", 1, 0, 0, 81, 0, 25);
OCEAN(85, "OCEAN09", DIR_UP, 0, 0, 81, 0, 25);
break;
case 86:
OCEAN(86, "OCEAN10", 1, 0, 80, 0, 91, 25);
OCEAN(86, "OCEAN10", DIR_UP, 0, 80, 0, 91, 25);
break;
case 87:
OCEAN(87, "OCEAN11", 3, 0, 79, 90, 0, 25);
OCEAN(87, "OCEAN11", DIR_RIGHT, 0, 79, 90, 0, 25);
break;
case 88:
OCEAN(88, "OCEAN12", 1, 80, 0, 83, 82, 25);
OCEAN(88, "OCEAN12", DIR_UP, 80, 0, 83, 82, 25);
break;
case 89:
OCEAN(89, "OCEAN13", 3, 0, 83, 0, 0, 25);
OCEAN(89, "OCEAN13", DIR_RIGHT, 0, 83, 0, 0, 25);
break;
case 90:
@ -1341,7 +1341,7 @@ bool HopkinsEngine::runFull() {
break;
case 91:
OCEAN(91, "OCEAN15", 3, 78, 81, 86, 0, 25);
OCEAN(91, "OCEAN15", DIR_RIGHT, 78, 81, 86, 0, 25);
break;
case 93:
@ -2540,18 +2540,18 @@ void HopkinsEngine::BTOCEAN() {
switch (_objectsManager._zoneNum) {
case 1:
switch (_globals._oceanDirection) {
case 1:
_objectsManager.SPACTION(_globals.PERSO, "27,26,25,24,23,22,21,20,19,18,-1,", 0, 0, 6, false);
break;
case 3:
case DIR_UP:
_objectsManager.SPACTION(_globals.PERSO, "27,26,25,24,23,22,21,20,19,18,-1,", 0, 0, 6, false);
break;
case DIR_RIGHT:
_objectsManager.SPACTION(_globals.PERSO, "0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,-1,", 0, 0, 6, false);
break;
case 5:
case DIR_DOWN:
_objectsManager.SPACTION(_globals.PERSO, "9,10,11,12,13,14,15,16,17,18,-1,", 0, 0, 6, false);
break;
}
_globals._oceanDirection = 7;
_globals._oceanDirection = DIR_LEFT;
_globals._exitId = 1;
oldX = _objectsManager.getSpriteX(0);
for (;;) {
@ -2575,17 +2575,17 @@ void HopkinsEngine::BTOCEAN() {
break;
case 2:
switch (_globals._oceanDirection) {
case 1:
case DIR_UP:
_objectsManager.SPACTION(_globals.PERSO, "27,28,29,30,31,32,33,34,35,36,-1,", 0, 0, 6, false);
break;
case 5:
case DIR_DOWN:
_objectsManager.SPACTION(_globals.PERSO, "9,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 6, false);
break;
case 7:
case DIR_LEFT:
_objectsManager.SPACTION(_globals.PERSO, "18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,-1,", 0, 0, 6, false);
break;
}
_globals._oceanDirection = 3;
_globals._oceanDirection = DIR_RIGHT;
_globals._exitId = 2;
oldX = _objectsManager.getSpriteX(0);
for (;;) {
@ -2608,7 +2608,7 @@ void HopkinsEngine::BTOCEAN() {
break;
case 3:
switch (_globals._oceanDirection) {
case 3:
case DIR_RIGHT:
oldX = _objectsManager.getSpriteX(0);
do {
if (_globals._speed == 1)
@ -2628,10 +2628,10 @@ void HopkinsEngine::BTOCEAN() {
if (!displAnim)
_objectsManager.SPACTION(_globals.PERSO, "36,35,34,33,32,31,30,29,28,27,-1,", 0, 0, 6, false);
break;
case 5:
case DIR_DOWN:
_objectsManager.SPACTION(_globals.PERSO, "9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,-1,", 0, 0, 6, false);
break;
case 7:
case DIR_LEFT:
oldX = _objectsManager.getSpriteX(0);
do {
if (_globals._speed == 1)
@ -2652,15 +2652,15 @@ void HopkinsEngine::BTOCEAN() {
_objectsManager.SPACTION(_globals.PERSO, "18,19,20,21,22,23,24,25,26,27,-1,", 0, 0, 6, false);
break;
}
_globals._oceanDirection = 1;
_globals._oceanDirection = DIR_UP;
_globals._exitId = 3;
break;
case 4:
switch (_globals._oceanDirection) {
case 1:
case DIR_UP:
_objectsManager.SPACTION(_globals.PERSO, "27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,-1,", 0, 0, 6, false);
break;
case 3:
case DIR_RIGHT:
oldX = _objectsManager.getSpriteX(0);
do {
if (_globals._speed == 1)
@ -2680,7 +2680,7 @@ void HopkinsEngine::BTOCEAN() {
if (!displAnim)
_objectsManager.SPACTION(_globals.PERSO, "0,1,2,3,4,5,6,7,8,9,-1,", 0, 0, 6, false);
break;
case 7:
case DIR_LEFT:
oldX = _objectsManager.getSpriteX(0);
for (;;) {
if (_globals._speed == 1)
@ -2703,24 +2703,30 @@ void HopkinsEngine::BTOCEAN() {
}
break;
}
_globals._oceanDirection = 5;
_globals._oceanDirection = DIR_DOWN;
_globals._exitId = 4;
break;
}
}
void HopkinsEngine::OCEAN_HOME() {
if (_globals._oceanDirection == 3)
_objectsManager.setSpriteIndex(0, 0);
else if (_globals._oceanDirection == 7)
_objectsManager.setSpriteIndex(0, 18);
else if (_globals._oceanDirection == 1)
switch (_globals._oceanDirection) {
case DIR_UP:
_objectsManager.setSpriteIndex(0, 27);
else if (_globals._oceanDirection == 5)
break;
case DIR_RIGHT:
_objectsManager.setSpriteIndex(0, 0);
break;
case DIR_DOWN:
_objectsManager.setSpriteIndex(0, 9);
break;
case DIR_LEFT:
_objectsManager.setSpriteIndex(0, 18);
break;
}
}
void HopkinsEngine::OCEAN(int16 curExitId, Common::String backgroundFilename, int16 defaultDirection, int16 exit1, int16 exit2, int16 exit3, int16 exit4, int16 soundId) {
void HopkinsEngine::OCEAN(int16 curExitId, Common::String backgroundFilename, Directions defaultDirection, int16 exit1, int16 exit2, int16 exit3, int16 exit4, int16 soundId) {
_globals._cityMapEnabledFl = false;
_graphicsManager._noFadingFl = false;
_globals.NOMARCHE = false;
@ -2753,19 +2759,19 @@ void HopkinsEngine::OCEAN(int16 curExitId, Common::String backgroundFilename, in
_globals._oceanDirection = defaultDirection;
switch (_globals._oceanDirection) {
case 1:
case DIR_UP:
_objectsManager._characterPos.x = 236;
_objectsManager._startSpriteIndex = 27;
break;
case 3:
case DIR_RIGHT:
_objectsManager._characterPos.x = -20;
_objectsManager._startSpriteIndex = 0;
break;
case 5:
case DIR_DOWN:
_objectsManager._characterPos.x = 236;
_objectsManager._startSpriteIndex = 9;
break;
case 7:
case DIR_LEFT:
_objectsManager._characterPos.x = 415;
_objectsManager._startSpriteIndex = 18;
break;

View file

@ -82,6 +82,8 @@ enum {
*/
#define MKTAG24(a0,a1,a2) ((uint32)((a2) | (a1) << 8 | ((a0) << 16)))
#define READ_LE_INT16(x) (int16) READ_LE_UINT16(x)
struct HopkinsGameDescription;
class HopkinsEngine : public Engine {
@ -120,7 +122,7 @@ private:
void BTOCEAN();
void OCEAN_HOME();
void OCEAN(int16 curExitId, Common::String backgroundFilename, int16 defaultDirection, int16 exit1, int16 exit2, int16 exit3, int16 exit4, int16 soundId);
void OCEAN(int16 curExitId, Common::String backgroundFilename, Directions defaultDirection, int16 exit1, int16 exit2, int16 exit3, int16 exit4, int16 soundId);
void loadCredits();
void displayCredits(int startPosY, byte *buffer, char colour);
void displayCredits();

File diff suppressed because it is too large Load diff

View file

@ -23,6 +23,8 @@
#ifndef HOPKINS_LINES_H
#define HOPKINS_LINES_H
#include "hopkins/globals.h"
#include "common/scummsys.h"
#include "common/str.h"
@ -40,9 +42,9 @@ struct RouteItem;
struct LigneItem {
int _lineDataEndIdx;
int _direction;
int field6;
int field8;
Directions _direction;
Directions field6;
Directions field8;
int16 *_lineData;
int appendToRouteInc(int from, int to, RouteItem *route, int index);
@ -91,11 +93,11 @@ struct ZonePItem {
struct RouteItem {
int16 _X;
int16 _Y;
int16 _dir;
Directions _dir;
int16 _unk;
bool isValid() const { return _X != -1 || _Y != -1; }
void invalidate() { _X = _Y = _dir = _unk = -1; }
void set(int16 X, int16 Y, int16 dir) { _X = X; _Y = Y; _dir = dir; _unk = 0; }
void invalidate() { _X = _Y = _unk = -1; _dir = DIR_NONE; }
void set(int16 X, int16 Y, Directions dir) { _X = X; _Y = Y; _dir = dir; _unk = 0; }
};
@ -110,7 +112,7 @@ private:
int NV_POSI;
int NVPX;
int NVPY;
int _smoothMoveDirection;
Directions _smoothMoveDirection;
RouteItem super_parcours[8001];
byte *BUFFERTAPE;
RouteItem *essai0;
@ -135,7 +137,7 @@ private:
int CALC_PROPRE(int idx);
int CONTOURNE1(int a1, int a2, int a3, int a4, int a5, RouteItem *route, int a8, int a9);
int CONTOURNE(int a1, int a2, int a3, int a4, int a5, RouteItem *route);
bool MIRACLE(int a1, int a2, int a3, int a4, int a5);
bool MIRACLE(int fromX, int fromY, int a3, int a4, int a5);
int GENIAL(int lineIdx, int dataIdx, int a3, int a4, int a5, int a6, int a7, RouteItem *route);
int PARC_PERS(int fromX, int fromY, int destX, int destY, int a5, int a6, int a7);
bool PLAN_TEST(int paramX, int paramY, int a3, int a4, int a5);
@ -159,7 +161,7 @@ public:
int checkInventoryHotspots(int posX, int posY);
void addZoneLine(int idx, int a2, int a3, int a4, int a5, int bobZoneIdx);
void loadLines(const Common::String &file);
void addLine(int idx, int direction, int a3, int a4, int a5, int a6);
void addLine(int idx, Directions direction, int a3, int a4, int a5, int a6);
void initRoute();
RouteItem *cityMapCarRoute(int x1, int y1, int x2, int y2);
void clearAllZones();

View file

@ -193,9 +193,9 @@ int ObjectsManager::getOffsetX(const byte *spriteData, int spriteIndex, bool isS
v3 += READ_LE_UINT32(v3) + 16;
const byte *v5 = v3 + 8;
int result = (int16)READ_LE_UINT16(v5);
int result = READ_LE_INT16(v5);
if (isSize)
result = (int16)READ_LE_UINT16(v5 + 4);
result = READ_LE_INT16(v5 + 4);
return result;
}
@ -206,9 +206,9 @@ int ObjectsManager::getOffsetY(const byte *spriteData, int spriteIndex, bool isS
v3 += READ_LE_UINT32(v3) + 16;
const byte *v5 = v3 + 10;
int result = (int16)READ_LE_UINT16(v5);
int result = READ_LE_INT16(v5);
if (isSize)
result = (int16)READ_LE_UINT16(v5 + 4);
result = READ_LE_INT16(v5 + 4);
return result;
}
@ -221,7 +221,7 @@ int ObjectsManager::getWidth(const byte *objectData, int idx) {
for (int i = idx; i; --i)
rectP += READ_LE_UINT32(rectP) + 16;
return (int16)READ_LE_UINT16(rectP + 4);
return READ_LE_INT16(rectP + 4);
}
/**
@ -232,7 +232,7 @@ int ObjectsManager::getHeight(const byte *objectData, int idx) {
for (int i = idx; i; --i)
rectP += READ_LE_UINT32(rectP) + 16;
return (int16)READ_LE_UINT16(rectP + 6);
return READ_LE_INT16(rectP + 6);
}
void ObjectsManager::sprite_alone(const byte *objectData, byte *sprite, int objIndex) {
@ -242,7 +242,7 @@ void ObjectsManager::sprite_alone(const byte *objectData, byte *sprite, int objI
}
objP += 4;
int result = (int16)READ_LE_UINT16(objP) * (int16)READ_LE_UINT16(objP + 2);
int result = READ_LE_INT16(objP) * READ_LE_INT16(objP + 2);
memcpy(sprite + 3, objP - 4, result + 16);
}
@ -254,7 +254,7 @@ void ObjectsManager::capture_mem_sprite(const byte *objectData, byte *sprite, in
}
objP += 4;
int result = (int16)READ_LE_UINT16(objP) * (int16)READ_LE_UINT16(objP + 2);
int result = READ_LE_INT16(objP) * READ_LE_INT16(objP + 2);
memcpy(sprite, objP + 12, result);
}
@ -582,17 +582,17 @@ void ObjectsManager::BOB_VISU(int idx) {
resetBob(idx);
const byte *data = _vm->_globals.Bqe_Anim[idx]._data;
int bankIdx = (int16)READ_LE_UINT16(data);
int bankIdx = READ_LE_INT16(data);
if (!bankIdx)
return;
if ((!_vm->_globals.Bank[bankIdx]._loadedFl) || (!READ_LE_UINT16(data + 24)))
return;
int16 v9 = (int16)READ_LE_UINT16(data + 2);
int16 v8 = (int16)READ_LE_UINT16(data + 4);
int16 offsetY = (int16)READ_LE_UINT16(data + 6);
int16 v6 = (int16)READ_LE_UINT16(data + 8);
int16 v9 = READ_LE_INT16(data + 2);
int16 v8 = READ_LE_INT16(data + 4);
int16 offsetY = READ_LE_INT16(data + 6);
int16 v6 = READ_LE_INT16(data + 8);
if (!v9)
v9 = 1;
@ -949,15 +949,15 @@ void ObjectsManager::displayBobAnim() {
byte *dataPtr = _bob[idx]._animData + 20;
int dataIdx = _bob[idx]._animDataIdx;
_bob[idx]._xp = (int16)READ_LE_UINT16(dataPtr + 2 * dataIdx);
_bob[idx]._xp = READ_LE_INT16(dataPtr + 2 * dataIdx);
if (_vm->_globals._lockedAnims[idx]._enableFl)
_bob[idx]._xp = _vm->_globals._lockedAnims[idx]._posX;
if ( PERSO_ON && idx > 20 )
_bob[idx]._xp += _vm->_eventsManager._startPos.x;
_bob[idx]._yp = (int16)READ_LE_UINT16(dataPtr + 2 * dataIdx + 2);
_bob[idx].field12 = (int16)READ_LE_UINT16(dataPtr + 2 * dataIdx + 4);
_bob[idx]._zoomFactor = (int16)READ_LE_UINT16(dataPtr + 2 * dataIdx + 6);
_bob[idx]._yp = READ_LE_INT16(dataPtr + 2 * dataIdx + 2);
_bob[idx].field12 = READ_LE_INT16(dataPtr + 2 * dataIdx + 4);
_bob[idx]._zoomFactor = READ_LE_INT16(dataPtr + 2 * dataIdx + 6);
_bob[idx]._frameIndex = dataPtr[2 * dataIdx + 8];
_bob[idx]._flipFl = (dataPtr[2 * dataIdx + 9] != 0);
_bob[idx]._animDataIdx += 5;
@ -983,16 +983,16 @@ void ObjectsManager::displayBobAnim() {
} else {
_bob[idx]._animDataIdx = 0;
byte *v21 = _bob[idx]._animData + 20;
_bob[idx]._xp = (int16)READ_LE_UINT16(v21);
_bob[idx]._xp = READ_LE_INT16(v21);
if (_vm->_globals._lockedAnims[idx]._enableFl)
_bob[idx]._xp = _vm->_globals._lockedAnims[idx]._posX;
if (PERSO_ON && idx > 20)
_bob[idx]._xp += _vm->_eventsManager._startPos.x;
_bob[idx]._yp = (int16)READ_LE_UINT16(v21 + 2);
_bob[idx].field12 = (int16)READ_LE_UINT16(v21 + 4);
_bob[idx]._zoomFactor = (int16)READ_LE_UINT16(v21 + 6);
_bob[idx]._yp = READ_LE_INT16(v21 + 2);
_bob[idx].field12 = READ_LE_INT16(v21 + 4);
_bob[idx]._zoomFactor = READ_LE_INT16(v21 + 6);
_bob[idx]._frameIndex = v21[8];
_bob[idx]._flipFl = (v21[9] != 0);
_bob[idx]._animDataIdx += 5;
@ -1274,10 +1274,6 @@ void ObjectsManager::setFlipSprite(int idx, bool flipFl) {
}
void ObjectsManager::GOHOME() {
int v0 = 0;
int v58 = 0;
int v1 = 0;
if (_vm->_linesManager._route == (RouteItem *)g_PTRNUL)
return;
@ -1288,10 +1284,13 @@ void ObjectsManager::GOHOME() {
int newPosX;
int newPosY;
int newDirection;
Directions newDirection;
int oldPosX = 0;
int oldPosY = 0;
int oldFrameIdx = 0;
_vm->_globals.Compteur = 0;
if (_vm->_globals._oldDirection == -1) {
if (_vm->_globals._oldDirection == DIR_NONE) {
computeAndSetSpriteSize();
newPosX = _vm->_linesManager._route->_X;
newPosY = _vm->_linesManager._route->_Y;
@ -1306,7 +1305,7 @@ void ObjectsManager::GOHOME() {
_oldCharacterPosY = newPosY;
} else {
setSpriteIndex(0, _vm->_globals._oldDirection + 59);
_vm->_globals._actionDirection = 0;
_vm->_globals._actionDirection = DIR_NONE;
int zoneId;
if (_vm->_globals.GOACTION)
zoneId = _vm->_globals._saveData->_data[svField2];
@ -1317,7 +1316,7 @@ void ObjectsManager::GOHOME() {
setFlipSprite(0, false);
_vm->_globals.Compteur = 0;
_vm->_linesManager._route = (RouteItem *)g_PTRNUL;
_vm->_globals._oldDirection = -1;
_vm->_globals._oldDirection = DIR_NONE;
if (zoneId > 0) {
if (_vm->_linesManager.ZONEP[zoneId]._destX && _vm->_linesManager.ZONEP[zoneId]._destY && _vm->_linesManager.ZONEP[zoneId]._destY != 31) {
if (_vm->_linesManager.ZONEP[zoneId]._spriteIndex == -1) {
@ -1334,11 +1333,11 @@ void ObjectsManager::GOHOME() {
_vm->_globals.Compteur = 0;
return;
}
if (_vm->_globals._oldDirection == 3) {
if (_vm->_globals._oldDirection == DIR_RIGHT) {
if (_vm->_globals._oldFrameIndex < 24 || _vm->_globals._oldFrameIndex > 35) {
v0 = _oldCharacterPosX;
v58 = _oldCharacterPosY;
v1 = 24;
oldPosX = _oldCharacterPosX;
oldPosY = _oldCharacterPosY;
oldFrameIdx = 24;
} else {
int deltaX = _vm->_globals.Hopkins[_vm->_globals._oldFrameIndex].field0;
int deltaY = _vm->_globals.Hopkins[_vm->_globals._oldFrameIndex].field2;
@ -1350,19 +1349,19 @@ void ObjectsManager::GOHOME() {
deltaX = _vm->_graphicsManager.zoomIn(deltaX, _sprite[0]._zoomFactor);
deltaY = _vm->_graphicsManager.zoomIn(deltaY, _sprite[0]._zoomFactor);
}
v0 = _oldCharacterPosX + deltaX;
v58 = _oldCharacterPosY + deltaY;
v1 = _vm->_globals._oldFrameIndex + 1;
if (v1 > 35)
v1 = 24;
oldPosX = _oldCharacterPosX + deltaX;
oldPosY = _oldCharacterPosY + deltaY;
oldFrameIdx = _vm->_globals._oldFrameIndex + 1;
if (oldFrameIdx > 35)
oldFrameIdx = 24;
}
_vm->_globals.Compteur = 5 / _vm->_globals._speed;
}
if (_vm->_globals._oldDirection == 7) {
if (_vm->_globals._oldDirection == DIR_LEFT) {
if (_vm->_globals._oldFrameIndex < 24 || _vm->_globals._oldFrameIndex > 35) {
v0 = _oldCharacterPosX;
v58 = _oldCharacterPosY;
v1 = 24;
oldPosX = _oldCharacterPosX;
oldPosY = _oldCharacterPosY;
oldFrameIdx = 24;
} else {
int deltaX = _vm->_globals.Hopkins[_vm->_globals._oldFrameIndex].field0;
int deltaY = _vm->_globals.Hopkins[_vm->_globals._oldFrameIndex].field2;
@ -1373,19 +1372,19 @@ void ObjectsManager::GOHOME() {
deltaX = _vm->_graphicsManager.zoomIn(deltaX, _sprite[0]._zoomFactor);
deltaY = _vm->_graphicsManager.zoomIn(deltaY, _sprite[0]._zoomFactor);
}
v0 = _oldCharacterPosX - deltaX;
v58 = _oldCharacterPosY - deltaY;
v1 = _vm->_globals._oldFrameIndex + 1;
if (v1 > 35)
v1 = 24;
oldPosX = _oldCharacterPosX - deltaX;
oldPosY = _oldCharacterPosY - deltaY;
oldFrameIdx = _vm->_globals._oldFrameIndex + 1;
if (oldFrameIdx > 35)
oldFrameIdx = 24;
}
_vm->_globals.Compteur = 5 / _vm->_globals._speed;
}
if (_vm->_globals._oldDirection == 1) {
if (_vm->_globals._oldDirection == DIR_UP) {
if (_vm->_globals._oldFrameIndex > 11) {
v0 = _oldCharacterPosX;
v58 = _oldCharacterPosY;
v1 = 0;
oldPosX = _oldCharacterPosX;
oldPosY = _oldCharacterPosY;
oldFrameIdx = 0;
} else {
int deltaY = abs(_vm->_globals.Hopkins[_vm->_globals._oldFrameIndex].field2);
if (_sprite[0]._zoomFactor < 0) {
@ -1393,20 +1392,20 @@ void ObjectsManager::GOHOME() {
} else if (_sprite[0]._zoomFactor > 0) {
deltaY = _vm->_graphicsManager.zoomIn(deltaY, _sprite[0]._zoomFactor);
}
v0 = _oldCharacterPosX;
v58 = _oldCharacterPosY - deltaY;
v1 = _vm->_globals._oldFrameIndex + 1;
if (v1 > 11)
v1 = 0;
oldPosX = _oldCharacterPosX;
oldPosY = _oldCharacterPosY - deltaY;
oldFrameIdx = _vm->_globals._oldFrameIndex + 1;
if (oldFrameIdx > 11)
oldFrameIdx = 0;
}
_vm->_globals.Compteur = 4 / _vm->_globals._speed;
}
if (_vm->_globals._oldDirection == 5) {
if (_vm->_globals._oldDirection == DIR_DOWN) {
if (_vm->_globals._oldFrameIndex < 48 || _vm->_globals._oldFrameIndex > 59) {
v0 = _oldCharacterPosX;
v58 = _oldCharacterPosY;
v1 = 48;
oldPosX = _oldCharacterPosX;
oldPosY = _oldCharacterPosY;
oldFrameIdx = 48;
} else {
int deltaY = abs(_vm->_globals.Hopkins[_vm->_globals._oldFrameIndex].field2);
if (_sprite[0]._zoomFactor < 0) {
@ -1414,19 +1413,19 @@ void ObjectsManager::GOHOME() {
} else if (_sprite[0]._zoomFactor > 0) {
deltaY = _vm->_graphicsManager.zoomIn(deltaY, _sprite[0]._zoomFactor);
}
v0 = _oldCharacterPosX;
v58 = deltaY + _oldCharacterPosY;
v1 = _vm->_globals._oldFrameIndex + 1;
if (v1 > 59)
v1 = 48;
oldPosX = _oldCharacterPosX;
oldPosY = deltaY + _oldCharacterPosY;
oldFrameIdx = _vm->_globals._oldFrameIndex + 1;
if (oldFrameIdx > 59)
oldFrameIdx = 48;
}
_vm->_globals.Compteur = 4 / _vm->_globals._speed;
}
if (_vm->_globals._oldDirection == 2) {
if (_vm->_globals._oldDirection == DIR_UP_RIGHT) {
if (_vm->_globals._oldFrameIndex < 12 || _vm->_globals._oldFrameIndex > 23) {
v0 = _oldCharacterPosX;
v58 = _oldCharacterPosY;
v1 = 12;
oldPosX = _oldCharacterPosX;
oldPosY = _oldCharacterPosY;
oldFrameIdx = 12;
} else {
int deltaX = _vm->_globals.Hopkins[_vm->_globals._oldFrameIndex].field0;
int deltaY = _vm->_globals.Hopkins[_vm->_globals._oldFrameIndex].field2;
@ -1438,19 +1437,19 @@ void ObjectsManager::GOHOME() {
deltaX = _vm->_graphicsManager.zoomIn(deltaX, _sprite[0]._zoomFactor);
deltaY = _vm->_graphicsManager.zoomIn(deltaY, _sprite[0]._zoomFactor);
}
v0 = deltaX + _oldCharacterPosX;
v58 = _oldCharacterPosY + deltaY;
v1 = _vm->_globals._oldFrameIndex + 1;
if (v1 > 23)
v1 = 12;
oldPosX = deltaX + _oldCharacterPosX;
oldPosY = _oldCharacterPosY + deltaY;
oldFrameIdx = _vm->_globals._oldFrameIndex + 1;
if (oldFrameIdx > 23)
oldFrameIdx = 12;
}
_vm->_globals.Compteur = 5 / _vm->_globals._speed;
}
if (_vm->_globals._oldDirection == 8) {
if (_vm->_globals._oldDirection == DIR_UP_LEFT) {
if (_vm->_globals._oldFrameIndex < 12 || _vm->_globals._oldFrameIndex > 23) {
v0 = _oldCharacterPosX;
v58 = _oldCharacterPosY;
v1 = 12;
oldPosX = _oldCharacterPosX;
oldPosY = _oldCharacterPosY;
oldFrameIdx = 12;
} else {
int deltaX = _vm->_globals.Hopkins[_vm->_globals._oldFrameIndex].field0;
int deltaY = _vm->_globals.Hopkins[_vm->_globals._oldFrameIndex].field2;
@ -1461,19 +1460,19 @@ void ObjectsManager::GOHOME() {
deltaX = _vm->_graphicsManager.zoomIn(deltaX, _sprite[0]._zoomFactor);
deltaY = _vm->_graphicsManager.zoomIn(deltaY, _sprite[0]._zoomFactor);
}
v0 = _oldCharacterPosX - deltaX;
v58 = _oldCharacterPosY + deltaY;
v1 = _vm->_globals._oldFrameIndex + 1;
if (v1 > 23)
v1 = 12;
oldPosX = _oldCharacterPosX - deltaX;
oldPosY = _oldCharacterPosY + deltaY;
oldFrameIdx = _vm->_globals._oldFrameIndex + 1;
if (oldFrameIdx > 23)
oldFrameIdx = 12;
}
_vm->_globals.Compteur = 5 / _vm->_globals._speed;
}
if (_vm->_globals._oldDirection == 4) {
if (_vm->_globals._oldDirection == DIR_DOWN_RIGHT) {
if (_vm->_globals._oldFrameIndex < 36 || _vm->_globals._oldFrameIndex > 47) {
v0 = _oldCharacterPosX;
v58 = _oldCharacterPosY;
v1 = 36;
oldPosX = _oldCharacterPosX;
oldPosY = _oldCharacterPosY;
oldFrameIdx = 36;
} else {
int deltaX = _vm->_globals.Hopkins[_vm->_globals._oldFrameIndex].field0;
int deltaY = _vm->_globals.Hopkins[_vm->_globals._oldFrameIndex].field2;
@ -1485,19 +1484,19 @@ void ObjectsManager::GOHOME() {
deltaX = _vm->_graphicsManager.zoomIn(deltaX, _sprite[0]._zoomFactor);
deltaY = _vm->_graphicsManager.zoomIn(deltaY, _sprite[0]._zoomFactor);
}
v0 = deltaX + _oldCharacterPosX;
v58 = _oldCharacterPosY + deltaY;
v1 = _vm->_globals._oldFrameIndex + 1;
if (v1 > 47)
v1 = 36;
oldPosX = deltaX + _oldCharacterPosX;
oldPosY = _oldCharacterPosY + deltaY;
oldFrameIdx = _vm->_globals._oldFrameIndex + 1;
if (oldFrameIdx > 47)
oldFrameIdx = 36;
}
_vm->_globals.Compteur = 5 / _vm->_globals._speed;
}
if (_vm->_globals._oldDirection == 6) {
if (_vm->_globals._oldDirection == DIR_DOWN_LEFT) {
if (_vm->_globals._oldFrameIndex < 36 || _vm->_globals._oldFrameIndex > 47) {
v0 = _oldCharacterPosX;
v58 = _oldCharacterPosY;
v1 = 36;
oldPosX = _oldCharacterPosX;
oldPosY = _oldCharacterPosY;
oldFrameIdx = 36;
} else {
int deltaX = _vm->_globals.Hopkins[_vm->_globals._oldFrameIndex].field0;
int deltaY = _vm->_globals.Hopkins[_vm->_globals._oldFrameIndex].field2;
@ -1509,11 +1508,11 @@ void ObjectsManager::GOHOME() {
deltaX = _vm->_graphicsManager.zoomIn(deltaX, _sprite[0]._zoomFactor);
deltaY = _vm->_graphicsManager.zoomIn(deltaY, _sprite[0]._zoomFactor);
}
v0 = _oldCharacterPosX - deltaX;
v58 = _oldCharacterPosY + deltaY;
v1 = _vm->_globals._oldFrameIndex + 1;
if (v1 > 47)
v1 = 36;
oldPosX = _oldCharacterPosX - deltaX;
oldPosY = _oldCharacterPosY + deltaY;
oldFrameIdx = _vm->_globals._oldFrameIndex + 1;
if (oldFrameIdx > 47)
oldFrameIdx = 36;
}
_vm->_globals.Compteur = 5 / _vm->_globals._speed;
}
@ -1521,7 +1520,7 @@ void ObjectsManager::GOHOME() {
do {
newPosX = _vm->_linesManager._route->_X;
newPosY = _vm->_linesManager._route->_Y;
newDirection = _vm->_linesManager._route->_dir;
newDirection = (Directions)_vm->_linesManager._route->_dir;
_vm->_linesManager._route++;
if (newPosX == -1 && newPosY == -1) {
@ -1531,12 +1530,12 @@ void ObjectsManager::GOHOME() {
else
zoneId = _zoneNum;
setSpriteIndex(0, _vm->_globals._oldDirection + 59);
_vm->_globals._actionDirection = 0;
_vm->_globals._actionDirection = DIR_NONE;
_vm->_linesManager._route = (RouteItem *)g_PTRNUL;
computeAndSetSpriteSize();
setFlipSprite(0, false);
_vm->_globals.Compteur = 0;
_vm->_globals._oldDirection = -1;
_vm->_globals._oldDirection = DIR_NONE;
_oldCharacterPosX = getSpriteX(0);
_oldCharacterPosY = getSpriteY(0);
@ -1557,36 +1556,36 @@ void ObjectsManager::GOHOME() {
}
if (_vm->_globals._oldDirection != newDirection)
break;
if ((newDirection == 3 && newPosX >= v0) || (_vm->_globals._oldDirection == 7 && newPosX <= v0) ||
(_vm->_globals._oldDirection == 1 && newPosY <= v58) || (_vm->_globals._oldDirection == 5 && newPosY >= v58) ||
(_vm->_globals._oldDirection == 2 && newPosX >= v0) || (_vm->_globals._oldDirection == 8 && newPosX <= v0) ||
(_vm->_globals._oldDirection == 4 && newPosX >= v0) || (_vm->_globals._oldDirection == 6 && newPosX <= v0))
if ((newDirection == DIR_RIGHT && newPosX >= oldPosX) || (_vm->_globals._oldDirection == DIR_LEFT && newPosX <= oldPosX) ||
(_vm->_globals._oldDirection == DIR_UP && newPosY <= oldPosY) || (_vm->_globals._oldDirection == DIR_DOWN && newPosY >= oldPosY) ||
(_vm->_globals._oldDirection == DIR_UP_RIGHT && newPosX >= oldPosX) || (_vm->_globals._oldDirection == DIR_UP_LEFT && newPosX <= oldPosX) ||
(_vm->_globals._oldDirection == DIR_DOWN_RIGHT && newPosX >= oldPosX) || (_vm->_globals._oldDirection == DIR_DOWN_LEFT && newPosX <= oldPosX))
loopCond = true;
} while (!loopCond);
if (loopCond) {
computeAndSetSpriteSize();
if ((_vm->_globals._oldDirection == 6) || (_vm->_globals._oldDirection == 7) || (_vm->_globals._oldDirection == 8))
if ((_vm->_globals._oldDirection == DIR_DOWN_LEFT) || (_vm->_globals._oldDirection == DIR_LEFT) || (_vm->_globals._oldDirection == DIR_UP_LEFT))
setFlipSprite(0, true);
if ((_vm->_globals._oldDirection == 1) || (_vm->_globals._oldDirection == 2) || (_vm->_globals._oldDirection == 3) ||
(_vm->_globals._oldDirection == 4) || (_vm->_globals._oldDirection == 5))
if ((_vm->_globals._oldDirection == DIR_UP) || (_vm->_globals._oldDirection == DIR_UP_RIGHT) || (_vm->_globals._oldDirection == DIR_RIGHT) ||
(_vm->_globals._oldDirection == DIR_DOWN_RIGHT) || (_vm->_globals._oldDirection == DIR_DOWN))
setFlipSprite(0, false);
setSpriteX(0, newPosX);
setSpriteY(0, newPosY);
setSpriteIndex(0, v1);
setSpriteIndex(0, oldFrameIdx);
} else {
if ((_vm->_globals._oldDirection == 6) || (_vm->_globals._oldDirection == 7) || (_vm->_globals._oldDirection == 8))
if ((_vm->_globals._oldDirection == DIR_DOWN_LEFT) || (_vm->_globals._oldDirection == DIR_LEFT) || (_vm->_globals._oldDirection == DIR_UP_LEFT))
setFlipSprite(0, true);
if ((_vm->_globals._oldDirection == 1) || (_vm->_globals._oldDirection == 2) || (_vm->_globals._oldDirection == 3) ||
(_vm->_globals._oldDirection == 4) || (_vm->_globals._oldDirection == 5))
if ((_vm->_globals._oldDirection == DIR_UP) || (_vm->_globals._oldDirection == DIR_UP_RIGHT) || (_vm->_globals._oldDirection == DIR_RIGHT) ||
(_vm->_globals._oldDirection == DIR_DOWN_RIGHT) || (_vm->_globals._oldDirection == DIR_DOWN))
setFlipSprite(0, false);
_vm->_globals.Compteur = 0;
}
_vm->_globals._oldDirection = newDirection;
_vm->_globals._oldDirectionSpriteIdx = newDirection + 59;
_vm->_globals._oldFrameIndex = v1;
_vm->_globals._oldFrameIndex = oldFrameIdx;
_oldCharacterPosX = newPosX;
_oldCharacterPosY = newPosY;
}
@ -1595,48 +1594,61 @@ void ObjectsManager::GOHOME2() {
if (_vm->_linesManager._route == (RouteItem *)g_PTRNUL)
return;
int v0 = 2;
int realSpeed = 2;
if (_vm->_globals._speed == 2)
v0 = 4;
realSpeed = 4;
else if (_vm->_globals._speed == 3)
v0 = 6;
realSpeed = 6;
_vm->_globals.j_104 = 0;
int countColisionPixel = 0;
for (;;) {
int nexPosX = _vm->_linesManager._route->_X;
int newPosY = _vm->_linesManager._route->_Y;
int newDirection = _vm->_linesManager._route->_dir;
Directions newDirection = (Directions)_vm->_linesManager._route->_dir;
_vm->_linesManager._route++;
if ((nexPosX == -1) && (newPosY == -1))
break;
++_vm->_globals.j_104;
if (_vm->_globals.j_104 >= v0) {
++countColisionPixel;
if (countColisionPixel >= realSpeed) {
_vm->_globals._lastDirection = newDirection;
setSpriteX(0, nexPosX);
setSpriteY(0, newPosY);
if (_vm->_globals._lastDirection == 1)
switch (_vm->_globals._lastDirection) {
case DIR_UP:
setSpriteIndex(0, 4);
else if (_vm->_globals._lastDirection == 3)
break;
case DIR_RIGHT:
setSpriteIndex(0, 5);
else if (_vm->_globals._lastDirection == 5)
break;
case DIR_DOWN:
setSpriteIndex(0, 6);
else if (_vm->_globals._lastDirection == 7)
break;
case DIR_LEFT:
setSpriteIndex(0, 7);
break;
}
return;
}
}
if (_vm->_globals._lastDirection == 1)
switch (_vm->_globals._lastDirection) {
case DIR_UP:
setSpriteIndex(0, 0);
else if (_vm->_globals._lastDirection == 3)
break;
case DIR_RIGHT:
setSpriteIndex(0, 1);
else if (_vm->_globals._lastDirection == 5)
break;
case DIR_DOWN:
setSpriteIndex(0, 2);
else if (_vm->_globals._lastDirection == 7)
break;
case DIR_LEFT:
setSpriteIndex(0, 3);
break;
}
_vm->_linesManager._route = (RouteItem *)g_PTRNUL;
}
@ -1672,7 +1684,7 @@ void ObjectsManager::loadZone(const Common::String &file) {
int zoneLineIdx = 0;
int bobZoneIdx;
do {
bobZoneIdx = (int16)READ_LE_UINT16((uint16 *)ptr + bufId);
bobZoneIdx = READ_LE_INT16((uint16 *)ptr + bufId);
if (bobZoneIdx != -1) {
_vm->_linesManager.addZoneLine(
zoneLineIdx,
@ -1688,9 +1700,9 @@ void ObjectsManager::loadZone(const Common::String &file) {
} while (bobZoneIdx != -1);
for (int i = 1; i <= 100; i++) {
_vm->_linesManager.ZONEP[i]._destX = (int16)READ_LE_UINT16((uint16 *)ptr + bufId);
_vm->_linesManager.ZONEP[i]._destY = (int16)READ_LE_UINT16((uint16 *)ptr + bufId + 1);
_vm->_linesManager.ZONEP[i]._spriteIndex = (int16)READ_LE_UINT16((uint16 *)ptr + bufId + 2);
_vm->_linesManager.ZONEP[i]._destX = READ_LE_INT16((uint16 *)ptr + bufId);
_vm->_linesManager.ZONEP[i]._destY = READ_LE_INT16((uint16 *)ptr + bufId + 1);
_vm->_linesManager.ZONEP[i]._spriteIndex = READ_LE_INT16((uint16 *)ptr + bufId + 2);
bufId += 3;
}
@ -1894,12 +1906,12 @@ void ObjectsManager::handleLeftButton() {
if (getSpriteY(0) > 374 && getSpriteY(0) <= 410) {
_vm->_linesManager._route = (RouteItem *)g_PTRNUL;
setSpriteIndex(0, _vm->_globals._oldDirectionSpriteIdx);
_vm->_globals._actionDirection = 0;
_vm->_globals._actionDirection = DIR_NONE;
_vm->_linesManager._route = (RouteItem *)g_PTRNUL;
computeAndSetSpriteSize();
setFlipSprite(0, false);
_vm->_globals.Compteur = 0;
_vm->_globals._oldDirection = -1;
_vm->_globals._oldDirection = DIR_NONE;
} else {
_vm->_linesManager._route = _vm->_linesManager.PARCOURS2(getSpriteX(0), getSpriteY(0), getSpriteX(0), 390);
if (_vm->_linesManager._route != (RouteItem *)g_PTRNUL)
@ -1908,7 +1920,7 @@ void ObjectsManager::handleLeftButton() {
_oldCharacterPosY = getSpriteY(0);
_vm->_globals.Compteur = 0;
if (_vm->_linesManager._route != (RouteItem *)g_PTRNUL || oldRoute == _vm->_linesManager._route) {
_vm->_globals._oldDirection = -1;
_vm->_globals._oldDirection = DIR_NONE;
} else {
_vm->_linesManager._route = oldRoute;
}
@ -1922,7 +1934,7 @@ void ObjectsManager::handleLeftButton() {
_oldCharacterPosY = getSpriteY(0);
_vm->_globals.Compteur = 0;
if (_vm->_linesManager._route != (RouteItem *)g_PTRNUL || oldRoute == _vm->_linesManager._route)
_vm->_globals._oldDirection = -1;
_vm->_globals._oldDirection = DIR_NONE;
else
_vm->_linesManager._route = oldRoute;
}
@ -2077,7 +2089,7 @@ void ObjectsManager::clearScreen() {
_forceZoneFl = true;
_changeVerbFl = false;
_vm->_linesManager._route = (RouteItem *)g_PTRNUL;
_vm->_globals._oldDirection = -1;
_vm->_globals._oldDirection = DIR_NONE;
_vm->_graphicsManager.RESET_SEGMENT_VESA();
}
@ -2423,16 +2435,16 @@ void ObjectsManager::initBorder(int zoneIdx) {
if (!zoneIdx)
_vm->_eventsManager._mouseCursorId = 0;
else if (zoneIdx == 32)
_vm->_eventsManager._mouseCursorId = 16;
else if (zoneIdx == 30)
_vm->_eventsManager._mouseCursorId = 2;
else if (zoneIdx == 31)
_vm->_eventsManager._mouseCursorId = 3;
else if (zoneIdx >= 1 && zoneIdx <= 28)
_vm->_eventsManager._mouseCursorId = 8;
else if (zoneIdx == 29)
_vm->_eventsManager._mouseCursorId = 1;
else if (zoneIdx == 30)
_vm->_eventsManager._mouseCursorId = 2;
else if (zoneIdx == 31)
_vm->_eventsManager._mouseCursorId = 3;
else if (zoneIdx == 32)
_vm->_eventsManager._mouseCursorId = 16;
if (zoneIdx >= 1 && zoneIdx <= 28 && !_vm->_globals._inventory[zoneIdx]) {
_vm->_eventsManager._mouseCursorId = 0;
@ -2554,7 +2566,7 @@ void ObjectsManager::OPTI_OBJET() {
if (opcodeType == 1 || opcodeType == 4)
++lastOpcodeResult;
if (!opcodeType || opcodeType == 5)
else if (!opcodeType || opcodeType == 5)
break;
}
@ -2695,8 +2707,8 @@ void ObjectsManager::BOB_VIVANT(int idx) {
if (!READ_LE_UINT16(_vm->_talkManager._characterAnim + startPos + 4))
return;
int xp = (int16)READ_LE_UINT16(_vm->_talkManager._characterAnim + startPos);
int yp = (int16)READ_LE_UINT16(_vm->_talkManager._characterAnim + startPos + 2);
int xp = READ_LE_INT16(_vm->_talkManager._characterAnim + startPos);
int yp = READ_LE_INT16(_vm->_talkManager._characterAnim + startPos + 2);
int spriteIndex = _vm->_talkManager._characterAnim[startPos + 8];
_vm->_graphicsManager.fastDisplay(_vm->_talkManager._characterSprite, xp, yp, spriteIndex);
@ -3054,7 +3066,7 @@ void ObjectsManager::INILINK(const Common::String &file) {
}
if (!OBSSEUL) {
for (int idx = 0; idx < 500; ++idx)
_vm->_globals._spriteSize[idx] = (int16)READ_LE_UINT16((uint16 *)ptr + idx);
_vm->_globals._spriteSize[idx] = READ_LE_INT16((uint16 *)ptr + idx);
_vm->_globals.resetCache();
@ -3071,11 +3083,11 @@ void ObjectsManager::INILINK(const Common::String &file) {
int curDataCacheId = 60;
byte *curDataPtr = ptr + 1000;
for (int cacheIdx = 0; cacheIdx <= 21; cacheIdx++) {
int curSpriteId = (int16)READ_LE_UINT16(curDataPtr + 2 * curDataCacheId);
int curSpriteId = READ_LE_INT16(curDataPtr + 2 * curDataCacheId);
_vm->_globals.Cache[cacheIdx]._spriteIndex = curSpriteId;
_vm->_globals.Cache[cacheIdx]._x = (int16)READ_LE_UINT16(curDataPtr + 2 * curDataCacheId + 2);
_vm->_globals.Cache[cacheIdx]._y = (int16)READ_LE_UINT16(curDataPtr + 2 * curDataCacheId + 4);
_vm->_globals.Cache[cacheIdx].field14 = (int16)READ_LE_UINT16(curDataPtr + 2 * curDataCacheId + 8);
_vm->_globals.Cache[cacheIdx]._x = READ_LE_INT16(curDataPtr + 2 * curDataCacheId + 2);
_vm->_globals.Cache[cacheIdx]._y = READ_LE_INT16(curDataPtr + 2 * curDataCacheId + 4);
_vm->_globals.Cache[cacheIdx].field14 = READ_LE_INT16(curDataPtr + 2 * curDataCacheId + 8);
if (!_vm->_globals.CACHE_BANQUE[1]) {
_vm->_globals.Cache[cacheIdx]._useCount = 0;
@ -3102,21 +3114,21 @@ void ObjectsManager::INILINK(const Common::String &file) {
int lineDataIdx = 0;
int curLineIdx = 0;
_vm->_linesManager.resetLinesNumb();
int curDirection;
Directions curDirection;
do {
curDirection = (int16)READ_LE_UINT16(curDataPtr + 2 * lineDataIdx);
if (curDirection != -1) {
curDirection = (Directions)READ_LE_INT16(curDataPtr + 2 * lineDataIdx);
if (curDirection != DIR_NONE) {
_vm->_linesManager.addLine(
curLineIdx,
curDirection,
(int16)READ_LE_UINT16(curDataPtr + 2 * lineDataIdx + 2),
(int16)READ_LE_UINT16(curDataPtr + 2 * lineDataIdx + 4),
(int16)READ_LE_UINT16(curDataPtr + 2 * lineDataIdx + 6),
(int16)READ_LE_UINT16(curDataPtr + 2 * lineDataIdx + 8));
READ_LE_INT16(curDataPtr + 2 * lineDataIdx + 2),
READ_LE_INT16(curDataPtr + 2 * lineDataIdx + 4),
READ_LE_INT16(curDataPtr + 2 * lineDataIdx + 6),
READ_LE_INT16(curDataPtr + 2 * lineDataIdx + 8));
}
lineDataIdx += 5;
++curLineIdx;
} while (curDirection != -1);
} while (curDirection != DIR_NONE);
_vm->_linesManager.initRoute();
}
}
@ -3146,14 +3158,14 @@ void ObjectsManager::INILINK(const Common::String &file) {
int curLineIdx = 0;
int v28;
do {
v28 = (int16)READ_LE_UINT16(curDataPtr + 2 * curDataIdx);
v28 = READ_LE_INT16(curDataPtr + 2 * curDataIdx);
if (v28 != -1) {
_vm->_linesManager.addZoneLine(
curLineIdx,
(int16)READ_LE_UINT16(curDataPtr + 2 * curDataIdx + 2),
(int16)READ_LE_UINT16(curDataPtr + 2 * curDataIdx + 4),
(int16)READ_LE_UINT16(curDataPtr + 2 * curDataIdx + 6),
(int16)READ_LE_UINT16(curDataPtr + 2 * curDataIdx + 8),
READ_LE_INT16(curDataPtr + 2 * curDataIdx + 2),
READ_LE_INT16(curDataPtr + 2 * curDataIdx + 4),
READ_LE_INT16(curDataPtr + 2 * curDataIdx + 6),
READ_LE_INT16(curDataPtr + 2 * curDataIdx + 8),
v28);
_vm->_linesManager.ZONEP[v28]._enabledFl = true;
}
@ -3161,9 +3173,9 @@ void ObjectsManager::INILINK(const Common::String &file) {
++curLineIdx;
} while (v28 != -1);
for (int i = 1; i <= 100; i++) {
_vm->_linesManager.ZONEP[i]._destX = (int16)READ_LE_UINT16(curDataPtr + 2 * curDataIdx);
_vm->_linesManager.ZONEP[i]._destY = (int16)READ_LE_UINT16(curDataPtr + 2 * curDataIdx + 2);
_vm->_linesManager.ZONEP[i]._spriteIndex = (int16)READ_LE_UINT16(curDataPtr + 2 * curDataIdx + 4);
_vm->_linesManager.ZONEP[i]._destX = READ_LE_INT16(curDataPtr + 2 * curDataIdx);
_vm->_linesManager.ZONEP[i]._destY = READ_LE_INT16(curDataPtr + 2 * curDataIdx + 2);
_vm->_linesManager.ZONEP[i]._spriteIndex = READ_LE_INT16(curDataPtr + 2 * curDataIdx + 4);
curDataIdx += 3;
}
@ -3183,7 +3195,7 @@ void ObjectsManager::INILINK(const Common::String &file) {
}
int dep = 1010;
for (int i = 1; i <= 100; i++) {
_vm->_linesManager.ZONEP[i].field12 = (int16)READ_LE_UINT16(v22 + dep);
_vm->_linesManager.ZONEP[i].field12 = READ_LE_INT16(v22 + dep);
dep += 2;
}
_vm->_linesManager.CARRE_ZONE();
@ -3706,7 +3718,7 @@ void ObjectsManager::PERSONAGE(const Common::String &backgroundFile, const Commo
stopBobAnimation(3);
_vm->_globals.NOT_VERIF = true;
_oldCharacterPosX = getSpriteX(0);
_vm->_globals._oldDirection = -1;
_vm->_globals._oldDirection = DIR_NONE;
_vm->_globals.Compteur = 0;
_vm->_linesManager._route = (RouteItem *)g_PTRNUL;
_vm->_linesManager._route = _vm->_linesManager.PARCOURS2(getSpriteX(0), getSpriteY(0), 330, 345);
@ -3823,7 +3835,7 @@ void ObjectsManager::PERSONAGE2(const Common::String &backgroundFile, const Comm
_vm->_eventsManager._mouseSpriteId = 4;
_oldCharacterPosX = _characterPos.x;
_oldCharacterPosY = _characterPos.y;
_vm->_globals._oldDirection = -1;
_vm->_globals._oldDirection = DIR_NONE;
_vm->_globals.Compteur = 0;
for (int idx = 0; idx < 5; ++idx)

View file

@ -54,7 +54,7 @@ int ScriptManager::handleOpcode(byte *dataP) {
switch (signature24) {
case MKTAG24('T', 'X', 'T'): {
vbobFrameIndex = dataP[6];
int mesgId = (int16)READ_LE_UINT16(dataP + 13);
int mesgId = READ_LE_INT16(dataP + 13);
opcodeType = 1;
if (!TRAVAILOBJET) {
if (_vm->_globals._saveData->_data[svField356] == 1) {
@ -133,8 +133,8 @@ int ScriptManager::handleOpcode(byte *dataP) {
} while (_vm->_soundManager._soundFl);
}
if (!_vm->_soundManager._textOffFl) {
int textPosX = (int16)READ_LE_UINT16(dataP + 9);
int textPosY = (int16)READ_LE_UINT16(dataP + 11);
int textPosX = READ_LE_INT16(dataP + 9);
int textPosY = READ_LE_INT16(dataP + 11);
_vm->_fontManager.initTextBuffers(9, mesgId, _vm->_globals.FICH_TEXTE, 2 * textPosX, 2 * textPosY + 40, 6, dataP[7], 253);
if (!_vm->_soundManager._textOffFl)
_vm->_fontManager.showText(9);
@ -149,7 +149,7 @@ int ScriptManager::handleOpcode(byte *dataP) {
if (!_vm->_soundManager._voiceOffFl)
_vm->_soundManager.mixVoice(635, 4);
} else {
int textPosX = (int16)READ_LE_UINT16(dataP + 9);
int textPosX = READ_LE_INT16(dataP + 9);
if (_vm->_globals._language == LANG_FR && !_vm->_soundManager._textOffFl)
_vm->_fontManager.initTextBuffers(9, mesgId, "OBJET1.TXT", 2 * textPosX, 60, 6, dataP[7], 253);
else if (_vm->_globals._language == LANG_EN && !_vm->_soundManager._textOffFl)
@ -172,10 +172,10 @@ int ScriptManager::handleOpcode(byte *dataP) {
int vbobIdx = dataP[5];
vbobFrameIndex = dataP[6];
int v4 = dataP[7];
int vbobPosX = (int16)READ_LE_UINT16(dataP + 8);
int vbobPosY = (int16)READ_LE_UINT16(dataP + 10);
int vbobPosX = READ_LE_INT16(dataP + 8);
int vbobPosY = READ_LE_INT16(dataP + 10);
if (vbobIdx == 52) {
_vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, vbobPosX, (int16)READ_LE_UINT16(dataP + 10), vbobFrameIndex);
_vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, vbobPosX, READ_LE_INT16(dataP + 10), vbobFrameIndex);
} else if (vbobIdx == 51) {
_vm->_objectsManager.BOB_VIVANT(vbobFrameIndex);
} else if (vbobIdx != 50) {
@ -198,8 +198,8 @@ int ScriptManager::handleOpcode(byte *dataP) {
case MKTAG24('S', 'T', 'P'):
if (!_vm->_objectsManager._disableFl) {
_vm->_objectsManager._twoCharactersFl = false;
_vm->_objectsManager._characterPos.x = (int16)READ_LE_UINT16(dataP + 6);
_vm->_objectsManager._characterPos.y = (int16)READ_LE_UINT16(dataP + 8);
_vm->_objectsManager._characterPos.x = READ_LE_INT16(dataP + 6);
_vm->_objectsManager._characterPos.y = READ_LE_INT16(dataP + 8);
_vm->_objectsManager._startSpriteIndex = dataP[5];
if (_vm->_objectsManager._changeHeadFl) {
if (_vm->_globals._saveData->_data[svField354] == 1
@ -266,183 +266,183 @@ int ScriptManager::handleOpcode(byte *dataP) {
break;
case MKTAG24('B', 'O', 'F'):
if (!_vm->_objectsManager._disableFl)
_vm->_objectsManager.VBOB_OFF((int16)READ_LE_UINT16(dataP + 5));
_vm->_objectsManager.VBOB_OFF(READ_LE_INT16(dataP + 5));
opcodeType = 1;
break;
case MKTAG24('P', 'E', 'R'): {
int specialOpcode = (int16)READ_LE_UINT16(dataP + 5);
int specialOpcode = READ_LE_INT16(dataP + 5);
if (!_vm->_globals._saveData->_data[svField122] && !_vm->_globals._saveData->_data[svField356]) {
vbobFrameIndex = 0;
switch (specialOpcode) {
case 1:
case 14:
if (_vm->_globals._actionDirection == 1)
if (_vm->_globals._actionDirection == DIR_UP)
_vm->_objectsManager.doActionBack(4);
if (_vm->_globals._actionDirection == 3)
if (_vm->_globals._actionDirection == DIR_RIGHT)
_vm->_objectsManager.doActionRight(4);
if (_vm->_globals._actionDirection == 2)
if (_vm->_globals._actionDirection == DIR_UP_RIGHT)
_vm->_objectsManager.doActionDiagRight(4);
if (_vm->_globals._actionDirection == 5)
if (_vm->_globals._actionDirection == DIR_DOWN)
_vm->_objectsManager.doActionFront(4);
if (_vm->_globals._actionDirection == 8)
if (_vm->_globals._actionDirection == DIR_UP_LEFT)
_vm->_objectsManager.doActionDiagLeft(4);
if (_vm->_globals._actionDirection == 7)
if (_vm->_globals._actionDirection == DIR_LEFT)
_vm->_objectsManager.doActionLeft(4);
break;
case 2:
if (_vm->_globals._actionDirection == 1)
if (_vm->_globals._actionDirection == DIR_UP)
_vm->_objectsManager.doActionBack(7);
if (_vm->_globals._actionDirection == 3)
if (_vm->_globals._actionDirection == DIR_RIGHT)
_vm->_objectsManager.doActionRight(7);
if (_vm->_globals._actionDirection == 2)
if (_vm->_globals._actionDirection == DIR_UP_RIGHT)
_vm->_objectsManager.doActionDiagRight(7);
if (_vm->_globals._actionDirection == 5)
if (_vm->_globals._actionDirection == DIR_DOWN)
_vm->_objectsManager.doActionFront(7);
if (_vm->_globals._actionDirection == 8)
if (_vm->_globals._actionDirection == DIR_UP_LEFT)
_vm->_objectsManager.doActionDiagLeft(7);
if (_vm->_globals._actionDirection == 7)
if (_vm->_globals._actionDirection == DIR_LEFT)
_vm->_objectsManager.doActionLeft(7);
if (_vm->_globals._actionDirection == 1)
if (_vm->_globals._actionDirection == DIR_UP)
_vm->_objectsManager.doActionBack(8);
if (_vm->_globals._actionDirection == 3)
if (_vm->_globals._actionDirection == DIR_RIGHT)
_vm->_objectsManager.doActionRight(8);
if (_vm->_globals._actionDirection == 2)
if (_vm->_globals._actionDirection == DIR_UP_RIGHT)
_vm->_objectsManager.doActionDiagRight(8);
if (_vm->_globals._actionDirection == 5)
if (_vm->_globals._actionDirection == DIR_DOWN)
_vm->_objectsManager.doActionFront(8);
if (_vm->_globals._actionDirection == 8)
if (_vm->_globals._actionDirection == DIR_UP_LEFT)
_vm->_objectsManager.doActionDiagLeft(8);
if (_vm->_globals._actionDirection == 7)
if (_vm->_globals._actionDirection == DIR_LEFT)
_vm->_objectsManager.doActionLeft(8);
break;
case 19:
case 4:
if (_vm->_globals._actionDirection == 1)
if (_vm->_globals._actionDirection == DIR_UP)
_vm->_objectsManager.doActionBack(1);
if (_vm->_globals._actionDirection == 3)
if (_vm->_globals._actionDirection == DIR_RIGHT)
_vm->_objectsManager.doActionRight(1);
if (_vm->_globals._actionDirection == 2)
if (_vm->_globals._actionDirection == DIR_UP_RIGHT)
_vm->_objectsManager.doActionDiagRight(1);
if (_vm->_globals._actionDirection == 5)
if (_vm->_globals._actionDirection == DIR_DOWN)
_vm->_objectsManager.doActionFront(1);
if (_vm->_globals._actionDirection == 8)
if (_vm->_globals._actionDirection == DIR_UP_LEFT)
_vm->_objectsManager.doActionDiagLeft(1);
if (_vm->_globals._actionDirection == 7)
if (_vm->_globals._actionDirection == DIR_LEFT)
_vm->_objectsManager.doActionLeft(1);
break;
case 5:
if (_vm->_globals._actionDirection == 1)
if (_vm->_globals._actionDirection == DIR_UP)
_vm->_objectsManager.doActionBack(5);
if (_vm->_globals._actionDirection == 3)
if (_vm->_globals._actionDirection == DIR_RIGHT)
_vm->_objectsManager.doActionRight(5);
if (_vm->_globals._actionDirection == 2)
if (_vm->_globals._actionDirection == DIR_UP_RIGHT)
_vm->_objectsManager.doActionDiagRight(5);
if (_vm->_globals._actionDirection == 5)
if (_vm->_globals._actionDirection == DIR_DOWN)
_vm->_objectsManager.doActionFront(5);
if (_vm->_globals._actionDirection == 8)
if (_vm->_globals._actionDirection == DIR_UP_LEFT)
_vm->_objectsManager.doActionDiagLeft(5);
if (_vm->_globals._actionDirection == 7)
if (_vm->_globals._actionDirection == DIR_LEFT)
_vm->_objectsManager.doActionLeft(5);
if (_vm->_globals._actionDirection == 1)
if (_vm->_globals._actionDirection == DIR_UP)
_vm->_objectsManager.doActionBack(6);
if (_vm->_globals._actionDirection == 3)
if (_vm->_globals._actionDirection == DIR_RIGHT)
_vm->_objectsManager.doActionRight(6);
if (_vm->_globals._actionDirection == 2)
if (_vm->_globals._actionDirection == DIR_UP_RIGHT)
_vm->_objectsManager.doActionDiagRight(6);
if (_vm->_globals._actionDirection == 5)
if (_vm->_globals._actionDirection == DIR_DOWN)
_vm->_objectsManager.doActionFront(6);
if (_vm->_globals._actionDirection == 8)
if (_vm->_globals._actionDirection == DIR_UP_LEFT)
_vm->_objectsManager.doActionDiagLeft(6);
if (_vm->_globals._actionDirection == 7)
if (_vm->_globals._actionDirection == DIR_LEFT)
_vm->_objectsManager.doActionLeft(6);
break;
case 17:
case 7:
if (_vm->_globals._actionDirection == 1)
if (_vm->_globals._actionDirection == DIR_UP)
_vm->_objectsManager.doActionBack(2);
if (_vm->_globals._actionDirection == 3)
if (_vm->_globals._actionDirection == DIR_RIGHT)
_vm->_objectsManager.doActionRight(2);
if (_vm->_globals._actionDirection == 2)
if (_vm->_globals._actionDirection == DIR_UP_RIGHT)
_vm->_objectsManager.doActionDiagRight(2);
if (_vm->_globals._actionDirection == 5)
if (_vm->_globals._actionDirection == DIR_DOWN)
_vm->_objectsManager.doActionFront(2);
if (_vm->_globals._actionDirection == 8)
if (_vm->_globals._actionDirection == DIR_UP_LEFT)
_vm->_objectsManager.doActionDiagLeft(2);
if (_vm->_globals._actionDirection == 7)
if (_vm->_globals._actionDirection == DIR_LEFT)
_vm->_objectsManager.doActionLeft(2);
break;
case 18:
case 8:
if (_vm->_globals._actionDirection == 1)
if (_vm->_globals._actionDirection == DIR_UP)
_vm->_objectsManager.doActionBack(3);
if (_vm->_globals._actionDirection == 3)
if (_vm->_globals._actionDirection == DIR_RIGHT)
_vm->_objectsManager.doActionRight(3);
if (_vm->_globals._actionDirection == 2)
if (_vm->_globals._actionDirection == DIR_UP_RIGHT)
_vm->_objectsManager.doActionDiagRight(3);
if (_vm->_globals._actionDirection == 5)
if (_vm->_globals._actionDirection == DIR_DOWN)
_vm->_objectsManager.doActionFront(3);
if (_vm->_globals._actionDirection == 8)
if (_vm->_globals._actionDirection == DIR_UP_LEFT)
_vm->_objectsManager.doActionDiagLeft(3);
if (_vm->_globals._actionDirection == 7)
if (_vm->_globals._actionDirection == DIR_LEFT)
_vm->_objectsManager.doActionLeft(3);
break;
case 9:
if (_vm->_globals._actionDirection == 1)
if (_vm->_globals._actionDirection == DIR_UP)
_vm->_objectsManager.doActionBack(5);
if (_vm->_globals._actionDirection == 3)
if (_vm->_globals._actionDirection == DIR_RIGHT)
_vm->_objectsManager.doActionRight(5);
if (_vm->_globals._actionDirection == 2)
if (_vm->_globals._actionDirection == DIR_UP_RIGHT)
_vm->_objectsManager.doActionDiagRight(5);
if (_vm->_globals._actionDirection == 5)
if (_vm->_globals._actionDirection == DIR_DOWN)
_vm->_objectsManager.doActionFront(5);
if (_vm->_globals._actionDirection == 8)
if (_vm->_globals._actionDirection == DIR_UP_LEFT)
_vm->_objectsManager.doActionDiagLeft(5);
if (_vm->_globals._actionDirection == 7)
if (_vm->_globals._actionDirection == DIR_LEFT)
_vm->_objectsManager.doActionLeft(5);
break;
case 10:
if (_vm->_globals._actionDirection == 1)
if (_vm->_globals._actionDirection == DIR_UP)
_vm->_objectsManager.doActionBack(6);
if (_vm->_globals._actionDirection == 3)
if (_vm->_globals._actionDirection == DIR_RIGHT)
_vm->_objectsManager.doActionRight(6);
if (_vm->_globals._actionDirection == 2)
if (_vm->_globals._actionDirection == DIR_UP_RIGHT)
_vm->_objectsManager.doActionDiagRight(6);
if (_vm->_globals._actionDirection == 5)
if (_vm->_globals._actionDirection == DIR_DOWN)
_vm->_objectsManager.doActionFront(6);
if (_vm->_globals._actionDirection == 8)
if (_vm->_globals._actionDirection == DIR_UP_LEFT)
_vm->_objectsManager.doActionDiagLeft(6);
if (_vm->_globals._actionDirection == 7)
if (_vm->_globals._actionDirection == DIR_LEFT)
_vm->_objectsManager.doActionLeft(6);
break;
case 15:
case 11:
if (_vm->_globals._actionDirection == 1)
if (_vm->_globals._actionDirection == DIR_UP)
_vm->_objectsManager.doActionBack(7);
if (_vm->_globals._actionDirection == 3)
if (_vm->_globals._actionDirection == DIR_RIGHT)
_vm->_objectsManager.doActionRight(7);
if (_vm->_globals._actionDirection == 2)
if (_vm->_globals._actionDirection == DIR_UP_RIGHT)
_vm->_objectsManager.doActionDiagRight(7);
if (_vm->_globals._actionDirection == 5)
if (_vm->_globals._actionDirection == DIR_DOWN)
_vm->_objectsManager.doActionFront(7);
if (_vm->_globals._actionDirection == 8)
if (_vm->_globals._actionDirection == DIR_UP_LEFT)
_vm->_objectsManager.doActionDiagLeft(7);
if (_vm->_globals._actionDirection == 7)
if (_vm->_globals._actionDirection == DIR_LEFT)
_vm->_objectsManager.doActionLeft(7);
break;
case 16:
case 12:
if (_vm->_globals._actionDirection == 1)
if (_vm->_globals._actionDirection == DIR_UP)
_vm->_objectsManager.doActionBack(8);
if (_vm->_globals._actionDirection == 3)
if (_vm->_globals._actionDirection == DIR_RIGHT)
_vm->_objectsManager.doActionRight(8);
if (_vm->_globals._actionDirection == 2)
if (_vm->_globals._actionDirection == DIR_UP_RIGHT)
_vm->_objectsManager.doActionDiagRight(8);
if (_vm->_globals._actionDirection == 5)
if (_vm->_globals._actionDirection == DIR_DOWN)
_vm->_objectsManager.doActionFront(8);
if (_vm->_globals._actionDirection == 8)
if (_vm->_globals._actionDirection == DIR_UP_LEFT)
_vm->_objectsManager.doActionDiagLeft(8);
if (_vm->_globals._actionDirection == 7)
if (_vm->_globals._actionDirection == DIR_LEFT)
_vm->_objectsManager.doActionLeft(8);
break;
}
@ -468,36 +468,36 @@ int ScriptManager::handleOpcode(byte *dataP) {
}
case MKTAG24('O', 'B', 'P'):
opcodeType = 1;
_vm->_objectsManager.addObject((int16)READ_LE_UINT16(dataP + 5));
_vm->_objectsManager.addObject(READ_LE_INT16(dataP + 5));
break;
case MKTAG24('O', 'B', 'M'):
opcodeType = 1;
_vm->_objectsManager.removeObject((int16)READ_LE_UINT16(dataP + 5));
_vm->_objectsManager.removeObject(READ_LE_INT16(dataP + 5));
break;
case MKTAG24('G', 'O', 'T'):
opcodeType = 2;
break;
case MKTAG24('Z', 'O', 'N'):
_vm->_linesManager.enableZone((int16)READ_LE_UINT16(dataP + 5));
_vm->_linesManager.enableZone(READ_LE_INT16(dataP + 5));
opcodeType = 1;
break;
case MKTAG24('Z', 'O', 'F'):
_vm->_linesManager.disableZone((int16)READ_LE_UINT16(dataP + 5));
_vm->_linesManager.disableZone(READ_LE_INT16(dataP + 5));
opcodeType = 1;
break;
case MKTAG24('E', 'X', 'I'):
opcodeType = 5;
break;
case MKTAG24('S', 'O', 'R'):
_vm->_globals._exitId = (int16)READ_LE_UINT16(dataP + 5);
_vm->_globals._exitId = READ_LE_INT16(dataP + 5);
opcodeType = 5;
break;
case MKTAG24('B', 'C', 'A'):
_vm->_globals.B_CACHE_OFF((int16)READ_LE_UINT16(dataP + 5));
_vm->_globals.B_CACHE_OFF(READ_LE_INT16(dataP + 5));
opcodeType = 1;
break;
case MKTAG24('A', 'N', 'I'): {
int animId = (int16)READ_LE_UINT16(dataP + 5);
int animId = READ_LE_INT16(dataP + 5);
if (animId <= 100)
_vm->_objectsManager.setBobAnimation(animId);
else
@ -506,7 +506,7 @@ int ScriptManager::handleOpcode(byte *dataP) {
break;
}
case MKTAG24('S', 'P', 'E'):
switch ((int16)READ_LE_UINT16(dataP + 5)) {
switch (READ_LE_INT16(dataP + 5)) {
case 6:
_vm->_objectsManager.removeSprite(0);
_vm->_objectsManager.OPTI_ONE(20, 0, 14, 4);
@ -955,7 +955,7 @@ int ScriptManager::handleOpcode(byte *dataP) {
case 59: {
_vm->_globals.NOT_VERIF = true;
_vm->_objectsManager._oldCharacterPosX = _vm->_objectsManager.getSpriteX(0);
_vm->_globals._oldDirection = -1;
_vm->_globals._oldDirection = DIR_NONE;
_vm->_globals.Compteur = 0;
_vm->_linesManager._route = (RouteItem *)g_PTRNUL;
_vm->_linesManager._route = _vm->_linesManager.PARCOURS2(_vm->_objectsManager.getSpriteX(0), _vm->_objectsManager.getSpriteY(0), 445, 332);
@ -1055,7 +1055,7 @@ int ScriptManager::handleOpcode(byte *dataP) {
case 81: {
_vm->_globals.NOT_VERIF = true;
_vm->_objectsManager._oldCharacterPosX = _vm->_objectsManager.getSpriteX(0);
_vm->_globals._oldDirection = -1;
_vm->_globals._oldDirection = DIR_NONE;
_vm->_globals.Compteur = 0;
_vm->_linesManager._route = (RouteItem *)g_PTRNUL;
_vm->_linesManager._route = _vm->_linesManager.PARCOURS2(_vm->_objectsManager.getSpriteX(0), _vm->_objectsManager.getSpriteY(0), 119, 268);
@ -1372,7 +1372,7 @@ int ScriptManager::handleOpcode(byte *dataP) {
case 105:
_vm->_globals.NOT_VERIF = true;
_vm->_objectsManager._oldCharacterPosX = _vm->_objectsManager.getSpriteX(0);
_vm->_globals._oldDirection = -1;
_vm->_globals._oldDirection = DIR_NONE;
_vm->_globals.Compteur = 0;
_vm->_linesManager._route = (RouteItem *)g_PTRNUL;
if (_vm->_globals._saveData->_data[svField253] == 1) {
@ -1619,7 +1619,7 @@ int ScriptManager::handleOpcode(byte *dataP) {
_vm->_globals._introSpeechOffFl = false;
_vm->_globals.NOT_VERIF = true;
_vm->_objectsManager._oldCharacterPosX = _vm->_objectsManager.getSpriteX(0);
_vm->_globals._oldDirection = -1;
_vm->_globals._oldDirection = DIR_NONE;
_vm->_globals.Compteur = 0;
_vm->_globals.NOT_VERIF = true;
_vm->_linesManager._route = (RouteItem *)g_PTRNUL;
@ -1647,7 +1647,7 @@ int ScriptManager::handleOpcode(byte *dataP) {
_vm->_globals._introSpeechOffFl = false;
_vm->_globals.NOT_VERIF = true;
_vm->_objectsManager._oldCharacterPosX = _vm->_objectsManager.getSpriteX(0);
_vm->_globals._oldDirection = -1;
_vm->_globals._oldDirection = DIR_NONE;
_vm->_globals.Compteur = 0;
_vm->_globals.NOT_VERIF = true;
_vm->_linesManager._route = (RouteItem *)g_PTRNUL;
@ -1949,7 +1949,7 @@ int ScriptManager::handleOpcode(byte *dataP) {
_vm->_globals.CACHE_ON();
_vm->_globals.NOT_VERIF = true;
_vm->_objectsManager._oldCharacterPosX = _vm->_objectsManager.getSpriteX(0);
_vm->_globals._oldDirection = -1;
_vm->_globals._oldDirection = DIR_NONE;
_vm->_globals.Compteur = 0;
_vm->_globals.NOT_VERIF = true;
_vm->_linesManager._route = (RouteItem *)g_PTRNUL;
@ -2373,34 +2373,34 @@ int ScriptManager::handleOpcode(byte *dataP) {
break;
case MKTAG24('V', 'A', 'L'): {
opcodeType = 1;
int idx = (int16)READ_LE_UINT16(dataP + 5);
int idx = READ_LE_INT16(dataP + 5);
assert(idx >= 0 && idx < 2050);
_vm->_globals._saveData->_data[idx] = dataP[7];
break;
}
case MKTAG24('A', 'D', 'D'):
opcodeType = 1;
_vm->_globals._saveData->_data[(int16)READ_LE_UINT16(dataP + 5)] += dataP[7];
_vm->_globals._saveData->_data[READ_LE_INT16(dataP + 5)] += dataP[7];
break;
case MKTAG24('B', 'O', 'S'):
opcodeType = 1;
_vm->_objectsManager.BOB_OFFSET((int16)READ_LE_UINT16(dataP + 5), (int16)READ_LE_UINT16(dataP + 7));
_vm->_objectsManager.BOB_OFFSET(READ_LE_INT16(dataP + 5), READ_LE_INT16(dataP + 7));
break;
case MKTAG24('V', 'O', 'N'):
_vm->_objectsManager.enableVerb((int16)READ_LE_UINT16(dataP + 5), (int16)READ_LE_UINT16(dataP + 7));
_vm->_objectsManager.enableVerb(READ_LE_INT16(dataP + 5), READ_LE_INT16(dataP + 7));
opcodeType = 1;
break;
case MKTAG24('Z', 'C', 'H'):
_vm->_linesManager.ZONEP[(int16)READ_LE_UINT16(dataP + 5)].field12 = (int16)READ_LE_UINT16(dataP + 7);
_vm->_linesManager.ZONEP[READ_LE_INT16(dataP + 5)].field12 = READ_LE_INT16(dataP + 7);
opcodeType = 1;
break;
case MKTAG24('J', 'U', 'M'):
_vm->_objectsManager._jumpZone = (int16)READ_LE_UINT16(dataP + 5);
_vm->_objectsManager._jumpVerb = (int16)READ_LE_UINT16(dataP + 7);
_vm->_objectsManager._jumpZone = READ_LE_INT16(dataP + 5);
_vm->_objectsManager._jumpVerb = READ_LE_INT16(dataP + 7);
opcodeType = 6;
break;
case MKTAG24('S', 'O', 'U'): {
int soundNum = (int16)READ_LE_UINT16(dataP + 5);
int soundNum = READ_LE_INT16(dataP + 5);
Common::String file = Common::String::format("SOUND%d.WAV", soundNum);
_vm->_soundManager.playSound(file);
@ -2408,7 +2408,7 @@ int ScriptManager::handleOpcode(byte *dataP) {
break;
}
case MKTAG24('V', 'O', 'F'):
_vm->_objectsManager.disableVerb((int16)READ_LE_UINT16(dataP + 5), (int16)READ_LE_UINT16(dataP + 7));
_vm->_objectsManager.disableVerb(READ_LE_INT16(dataP + 5), READ_LE_INT16(dataP + 7));
opcodeType = 1;
break;
case MKTAG24('I', 'I', 'F'):
@ -2424,7 +2424,7 @@ int ScriptManager::handleOpcode(byte *dataP) {
int ScriptManager::handleGoto(const byte *dataP) {
return (int16)READ_LE_UINT16(dataP + 5);
return READ_LE_INT16(dataP + 5);
}
int ScriptManager::handleIf(const byte *dataP, int a2) {
@ -2468,8 +2468,8 @@ int ScriptManager::handleIf(const byte *dataP, int a2) {
byte oper = buf[13];
byte oper2 = buf[14];
byte operType = buf[15];
int saveDataIdx1 = (int16)READ_LE_UINT16(buf + 5);
int compVal1 = (int16)READ_LE_UINT16(buf + 7);
int saveDataIdx1 = READ_LE_INT16(buf + 5);
int compVal1 = READ_LE_INT16(buf + 7);
bool check1Fl = false;
if ((oper == 1 && _vm->_globals._saveData->_data[saveDataIdx1] == compVal1) ||
(oper == 2 && _vm->_globals._saveData->_data[saveDataIdx1] != compVal1) ||
@ -2481,8 +2481,8 @@ int ScriptManager::handleIf(const byte *dataP, int a2) {
bool check2Fl = false;
if (operType != 3) {
int saveDataIdx2 = (int16)READ_LE_UINT16(buf + 9);
int compVal2 = (int16)READ_LE_UINT16(buf + 11);
int saveDataIdx2 = READ_LE_INT16(buf + 9);
int compVal2 = READ_LE_INT16(buf + 11);
if ((oper2 == 1 && compVal2 == _vm->_globals._saveData->_data[saveDataIdx2]) ||
(oper2 == 2 && compVal2 != _vm->_globals._saveData->_data[saveDataIdx2]) ||
(oper2 == 3 && compVal2 >= _vm->_globals._saveData->_data[saveDataIdx2]) ||

View file

@ -361,7 +361,7 @@ void SoundManager::WSOUND_OFF() {
stopVoice(0);
stopVoice(1);
stopVoice(2);
if (_vm->_soundManager._soundFl)
if (_soundFl)
delWav(_currentSoundIndex);
for (int i = 1; i <= 48; ++i)
@ -583,7 +583,7 @@ bool SoundManager::mixVoice(int voiceId, int voiceMode) {
oldMusicVol = _musicVolume;
if (!_musicOffFl && _musicVolume > 2) {
_musicVolume = (signed int)((long double)_musicVolume - (long double)_musicVolume / 100.0 * 45.0);
_vm->_soundManager.MODSetMusicVolume(_vm->_soundManager._musicVolume);
MODSetMusicVolume(_musicVolume);
}
playVoice();
@ -611,7 +611,7 @@ bool SoundManager::mixVoice(int voiceId, int voiceMode) {
// Speech is over, set the music volume back to normal
_musicVolume = oldMusicVol;
if (!_musicOffFl && _musicVolume > 2) {
_vm->_soundManager.MODSetMusicVolume(_vm->_soundManager._musicVolume);
MODSetMusicVolume(_musicVolume);
}
_vm->_eventsManager._escKeyFl = false;
_skipRefreshFl = false;

View file

@ -75,8 +75,8 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) {
} else if (_vm->_globals._language == LANG_SP) {
_answersFilename = _questionsFilename = "RUEES.TXT";
}
_dialogueMesgId1 = (int16)READ_LE_UINT16((uint16 *)_characterBuffer + 40);
_paletteBufferIdx = 20 * (int16)READ_LE_UINT16((uint16 *)_characterBuffer + 42) + 110;
_dialogueMesgId1 = READ_LE_INT16((uint16 *)_characterBuffer + 40);
_paletteBufferIdx = 20 * READ_LE_INT16((uint16 *)_characterBuffer + 42) + 110;
_characterSprite = _vm->_fileManager.searchCat(spriteFilename, 7);
if (_characterSprite) {
_characterSprite = _vm->_objectsManager.loadSprite(spriteFilename);
@ -182,8 +182,8 @@ void TalkManager::PARLER_PERSO2(const Common::String &filename) {
break;
}
_dialogueMesgId1 = (int16)READ_LE_UINT16((uint16 *)_characterBuffer + 40);
_paletteBufferIdx = 20 * (int16)READ_LE_UINT16((uint16 *)_characterBuffer + 42) + 110;
_dialogueMesgId1 = READ_LE_INT16((uint16 *)_characterBuffer + 40);
_paletteBufferIdx = 20 * READ_LE_INT16((uint16 *)_characterBuffer + 42) + 110;
searchCharacterPalette(_paletteBufferIdx, false);
_dialogueMesgId2 = _dialogueMesgId1 + 1;
_dialogueMesgId3 = _dialogueMesgId1 + 2;
@ -228,17 +228,17 @@ void TalkManager::getStringFromBuffer(int srcStart, Common::String &dest, const
int TalkManager::dialogQuestion(bool animatedFl) {
if (animatedFl) {
uint16 *bufPtr = (uint16 *)_characterBuffer + 48;
int curVal = (int16)READ_LE_UINT16(bufPtr);
int curVal = READ_LE_INT16(bufPtr);
if (curVal != 0)
_vm->_objectsManager.setBobAnimation(curVal);
if (curVal != 1)
_vm->_objectsManager.setBobAnimation((int16)READ_LE_UINT16(bufPtr + 1));
_vm->_objectsManager.setBobAnimation(READ_LE_INT16(bufPtr + 1));
if (curVal != 2)
_vm->_objectsManager.setBobAnimation((int16)READ_LE_UINT16(bufPtr + 2));
_vm->_objectsManager.setBobAnimation(READ_LE_INT16(bufPtr + 2));
if (curVal != 3)
_vm->_objectsManager.setBobAnimation((int16)READ_LE_UINT16(bufPtr + 3));
_vm->_objectsManager.setBobAnimation(READ_LE_INT16(bufPtr + 3));
if (curVal != 4)
_vm->_objectsManager.setBobAnimation((int16)READ_LE_UINT16(bufPtr + 4));
_vm->_objectsManager.setBobAnimation(READ_LE_INT16(bufPtr + 4));
} else {
dialogWait();
}
@ -299,23 +299,23 @@ int TalkManager::dialogQuestion(bool animatedFl) {
if (animatedFl) {
uint16 *bufPtr = (uint16 *)_characterBuffer + 48;
int curVal = (int16)READ_LE_UINT16(bufPtr);
int curVal = READ_LE_INT16(bufPtr);
if (curVal != 0)
_vm->_objectsManager.stopBobAnimation(curVal);
curVal = (int16)READ_LE_UINT16(bufPtr + 1);
curVal = READ_LE_INT16(bufPtr + 1);
if (curVal != 1)
_vm->_objectsManager.stopBobAnimation(curVal);
curVal = (int16)READ_LE_UINT16(bufPtr + 2);
curVal = READ_LE_INT16(bufPtr + 2);
if (curVal != 2)
_vm->_objectsManager.stopBobAnimation(curVal);
curVal = (int16)READ_LE_UINT16(bufPtr + 3);
curVal = READ_LE_INT16(bufPtr + 3);
if (curVal != 3)
_vm->_objectsManager.stopBobAnimation(curVal);
curVal = (int16)READ_LE_UINT16(bufPtr + 4);
curVal = READ_LE_INT16(bufPtr + 4);
if (curVal != 4)
_vm->_objectsManager.stopBobAnimation(curVal);
} else {
@ -329,21 +329,21 @@ int TalkManager::dialogQuestion(bool animatedFl) {
int TalkManager::dialogAnswer(int idx, bool animatedFl) {
int charIdx;
byte *charBuf;
for (charBuf = _characterBuffer + 110, charIdx = 0; (int16)READ_LE_UINT16(charBuf) != idx; charBuf += 20) {
for (charBuf = _characterBuffer + 110, charIdx = 0; READ_LE_INT16(charBuf) != idx; charBuf += 20) {
++charIdx;
if ((int16)READ_LE_UINT16((uint16 *)_characterBuffer + 42) < charIdx)
if (READ_LE_INT16((uint16 *)_characterBuffer + 42) < charIdx)
return -1;
}
int mesgId = (int16)READ_LE_UINT16((uint16 *)charBuf + 1);
int mesgPosX = (int16)READ_LE_UINT16((uint16 *)charBuf + 2);
int mesgPosY = (int16)READ_LE_UINT16((uint16 *)charBuf + 3);
int mesgLength = (int16)READ_LE_UINT16((uint16 *)charBuf + 4);
_dialogueMesgId1 = (int16)READ_LE_UINT16((uint16 *)charBuf + 5);
_dialogueMesgId2 = (int16)READ_LE_UINT16((uint16 *)charBuf + 6);
_dialogueMesgId3 = (int16)READ_LE_UINT16((uint16 *)charBuf + 7);
int v6 = (int16)READ_LE_UINT16((uint16 *)charBuf + 8);
int v7 = (int16)READ_LE_UINT16((uint16 *)charBuf + 9);
int mesgId = READ_LE_INT16((uint16 *)charBuf + 1);
int mesgPosX = READ_LE_INT16((uint16 *)charBuf + 2);
int mesgPosY = READ_LE_INT16((uint16 *)charBuf + 3);
int mesgLength = READ_LE_INT16((uint16 *)charBuf + 4);
_dialogueMesgId1 = READ_LE_INT16((uint16 *)charBuf + 5);
_dialogueMesgId2 = READ_LE_INT16((uint16 *)charBuf + 6);
_dialogueMesgId3 = READ_LE_INT16((uint16 *)charBuf + 7);
int v6 = READ_LE_INT16((uint16 *)charBuf + 8);
int v7 = READ_LE_INT16((uint16 *)charBuf + 9);
if (v7)
_vm->_globals._saveData->_data[svField4] = v7;
@ -352,23 +352,23 @@ int TalkManager::dialogAnswer(int idx, bool animatedFl) {
v6 = 10;
if (animatedFl) {
uint16 *bufPtr = (uint16 *)_characterBuffer + 43;
int curVal = (int16)READ_LE_UINT16(bufPtr);
int curVal = READ_LE_INT16(bufPtr);
if (curVal)
_vm->_objectsManager.stopBobAnimation(curVal);
curVal = (int16)READ_LE_UINT16(bufPtr + 1);
curVal = READ_LE_INT16(bufPtr + 1);
if (curVal)
_vm->_objectsManager.stopBobAnimation(curVal);
curVal = (int16)READ_LE_UINT16(bufPtr + 2);
curVal = READ_LE_INT16(bufPtr + 2);
if (curVal)
_vm->_objectsManager.stopBobAnimation(curVal);
curVal = (int16)READ_LE_UINT16(bufPtr + 3);
curVal = READ_LE_INT16(bufPtr + 3);
if (curVal)
_vm->_objectsManager.stopBobAnimation(curVal);
curVal = (int16)READ_LE_UINT16(bufPtr + 4);
curVal = READ_LE_INT16(bufPtr + 4);
if (curVal)
_vm->_objectsManager.stopBobAnimation(curVal);
} else {
@ -402,23 +402,23 @@ int TalkManager::dialogAnswer(int idx, bool animatedFl) {
_vm->_fontManager.hideText(9);
if (animatedFl) {
uint16 *bufPtr = (uint16 *)_characterBuffer + 43;
int curVal = (int16)READ_LE_UINT16(bufPtr);
int curVal = READ_LE_INT16(bufPtr);
if (curVal)
_vm->_objectsManager.stopBobAnimation(curVal);
curVal = (int16)READ_LE_UINT16(bufPtr + 1);
curVal = READ_LE_INT16(bufPtr + 1);
if (curVal)
_vm->_objectsManager.stopBobAnimation(curVal);
curVal = (int16)READ_LE_UINT16(bufPtr + 2);
curVal = READ_LE_INT16(bufPtr + 2);
if (curVal)
_vm->_objectsManager.stopBobAnimation(curVal);
curVal = (int16)READ_LE_UINT16(bufPtr + 3);
curVal = READ_LE_INT16(bufPtr + 3);
if (curVal)
_vm->_objectsManager.stopBobAnimation(curVal);
curVal = (int16)READ_LE_UINT16(bufPtr + 4);
curVal = READ_LE_INT16(bufPtr + 4);
if (curVal)
_vm->_objectsManager.stopBobAnimation(curVal);
} else {
@ -600,10 +600,10 @@ void TalkManager::BOB_VISU_PARLE(int idx) {
if (!_vm->_objectsManager._bob[idx].field0) {
_vm->_objectsManager.resetBob(idx);
byte *v5 = _vm->_globals.Bqe_Anim[idx]._data;
int v4 = (int16)READ_LE_UINT16(v5 + 2);
int v4 = READ_LE_INT16(v5 + 2);
if (!v4)
v4 = 1;
if ((int16)READ_LE_UINT16(v5 + 24)) {
if (READ_LE_INT16(v5 + 24)) {
_vm->_objectsManager._bob[idx]._isSpriteFl = true;
_vm->_objectsManager._bob[idx]._zoomFactor = 0;
_vm->_objectsManager._bob[idx]._flipFl = false;
@ -636,10 +636,10 @@ void TalkManager::startCharacterAnim0(int startIdx, bool readOnlyFl) {
int idx = 0;
int v7;
do {
v7 = (int16)READ_LE_UINT16(&_characterAnim[2 * idx + 4]);
v7 = READ_LE_INT16(&_characterAnim[2 * idx + 4]);
if (v7 && _vm->_globals._speed != 501)
_vm->_graphicsManager.fastDisplay(_characterSprite, _vm->_eventsManager._startPos.x + (int16)READ_LE_UINT16(&_characterAnim[2 * idx]),
(int16)READ_LE_UINT16(&_characterAnim[2 * idx + 2]), _characterAnim[2 * idx + 8]);
_vm->_graphicsManager.fastDisplay(_characterSprite, _vm->_eventsManager._startPos.x + READ_LE_INT16(&_characterAnim[2 * idx]),
READ_LE_INT16(&_characterAnim[2 * idx + 2]), _characterAnim[2 * idx + 8]);
idx += 5;
} while (_vm->_globals._speed != 501 && v7);
}
@ -651,43 +651,43 @@ void TalkManager::startCharacterAnim0(int startIdx, bool readOnlyFl) {
void TalkManager::initCharacterAnim() {
uint16 *bufPtr = (uint16 *)_characterBuffer + 43;
byte *animPtr = _characterBuffer + 110;
int curVal = (int16)READ_LE_UINT16(bufPtr);
int curVal = READ_LE_INT16(bufPtr);
if (curVal)
searchCharacterAnim(21, animPtr, curVal, _characterSize);
curVal = (int16)READ_LE_UINT16(bufPtr + 1);
curVal = READ_LE_INT16(bufPtr + 1);
if (curVal)
searchCharacterAnim(22, animPtr, curVal, _characterSize);
curVal = (int16)READ_LE_UINT16(bufPtr + 2);
curVal = READ_LE_INT16(bufPtr + 2);
if (curVal)
searchCharacterAnim(23, animPtr, curVal, _characterSize);
curVal = (int16)READ_LE_UINT16(bufPtr + 3);
curVal = READ_LE_INT16(bufPtr + 3);
if (curVal)
searchCharacterAnim(24, animPtr, curVal, _characterSize);
curVal = (int16)READ_LE_UINT16(bufPtr + 4);
curVal = READ_LE_INT16(bufPtr + 4);
if (curVal)
searchCharacterAnim(25, animPtr, curVal, _characterSize);
curVal = (int16)READ_LE_UINT16(bufPtr + 5);
curVal = READ_LE_INT16(bufPtr + 5);
if (curVal)
searchCharacterAnim(26, animPtr, curVal, _characterSize);
curVal = (int16)READ_LE_UINT16(bufPtr + 6);
curVal = READ_LE_INT16(bufPtr + 6);
if (curVal)
searchCharacterAnim(27, animPtr, curVal, _characterSize);
curVal = (int16)READ_LE_UINT16(bufPtr + 7);
curVal = READ_LE_INT16(bufPtr + 7);
if (curVal)
searchCharacterAnim(28, animPtr, curVal, _characterSize);
curVal = (int16)READ_LE_UINT16(bufPtr + 8);
curVal = READ_LE_INT16(bufPtr + 8);
if (curVal)
searchCharacterAnim(29, animPtr, curVal, _characterSize);
curVal = (int16)READ_LE_UINT16(bufPtr + 9);
curVal = READ_LE_INT16(bufPtr + 9);
if (curVal)
searchCharacterAnim(30, animPtr, curVal, _characterSize);
}
@ -723,11 +723,11 @@ bool TalkManager::searchCharacterAnim(int idx, const byte *bufPerso, int animId,
_vm->_globals.Bqe_Anim[idx]._data = _vm->_globals.allocMemory(animLength + 50);
_vm->_globals.Bqe_Anim[idx]._enabledFl = true;
memcpy(_vm->_globals.Bqe_Anim[idx]._data, (const byte *)(bufPerso + bufPos + 5), 20);
int v23 = (int16)READ_LE_UINT16(bufPos + bufPerso + 29);
WRITE_LE_UINT16(_vm->_globals.Bqe_Anim[idx]._data + 20, (int16)READ_LE_UINT16(bufPos + bufPerso + 25));
WRITE_LE_UINT16(_vm->_globals.Bqe_Anim[idx]._data + 22, (int16)READ_LE_UINT16(bufPos + bufPerso + 27));
int v23 = READ_LE_INT16(bufPos + bufPerso + 29);
WRITE_LE_UINT16(_vm->_globals.Bqe_Anim[idx]._data + 20, READ_LE_INT16(bufPos + bufPerso + 25));
WRITE_LE_UINT16(_vm->_globals.Bqe_Anim[idx]._data + 22, READ_LE_INT16(bufPos + bufPerso + 27));
WRITE_LE_UINT16(_vm->_globals.Bqe_Anim[idx]._data + 24, v23);
WRITE_LE_UINT16(_vm->_globals.Bqe_Anim[idx]._data + 26, (int16)READ_LE_UINT16(bufPos + bufPerso + 31));
WRITE_LE_UINT16(_vm->_globals.Bqe_Anim[idx]._data + 26, READ_LE_INT16(bufPos + bufPerso + 31));
_vm->_globals.Bqe_Anim[idx]._data[28] = bufPerso[bufPos + 33];
_vm->_globals.Bqe_Anim[idx]._data[29] = bufPerso[bufPos + 34];
byte *bqeCurData = _vm->_globals.Bqe_Anim[idx]._data + 20;
@ -737,11 +737,11 @@ bool TalkManager::searchCharacterAnim(int idx, const byte *bufPerso, int animId,
curBufPerso += 10;
if (!v23)
break;
v23 = (int16)READ_LE_UINT16(curBufPerso + 4);
WRITE_LE_UINT16(bqeCurData, (int16)READ_LE_UINT16(curBufPerso));
WRITE_LE_UINT16(bqeCurData + 2, (int16)READ_LE_UINT16(curBufPerso + 2));
v23 = READ_LE_INT16(curBufPerso + 4);
WRITE_LE_UINT16(bqeCurData, READ_LE_INT16(curBufPerso));
WRITE_LE_UINT16(bqeCurData + 2, READ_LE_INT16(curBufPerso + 2));
WRITE_LE_UINT16(bqeCurData + 4, v23);
WRITE_LE_UINT16(bqeCurData + 6, (int16)READ_LE_UINT16(curBufPerso + 6));
WRITE_LE_UINT16(bqeCurData + 6, READ_LE_INT16(curBufPerso + 6));
bqeCurData[8] = curBufPerso[8];
bqeCurData[9] = curBufPerso[9];
}
@ -1004,7 +1004,7 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) {
if (!_vm->_graphicsManager._lineNbr)
_vm->_graphicsManager._scrollOffset = 0;
_vm->_graphicsManager.NB_SCREEN(true);
_paletteBufferIdx = 20 * (int16)READ_LE_UINT16((uint16 *)_characterBuffer + 42) + 110;
_paletteBufferIdx = 20 * READ_LE_INT16((uint16 *)_characterBuffer + 42) + 110;
_vm->_graphicsManager.NB_SCREEN(true);
_vm->_objectsManager.PERSO_ON = true;
searchCharacterPalette(_paletteBufferIdx, true);