- Implemented opcodes:

-> 12: o2_setCharacterFacing
  -> 14: o2_moveCharacter
  -> 61: o2_loadZShapes
  -> 83: o2_setPathfinderFlag
  -> 90: o2_setSceneAnimPos
  -> 160: o2_updateTwoSceneAnims
- Implemented dino riding sequence
- Fixed bug in KyraEngine_v2::initSceneScreen which caused some gfx glitches

svn-id: r31183
This commit is contained in:
Johannes Schickel 2008-03-18 17:00:26 +00:00
parent 2af4fc1034
commit 83390027c2
5 changed files with 98 additions and 13 deletions

View File

@ -174,7 +174,7 @@ void KyraEngine_v2::refreshAnimObjects(int force) {
height -= height + y - 144;
_screen->hideMouse();
_screen->copyRegion(x, y, x, y, width, height, 2, 0, Screen::CR_CLIPPED);
_screen->copyRegion(x, y, x, y, width, height, 2, 0, Screen::CR_CLIPPED | Screen::CR_NO_P_CHECK);
_screen->showMouse();
curObject->needRefresh = false;

View File

@ -397,10 +397,10 @@ void KyraEngine_v2::runLoop() {
if (_system->getMillis() > _nextIdleAnim)
showIdleAnim();
//if (queryGameFlag(0x159) {
// sub_C86A();
// resetGameFlag(0x159);
//}
if (queryGameFlag(0x159)) {
dinoRide();
resetGameFlag(0x159);
}
if (queryGameFlag(0x124) && !queryGameFlag(0x125)) {
_mainCharacter.animFrame = 32;
@ -2134,6 +2134,43 @@ void KyraEngine_v2::listItemsInCauldron() {
#pragma mark -
void KyraEngine_v2::dinoRide() {
_mainCharX = _mainCharY = -1;
setGameFlag(0x15A);
enterNewScene(41, -1, 0, 0, 0);
resetGameFlag(0x15A);
setGameFlag(0x15B);
enterNewScene(39, -1, 0, 0, 0);
resetGameFlag(0x15B);
setGameFlag(0x16F);
setGameFlag(0x15C);
enterNewScene(42, -1, 0, 0, 0);
resetGameFlag(0x15C);
setGameFlag(0x15D);
enterNewScene(39, -1, 0, 0, 0);
resetGameFlag(0x15D);
setGameFlag(0x15E);
enterNewScene(40, -1, 0, 0, 0);
resetGameFlag(0x15E);
_mainCharX = 262;
_mainCharY = 28;
_mainCharacter.facing = 5;
_mainCharacter.animFrame = _characterFrameTable[5];
enterNewScene(39, 4, 0, 0, 0);
setHandItem(0x61);
_screen->showMouse();
resetGameFlag(0x159);
}
#pragma mark -
void KyraEngine_v2::registerDefaultSettings() {
KyraEngine::registerDefaultSettings();

View File

@ -307,6 +307,8 @@ protected:
void updateMouse();
void dinoRide();
struct Button;
int checkInput(Button *buttonList, bool mainLoop = false);
void removeInputTop();
@ -961,7 +963,9 @@ protected:
int o2_getCharacterScene(ScriptState *script);
int o2_setSceneComment(ScriptState *script);
int o2_setCharacterAnimFrame(ScriptState *script);
int o2_setCharacterFacing(ScriptState *script);
int o2_trySceneChange(ScriptState *script);
int o2_moveCharacter(ScriptState *script);
int o2_customCharacterChat(ScriptState *script);
int o2_soundFadeOut(ScriptState *script);
int o2_showChapterMessage(ScriptState *script);
@ -1000,6 +1004,7 @@ protected:
int o2_setScaleTableItem(ScriptState *script);
int o2_setDrawLayerTableItem(ScriptState *script);
int o2_setCharPalEntry(ScriptState *script);
int o2_loadZShapes(ScriptState *script);
int o2_drawSceneShape(ScriptState *script);
int o2_drawSceneShapeOnPage(ScriptState *script);
int o2_disableAnimObject(ScriptState *script);
@ -1016,11 +1021,13 @@ protected:
int o2_enterNewSceneEx(ScriptState *script);
int o2_switchScene(ScriptState *script);
int o2_getShapeFlag1(ScriptState *script);
int o2_setPathfinderFlag(ScriptState *script);
int o2_setLayerFlag(ScriptState *script);
int o2_setZanthiaPos(ScriptState *script);
int o2_loadMusicTrack(ScriptState *script);
int o2_playWanderScoreViaMap(ScriptState *script);
int o2_playSoundEffect(ScriptState *script);
int o2_setSceneAnimPos(ScriptState *script);
int o2_blockInRegion(ScriptState *script);
int o2_blockOutRegion(ScriptState *script);
int o2_setCauldronState(ScriptState *script);
@ -1075,6 +1082,7 @@ protected:
int o2_enableTimer(ScriptState *script);
int o2_setTimerCountdown(ScriptState *script);
int o2_processPaletteIndex(ScriptState *script);
int o2_updateTwoSceneAnims(ScriptState *script);
int o2_getBoolFromStack(ScriptState *script);
int o2_setVocHigh(ScriptState *script);
int o2_getVocHigh(ScriptState *script);

View File

@ -666,7 +666,7 @@ void KyraEngine_v2::initSceneAnims(int unk1) {
void KyraEngine_v2::initSceneScreen(int unk1) {
if (_unkSceneScreenFlag1) {
_screen->copyRegion(0, 0, 0, 0, 320, 144, 2, 0);
_screen->copyRegion(0, 0, 0, 0, 320, 144, 2, 0, Screen::CR_NO_P_CHECK);
return;
}
@ -675,7 +675,7 @@ void KyraEngine_v2::initSceneScreen(int unk1) {
_screen->setScreenPalette(_screen->getPalette(0));
}
_screen->copyRegion(0, 0, 0, 0, 320, 144, 2, 0);
_screen->copyRegion(0, 0, 0, 0, 320, 144, 2, 0, Screen::CR_NO_P_CHECK);
if (_noScriptEnter) {
_screen->setScreenPalette(_screen->getPalette(1));

View File

@ -125,6 +125,13 @@ int KyraEngine_v2::o2_setCharacterAnimFrame(ScriptState *script) {
return 0;
}
int KyraEngine_v2::o2_setCharacterFacing(ScriptState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_setCharacterFacing(%p) (%d)", (const void *)script, stackPos(0));
_mainCharacter.facing = stackPos(0);
_overwriteSceneFacing = 1;
return 0;
}
int KyraEngine_v2::o2_trySceneChange(ScriptState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_trySceneChange(%p) (%d, %d, %d, %d)", (const void *)script,
stackPos(0), stackPos(1), stackPos(2), stackPos(3));
@ -144,6 +151,12 @@ int KyraEngine_v2::o2_trySceneChange(ScriptState *script) {
}
}
int KyraEngine_v2::o2_moveCharacter(ScriptState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_moveCharacter(%p) (%d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2));
moveCharacter(stackPos(0), stackPos(1), stackPos(2));
return 0;
}
int KyraEngine_v2::o2_customCharacterChat(ScriptState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_customCharacterChat(%p) ('%s', %d, %d, %d, %d)", (const void *)script, stackPosString(0), stackPos(1), stackPos(2), stackPos(3), stackPos(4));
playVoice(_vocHigh, stackPos(4));
@ -603,6 +616,12 @@ int KyraEngine_v2::o2_setCharPalEntry(ScriptState *script) {
return 0;
}
int KyraEngine_v2::o2_loadZShapes(ScriptState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_loadZShapes(%p) (%d)", (const void *)script, stackPos(0));
loadZShapes(stackPos(0));
return 0;
}
int KyraEngine_v2::o2_drawSceneShape(ScriptState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_drawSceneShape(%p) (%d, %d, %d, %d)", (const void *)script, stackPos(0), stackPos(1),
stackPos(2), stackPos(3));
@ -767,6 +786,12 @@ int KyraEngine_v2::o2_getShapeFlag1(ScriptState *script) {
return _screen->getShapeFlag1(stackPos(0), stackPos(1));
}
int KyraEngine_v2::o2_setPathfinderFlag(ScriptState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_setPathfinderFlag(%p) (%d)", (const void *)script, stackPos(0));
_pathfinderFlag = stackPos(0);
return 0;
}
int KyraEngine_v2::o2_setLayerFlag(ScriptState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_setLayerFlag(%p) (%d)", (const void *)script, stackPos(0));
int layer = stackPos(0);
@ -806,6 +831,13 @@ int KyraEngine_v2::o2_playSoundEffect(ScriptState *script) {
return 0;
}
int KyraEngine_v2::o2_setSceneAnimPos(ScriptState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_setSceneAnimPos(%p) (%d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2));
_sceneAnims[stackPos(0)].x = stackPos(1);
_sceneAnims[stackPos(0)].y = stackPos(2);
return 0;
}
int KyraEngine_v2::o2_blockInRegion(ScriptState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_blockInRegion(%p) (%d, %d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2), stackPos(3));
_screen->blockInRegion(stackPos(0), stackPos(1), stackPos(2)-stackPos(0)+1, stackPos(3)-stackPos(1)+1);
@ -1449,6 +1481,14 @@ int KyraEngine_v2::o2_processPaletteIndex(ScriptState *script) {
return 0;
}
int KyraEngine_v2::o2_updateTwoSceneAnims(ScriptState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_updateTwoSceneAnims(%p) (%d, %d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2), stackPos(3));
updateSceneAnim(stackPos(0), stackPos(1));
updateSceneAnim(stackPos(2), stackPos(3));
_specialSceneScriptRunFlag = false;
return 0;
}
int KyraEngine_v2::o2_getBoolFromStack(ScriptState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_getBoolFromStack(%p) ()", (const void *)script);
return stackPos(0) ? 1 : 0;
@ -1564,9 +1604,9 @@ void KyraEngine_v2::setupOpcodeTable() {
OpcodeUnImpl(),
Opcode(o2_setCharacterAnimFrame),
// 0x0c
OpcodeUnImpl(),
Opcode(o2_setCharacterFacing),
Opcode(o2_trySceneChange),
OpcodeUnImpl(),
Opcode(o2_moveCharacter),
Opcode(o2_customCharacterChat),
// 0x10
Opcode(o2_soundFadeOut),
@ -1625,7 +1665,7 @@ void KyraEngine_v2::setupOpcodeTable() {
Opcode(o2_setDrawLayerTableItem),
// 0x3c
Opcode(o2_setCharPalEntry),
OpcodeUnImpl(),
Opcode(o2_loadZShapes),
Opcode(o2_drawSceneShape),
Opcode(o2_drawSceneShapeOnPage),
// 0x40
@ -1652,7 +1692,7 @@ void KyraEngine_v2::setupOpcodeTable() {
Opcode(o2_enterNewSceneEx),
Opcode(o2_switchScene),
Opcode(o2_getShapeFlag1),
OpcodeUnImpl(),
Opcode(o2_setPathfinderFlag),
// 0x54
OpcodeUnImpl(),
Opcode(o2_setLayerFlag),
@ -1661,7 +1701,7 @@ void KyraEngine_v2::setupOpcodeTable() {
// 0x58
Opcode(o2_playWanderScoreViaMap),
Opcode(o2_playSoundEffect),
OpcodeUnImpl(),
Opcode(o2_setSceneAnimPos),
Opcode(o2_blockInRegion),
// 0x5c
Opcode(o2_blockOutRegion),
@ -1749,7 +1789,7 @@ void KyraEngine_v2::setupOpcodeTable() {
Opcode(o2_setTimerCountdown),
Opcode(o2_processPaletteIndex),
// 0xa0
OpcodeUnImpl(),
Opcode(o2_updateTwoSceneAnims),
OpcodeUnImpl(),
OpcodeUnImpl(),
Opcode(o2_getBoolFromStack),