mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-01 00:12:59 +00:00
- Renamed TextDisplayer_v2 to TextDisplayer_HoF
- Moved some character shape code to KyraEngine_v2 svn-id: r31821
This commit is contained in:
parent
2da2fb7f4d
commit
c6830b4138
@ -422,7 +422,7 @@ void KyraEngine_MR::showIdleAnim() {
|
||||
};
|
||||
|
||||
char filename[14];
|
||||
snprintf(filename, 14, "MI0%s%.02d.EMC", facingTable[_mainCharacter.facing], _malcolmShapes);
|
||||
snprintf(filename, 14, "MI0%s%.02d.EMC", facingTable[_mainCharacter.facing], _characterShapeFile);
|
||||
|
||||
if (_res->exists(filename))
|
||||
runTemporaryScript(filename, 1, 1, 1, 1);
|
||||
|
@ -192,7 +192,7 @@ int KyraEngine_HoF::init() {
|
||||
|
||||
_debugger = new Debugger_v2(this);
|
||||
assert(_debugger);
|
||||
_text = new TextDisplayer_v2(this, _screen);
|
||||
_text = new TextDisplayer_HoF(this, _screen);
|
||||
assert(_text);
|
||||
_gui = new GUI_v2(this);
|
||||
assert(_gui);
|
||||
@ -355,8 +355,8 @@ void KyraEngine_HoF::startup() {
|
||||
initItemList(30);
|
||||
loadButtonShapes();
|
||||
resetItemList();
|
||||
_loadedZTable = 1;
|
||||
loadZShapes(_loadedZTable);
|
||||
_characterShapeFile = 1;
|
||||
loadCharacterShapes(_characterShapeFile);
|
||||
initInventoryButtonList();
|
||||
setupLangButtonShapes();
|
||||
loadInventoryShapes();
|
||||
@ -1094,11 +1094,11 @@ void KyraEngine_HoF::loadItemShapes() {
|
||||
_screen->_curPage = 0;
|
||||
}
|
||||
|
||||
void KyraEngine_HoF::loadZShapes(int shapes) {
|
||||
void KyraEngine_HoF::loadCharacterShapes(int shapes) {
|
||||
char file[10];
|
||||
strcpy(file, "_ZX.SHP");
|
||||
|
||||
_loadedZTable = shapes;
|
||||
_characterShapeFile = shapes;
|
||||
file[2] = '0' + shapes;
|
||||
|
||||
uint8 *data = _res->fileData(file, 0);
|
||||
@ -1106,7 +1106,7 @@ void KyraEngine_HoF::loadZShapes(int shapes) {
|
||||
addShapeToPool(data, i, i-9);
|
||||
delete [] data;
|
||||
|
||||
_loadedZTable = shapes;
|
||||
_characterShapeFile = shapes;
|
||||
}
|
||||
|
||||
void KyraEngine_HoF::loadInventoryShapes() {
|
||||
@ -1633,11 +1633,11 @@ void KyraEngine_HoF::showIdleAnim() {
|
||||
zanthRandomIdleChat();
|
||||
} else {
|
||||
scriptAnimation = false;
|
||||
if (_loadedZTable > 8)
|
||||
if (_characterShapeFile > 8)
|
||||
return;
|
||||
|
||||
int scriptMin = scriptMinTable[_loadedZTable-1];
|
||||
int scriptMax = scriptMaxTable[_loadedZTable-1];
|
||||
int scriptMin = scriptMinTable[_characterShapeFile-1];
|
||||
int scriptMax = scriptMaxTable[_characterShapeFile-1];
|
||||
int script = 0;
|
||||
|
||||
if (scriptMin < scriptMax) {
|
||||
|
@ -57,7 +57,6 @@ KyraEngine_MR::KyraEngine_MR(OSystem *system, const GameFlags &flags) : KyraEngi
|
||||
memset(_sceneShapes, 0, sizeof(_sceneShapes));
|
||||
memset(_sceneAnimMovie, 0, sizeof(_sceneAnimMovie));
|
||||
_gfxBackUpRect = 0;
|
||||
_malcolmShapes = 0;
|
||||
_paletteOverlay = 0;
|
||||
_sceneList = 0;
|
||||
memset(&_mainCharacter, 0, sizeof(_mainCharacter));
|
||||
@ -597,7 +596,8 @@ void KyraEngine_MR::startup() {
|
||||
musicUpdate(0);
|
||||
loadExtrasShapes();
|
||||
musicUpdate(0);
|
||||
loadMalcolmShapes(_malcolmShapes);
|
||||
_characterShapeFile = 0;
|
||||
loadCharacterShapes(_characterShapeFile);
|
||||
musicUpdate(0);
|
||||
initMainButtonList(true);
|
||||
loadInterfaceShapes();
|
||||
@ -746,8 +746,8 @@ void KyraEngine_MR::openTalkFile(int file) {
|
||||
|
||||
#pragma mark -
|
||||
|
||||
void KyraEngine_MR::loadMalcolmShapes(int newShapes) {
|
||||
debugC(9, kDebugLevelMain, "KyraEngine_MR::loadMalcolmShapes(%d)", newShapes);
|
||||
void KyraEngine_MR::loadCharacterShapes(int newShapes) {
|
||||
debugC(9, kDebugLevelMain, "KyraEngine_MR::loadCharacterShapes(%d)", newShapes);
|
||||
static const uint8 numberOffset[] = { 3, 3, 4, 4, 3, 3 };
|
||||
static const uint8 startShape[] = { 0x32, 0x58, 0x78, 0x98, 0xB8, 0xD8 };
|
||||
static const uint8 endShape[] = { 0x57, 0x77, 0x97, 0xB7, 0xD7, 0xF7 };
|
||||
@ -788,17 +788,17 @@ void KyraEngine_MR::loadMalcolmShapes(int newShapes) {
|
||||
}
|
||||
}
|
||||
|
||||
_malcolmShapes = newShapes;
|
||||
_characterShapeFile = newShapes;
|
||||
updateMalcolmShapes();
|
||||
}
|
||||
|
||||
void KyraEngine_MR::updateMalcolmShapes() {
|
||||
debugC(9, kDebugLevelMain, "KyraEngine_MR::updateMalcolmShapes()");
|
||||
assert(_malcolmShapes >= 0 && _malcolmShapes < _shapeDescsSize);
|
||||
_malcolmShapeXOffset = _shapeDescs[_malcolmShapes].xOffset;
|
||||
_malcolmShapeYOffset = _shapeDescs[_malcolmShapes].yOffset;
|
||||
_animObjects[0].width = _shapeDescs[_malcolmShapes].width;
|
||||
_animObjects[0].height = _shapeDescs[_malcolmShapes].height;
|
||||
assert(_characterShapeFile >= 0 && _characterShapeFile < _shapeDescsSize);
|
||||
_malcolmShapeXOffset = _shapeDescs[_characterShapeFile].xOffset;
|
||||
_malcolmShapeYOffset = _shapeDescs[_characterShapeFile].yOffset;
|
||||
_animObjects[0].width = _shapeDescs[_characterShapeFile].width;
|
||||
_animObjects[0].height = _shapeDescs[_characterShapeFile].height;
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
@ -913,7 +913,7 @@ void KyraEngine_MR::updateCharAnimFrame(int character, int *table) {
|
||||
void KyraEngine_MR::updateCharPal(int unk1) {
|
||||
debugC(9, kDebugLevelMain, "KyraEngine_MR::updateCharPal(%d)", unk1);
|
||||
int layer = _screen->getLayer(_mainCharacter.x1, _mainCharacter.y1) - 1;
|
||||
const uint8 *src = _costPalBuffer + _malcolmShapes * 72;
|
||||
const uint8 *src = _costPalBuffer + _characterShapeFile * 72;
|
||||
uint8 *dst = _screen->getPalette(0) + 432;
|
||||
const int8 *sceneDatPal = &_sceneDatPalette[layer * 3];
|
||||
|
||||
@ -1552,7 +1552,7 @@ void KyraEngine_MR::changeChapter(int newChapter, int sceneId, int malcolmShapes
|
||||
memset(_newSceneDlgState, 0, sizeof(_newSceneDlgState));
|
||||
|
||||
if (malcolmShapes >= 0)
|
||||
loadMalcolmShapes(malcolmShapes);
|
||||
loadCharacterShapes(malcolmShapes);
|
||||
|
||||
enterNewScene(sceneId, facing, 0, 0, 0);
|
||||
}
|
||||
|
@ -299,8 +299,7 @@ private:
|
||||
// shapes
|
||||
void initMouseShapes();
|
||||
|
||||
int _malcolmShapes;
|
||||
void loadMalcolmShapes(int newShapes);
|
||||
void loadCharacterShapes(int newShapes);
|
||||
void updateMalcolmShapes();
|
||||
|
||||
int _malcolmShapeXOffset, _malcolmShapeYOffset;
|
||||
|
@ -37,6 +37,8 @@ KyraEngine_v2::KyraEngine_v2(OSystem *system, const GameFlags &flags) : KyraEngi
|
||||
|
||||
_itemList = 0;
|
||||
_itemListSize = 0;
|
||||
|
||||
_characterShapeFile = -1;
|
||||
}
|
||||
|
||||
KyraEngine_v2::~KyraEngine_v2() {
|
||||
|
@ -188,6 +188,9 @@ protected:
|
||||
void addShapeToPool(const uint8 *data, int realIndex, int shape);
|
||||
void addShapeToPool(uint8 *shpData, int index);
|
||||
void remShapeFromPool(int idx);
|
||||
|
||||
int _characterShapeFile;
|
||||
virtual void loadCharacterShapes(int shapes) = 0;
|
||||
|
||||
// pathfinder
|
||||
int _movFacingTable[600];
|
||||
|
@ -53,7 +53,7 @@ void KyraEngine_HoF::saveGame(const char *fileName, const char *saveName) {
|
||||
//out->writeUint16BE(word_2AB05);
|
||||
out->writeSint16BE(_lastMusicCommand);
|
||||
out->writeByte(_newChapterFile);
|
||||
out->writeByte(_loadedZTable);
|
||||
out->writeByte(_characterShapeFile);
|
||||
out->writeByte(_cauldronState);
|
||||
out->writeByte(_colorCodeFlag1);
|
||||
out->writeByte(_colorCodeFlag2);
|
||||
@ -152,7 +152,7 @@ void KyraEngine_HoF::loadGame(const char *fileName) {
|
||||
_lastMusicCommand = -1;
|
||||
}
|
||||
|
||||
int loadedZTable = _loadedZTable;
|
||||
int loadedZTable = _characterShapeFile;
|
||||
|
||||
Common::SeekableSubReadStreamEndian in(saveFile, saveFile->pos(), saveFile->size(), !header.originalSave, true);
|
||||
|
||||
@ -172,7 +172,7 @@ void KyraEngine_HoF::loadGame(const char *fileName) {
|
||||
in.readUint16();
|
||||
_lastMusicCommand = in.readSint16();
|
||||
_newChapterFile = in.readByte();
|
||||
_loadedZTable = in.readByte();
|
||||
_characterShapeFile = in.readByte();
|
||||
_cauldronState = in.readByte();
|
||||
_colorCodeFlag1 = in.readByte();
|
||||
_colorCodeFlag2 = in.readByte();
|
||||
@ -286,8 +286,8 @@ void KyraEngine_HoF::loadGame(const char *fileName) {
|
||||
else
|
||||
debugC(1, kDebugLevelMain, "Loaded savegame '%s.'", header.description.c_str());
|
||||
|
||||
if (loadedZTable != _loadedZTable)
|
||||
loadZShapes(_loadedZTable);
|
||||
if (loadedZTable != _characterShapeFile)
|
||||
loadCharacterShapes(_characterShapeFile);
|
||||
|
||||
_screen->loadBitmap("_PLAYFLD.CPS", 3, 3, 0);
|
||||
if (!queryGameFlag(1))
|
||||
|
@ -48,7 +48,7 @@ void KyraEngine_MR::saveGame(const char *fileName, const char *saveName) {
|
||||
|
||||
out->writeSint16BE(_lastMusicCommand);
|
||||
out->writeByte(_currentChapter);
|
||||
out->writeByte(_malcolmShapes);
|
||||
out->writeByte(_characterShapeFile);
|
||||
//XXX
|
||||
out->writeSint16BE(_score);
|
||||
out->writeSint16BE(_scoreMax);
|
||||
@ -142,7 +142,7 @@ void KyraEngine_MR::loadGame(const char *fileName) {
|
||||
if (!_unkSceneScreenFlag1)
|
||||
_lastMusicCommand = -1;
|
||||
|
||||
int curShapes = _malcolmShapes;
|
||||
int curShapes = _characterShapeFile;
|
||||
|
||||
Common::SeekableSubReadStreamEndian in(saveFile, saveFile->pos(), saveFile->size(), !header.originalSave, true);
|
||||
|
||||
@ -157,7 +157,7 @@ void KyraEngine_MR::loadGame(const char *fileName) {
|
||||
// usually we have to save the flag set by opcode 10 here
|
||||
_lastMusicCommand = in.readSint16();
|
||||
_currentChapter = in.readByte();
|
||||
_malcolmShapes = in.readByte();
|
||||
_characterShapeFile = in.readByte();
|
||||
//XXX
|
||||
_score = in.readSint16();
|
||||
_scoreMax = in.readSint16();
|
||||
@ -227,8 +227,8 @@ void KyraEngine_MR::loadGame(const char *fileName) {
|
||||
updateCharacterAnim(0);
|
||||
_loadingState = false;
|
||||
|
||||
if (curShapes != _malcolmShapes)
|
||||
loadMalcolmShapes(_malcolmShapes);
|
||||
if (curShapes != _characterShapeFile)
|
||||
loadCharacterShapes(_characterShapeFile);
|
||||
|
||||
_mainCharX = _mainCharacter.x2 = _mainCharacter.x1;
|
||||
_mainCharY = _mainCharacter.y2 = _mainCharacter.y1;
|
||||
|
@ -350,7 +350,7 @@ void KyraEngine_MR::loadScenePal() {
|
||||
_screen->generateOverlay(_screen->getPalette(2), _paletteOverlay, 0xF0, 0x19);
|
||||
|
||||
uint8 *palette = _screen->getPalette(2) + 432;
|
||||
const uint8 *costPal = _costPalBuffer + _malcolmShapes * 72;
|
||||
const uint8 *costPal = _costPalBuffer + _characterShapeFile * 72;
|
||||
memcpy(palette, costPal, 24*3);
|
||||
}
|
||||
|
||||
|
@ -677,7 +677,7 @@ int KyraEngine_HoF::o2_setCharPalEntry(EMCState *script) {
|
||||
|
||||
int KyraEngine_HoF::o2_loadZShapes(EMCState *script) {
|
||||
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_HoF::o2_loadZShapes(%p) (%d)", (const void *)script, stackPos(0));
|
||||
loadZShapes(stackPos(0));
|
||||
loadCharacterShapes(stackPos(0));
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1318,7 +1318,7 @@ int KyraEngine_HoF::o2_chapterChange(EMCState *script) {
|
||||
|
||||
static const int zShapeList[] = { 1, 2, 2, 2, 4 };
|
||||
assert(chapter > 1 && chapter <= ARRAYSIZE(zShapeList));
|
||||
loadZShapes(zShapeList[chapter-1]);
|
||||
loadCharacterShapes(zShapeList[chapter-1]);
|
||||
|
||||
enterNewScene(scene, (chapter == 2) ? 2 : 0, 0, 0, 0);
|
||||
|
||||
|
@ -37,7 +37,7 @@ namespace Kyra {
|
||||
|
||||
int KyraEngine_MR::o3_getMalcolmShapes(EMCState *script) {
|
||||
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_MR::o3_getMaloclmShapes(%p) ()", (const void *)script);
|
||||
return _malcolmShapes;
|
||||
return _characterShapeFile;
|
||||
}
|
||||
|
||||
int KyraEngine_MR::o3_setCharacterPos(EMCState *script) {
|
||||
@ -478,7 +478,7 @@ int KyraEngine_MR::o3_removeItemsFromScene(EMCState *script) {
|
||||
|
||||
int KyraEngine_MR::o3_disguiseMalcolm(EMCState *script) {
|
||||
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o3_disguiseMalcolm(%p) (%d)", (const void *)script, stackPos(0));
|
||||
loadMalcolmShapes(stackPos(0));
|
||||
loadCharacterShapes(stackPos(0));
|
||||
updateDlgIndex();
|
||||
return 0;
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ void KyraEngine_MR::showBadConscience() {
|
||||
_badConscienceAnim = 6;
|
||||
else if (_currentChapter == 5 && _rnd.getRandomNumberRng(1, 100) <= 25)
|
||||
_badConscienceAnim = 7;
|
||||
else if (_malcolmShapes == 9)
|
||||
else if (_characterShapeFile == 9)
|
||||
_badConscienceAnim = 4;
|
||||
|
||||
_badConsciencePosition = (_mainCharacter.x1 <= 160);
|
||||
@ -250,7 +250,7 @@ void KyraEngine_MR::eelScript() {
|
||||
|
||||
setGameFlag(0x171);
|
||||
|
||||
switch (_malcolmShapes-1) {
|
||||
switch (_characterShapeFile-1) {
|
||||
case 0:
|
||||
runTemporaryScript("EELS01.EMC", 0, 0, 1, 1);
|
||||
break;
|
||||
|
@ -32,19 +32,19 @@
|
||||
|
||||
namespace Kyra {
|
||||
|
||||
TextDisplayer_v2::TextDisplayer_v2(KyraEngine_HoF *vm, Screen_v2 *screen)
|
||||
TextDisplayer_HoF::TextDisplayer_HoF(KyraEngine_HoF *vm, Screen_v2 *screen)
|
||||
: TextDisplayer(vm, screen), _vm(vm) {
|
||||
}
|
||||
|
||||
void TextDisplayer_v2::backupTalkTextMessageBkgd(int srcPage, int dstPage) {
|
||||
void TextDisplayer_HoF::backupTalkTextMessageBkgd(int srcPage, int dstPage) {
|
||||
_screen->copyRegion(_talkCoords.x, _talkMessageY, 0, 144, _talkCoords.w, _talkMessageH, srcPage, dstPage);
|
||||
}
|
||||
|
||||
void TextDisplayer_v2::restoreTalkTextMessageBkgd(int srcPage, int dstPage) {
|
||||
void TextDisplayer_HoF::restoreTalkTextMessageBkgd(int srcPage, int dstPage) {
|
||||
_screen->copyRegion(0, 144, _talkCoords.x, _talkMessageY, _talkCoords.w, _talkMessageH, srcPage, dstPage);
|
||||
}
|
||||
|
||||
void TextDisplayer_v2::restoreScreen() {
|
||||
void TextDisplayer_HoF::restoreScreen() {
|
||||
_vm->restorePage3();
|
||||
_vm->drawAnimObjects();
|
||||
_screen->hideMouse();
|
||||
@ -54,7 +54,7 @@ void TextDisplayer_v2::restoreScreen() {
|
||||
_vm->refreshAnimObjects(0);
|
||||
}
|
||||
|
||||
void TextDisplayer_v2::printCustomCharacterText(const char *text, int x, int y, uint8 c1, int srcPage, int dstPage) {
|
||||
void TextDisplayer_HoF::printCustomCharacterText(const char *text, int x, int y, uint8 c1, int srcPage, int dstPage) {
|
||||
text = preprocessString(text);
|
||||
int lineCount = buildMessageSubstrings(text);
|
||||
int w = getWidestLineWidth(lineCount);
|
||||
@ -86,8 +86,8 @@ void TextDisplayer_v2::printCustomCharacterText(const char *text, int x, int y,
|
||||
_screen->showMouse();
|
||||
}
|
||||
|
||||
char *TextDisplayer_v2::preprocessString(const char *str) {
|
||||
debugC(9, kDebugLevelMain, "TextDisplayer_v2::preprocessString('%s')", str);
|
||||
char *TextDisplayer_HoF::preprocessString(const char *str) {
|
||||
debugC(9, kDebugLevelMain, "TextDisplayer_HoF::preprocessString('%s')", str);
|
||||
|
||||
if (str != _talkBuffer) {
|
||||
assert(strlen(str) < sizeof(_talkBuffer) - 1);
|
||||
@ -129,8 +129,8 @@ char *TextDisplayer_v2::preprocessString(const char *str) {
|
||||
return _talkBuffer;
|
||||
}
|
||||
|
||||
void TextDisplayer_v2::calcWidestLineBounds(int &x1, int &x2, int w, int x) {
|
||||
debugC(9, kDebugLevelMain, "TextDisplayer_v2::calcWidestLineBounds(%d, %d)", w, x);
|
||||
void TextDisplayer_HoF::calcWidestLineBounds(int &x1, int &x2, int w, int x) {
|
||||
debugC(9, kDebugLevelMain, "TextDisplayer_HoF::calcWidestLineBounds(%d, %d)", w, x);
|
||||
x1 = x;
|
||||
x1 -= (w >> 1);
|
||||
x2 = x1 + w + 1;
|
||||
@ -305,7 +305,7 @@ void KyraEngine_HoF::objectChatProcess(const char *script) {
|
||||
while (_emc->isValid(&_chatScriptState))
|
||||
_emc->run(&_chatScriptState);
|
||||
|
||||
_newShapeFilename[2] = _loadedZTable + '0';
|
||||
_newShapeFilename[2] = _characterShapeFile + '0';
|
||||
uint8 *shapeBuffer = _res->fileData(_newShapeFilename, 0);
|
||||
if (shapeBuffer) {
|
||||
int shapeCount = initNewShapes(shapeBuffer);
|
||||
|
@ -33,10 +33,10 @@ namespace Kyra {
|
||||
class Screen_v2;
|
||||
class KyraEngine_HoF;
|
||||
|
||||
class TextDisplayer_v2 : public TextDisplayer {
|
||||
class TextDisplayer_HoF : public TextDisplayer {
|
||||
friend class KyraEngine_HoF;
|
||||
public:
|
||||
TextDisplayer_v2(KyraEngine_HoF *vm, Screen_v2 *screen);
|
||||
TextDisplayer_HoF(KyraEngine_HoF *vm, Screen_v2 *screen);
|
||||
|
||||
void backupTalkTextMessageBkgd(int srcPage, int dstPage);
|
||||
void restoreTalkTextMessageBkgd(int srcPage, int dstPage);
|
||||
|
@ -576,11 +576,11 @@ void KyraEngine_MR::updateDlgIndex() {
|
||||
static const uint8 dlgIndexMoodEvil[] = { 0x06, 0x08, 0x0A, 0x09, 0x0B };
|
||||
|
||||
if (_malcolmsMood == 0)
|
||||
dlgIndex = dlgIndexMoodNice[_malcolmShapes];
|
||||
dlgIndex = dlgIndexMoodNice[_characterShapeFile];
|
||||
else if (_malcolmsMood == 1)
|
||||
dlgIndex = dlgIndexMoodNormal[_malcolmShapes];
|
||||
dlgIndex = dlgIndexMoodNormal[_characterShapeFile];
|
||||
else if (_malcolmsMood == 2)
|
||||
dlgIndex = dlgIndexMoodEvil[_malcolmShapes];
|
||||
dlgIndex = dlgIndexMoodEvil[_characterShapeFile];
|
||||
} else if (_currentChapter == 2) {
|
||||
if (dlgIndex >= 8)
|
||||
dlgIndex -= 4;
|
||||
|
Loading…
x
Reference in New Issue
Block a user