mirror of
https://github.com/scummvm/scummvm.git
synced 2026-06-20 05:45:29 +00:00
Fixed preserveAllBackgrounds and implemented:
cmd_changeCharactersFacing + cmd_popBrandonIntoScene and extended prepDrawAllObjects so that it could draw talking animations. Also removed a few useless comments. svn-id: r19550
This commit is contained in:
+96
-5
@@ -513,8 +513,6 @@ void KyraEngine::delay(uint32 amount) {
|
||||
void KyraEngine::mainLoop() {
|
||||
debug(9, "KyraEngine::mainLoop()");
|
||||
|
||||
//enterNewScene(0x0, _currentCharacter->facing, 0, 0, 1);
|
||||
|
||||
while (!_quitFlag) {
|
||||
int32 frameTime = (int32)_system->getMillis();
|
||||
|
||||
@@ -2495,7 +2493,7 @@ void KyraEngine::preserveAllBackgrounds() {
|
||||
|
||||
AnimObject *curObject = _objectQueue;
|
||||
while (curObject) {
|
||||
if (!curObject->active && curObject->flags) {
|
||||
if (curObject->active && !curObject->unk1) {
|
||||
preserveOrRestoreBackground(curObject, false);
|
||||
curObject->bkgdChangeFlag = 0;
|
||||
}
|
||||
@@ -2617,10 +2615,103 @@ void KyraEngine::prepDrawAllObjects() {
|
||||
}
|
||||
|
||||
// talking head functionallity
|
||||
if (!true) {
|
||||
// XXX
|
||||
if (_charSayUnk1 != -1) {
|
||||
const int16 baseAnimFrameTable1[] = { 0x11, 0x35, 0x59, 0x00, 0x00, 0x00 };
|
||||
const int16 baseAnimFrameTable2[] = { 0x15, 0x39, 0x5D, 0x00, 0x00, 0x00 };
|
||||
const int8 xOffsetTable1[] = { 2, 4, 0, 5, 2, 0, 0, 0 };
|
||||
const int8 xOffsetTable2[] = { 6, 4, 8, 3, 6, 0, 0, 0 };
|
||||
const int8 yOffsetTable1[] = { 0, 8, 1, 1, 0, 0, 0, 0 };
|
||||
const int8 yOffsetTable2[] = { 0, 8, 1, 1, 0, 0, 0, 0 };
|
||||
if (curObject->index == 0 || curObject->index <= 4) {
|
||||
int shapesIndex = 0;
|
||||
if (curObject->index == _charSayUnk3) {
|
||||
shapesIndex = _charSayUnk4 + baseAnimFrameTable1[curObject->index];
|
||||
} else {
|
||||
shapesIndex = baseAnimFrameTable2[curObject->index];
|
||||
int temp2 = 0;
|
||||
if (curObject->index == 2) {
|
||||
if (_characterList[2].sceneId == 0x4D || _characterList[2].sceneId == 0x56) {
|
||||
temp2 = 1;
|
||||
} else {
|
||||
temp2 = 0;
|
||||
}
|
||||
} else {
|
||||
temp2 = 1;
|
||||
}
|
||||
|
||||
if (!temp2) {
|
||||
shapesIndex = -1;
|
||||
}
|
||||
}
|
||||
|
||||
xpos = curObject->x1;
|
||||
ypos = curObject->y1;
|
||||
|
||||
int tempX = 0, tempY = 0;
|
||||
if (curObject->flags & 0x1) {
|
||||
tempX = (xOffsetTable1[curObject->index] * _brandonScaleX) >> 8;
|
||||
tempY = yOffsetTable1[curObject->index];
|
||||
} else {
|
||||
tempX = (xOffsetTable2[curObject->index] * _brandonScaleX) >> 8;
|
||||
tempY = yOffsetTable2[curObject->index];
|
||||
}
|
||||
tempY = (tempY * _brandonScaleY) >> 8;
|
||||
xpos += tempX;
|
||||
ypos += tempY;
|
||||
|
||||
if (_scaleMode && _brandonScaleX != 256) {
|
||||
++xpos;
|
||||
}
|
||||
|
||||
if (curObject->index == 0) {
|
||||
if (!(_brandonStatusBit & 2)) {
|
||||
flagUnk3 = 0x100;
|
||||
if ((flagUnk1 & 0x200) || (flagUnk2 & 0x4000)) {
|
||||
flagUnk3 = 0;
|
||||
}
|
||||
|
||||
int tempFlags = 0;
|
||||
if (flagUnk3 & 0x100) {
|
||||
if (curObject->flags & 1) {
|
||||
tempFlags = 1;
|
||||
}
|
||||
tempFlags |= 0x800 | flagUnk1 | 0x100;
|
||||
}
|
||||
|
||||
if (!(flagUnk3 & 0x100) && (flagUnk2 & 0x4000)) {
|
||||
tempFlags = 0;
|
||||
if (curObject->flags & 1) {
|
||||
tempFlags = 1;
|
||||
}
|
||||
tempFlags |= 0x900 | flagUnk1 | 0x4000;
|
||||
_screen->drawShape(drawPage, _shapes[4+shapesIndex], xpos, ypos, 2, tempFlags | 4, _unkBrandonPoisonFlags, 1, 0/*XXX*/, temp, _brandonScaleX, _brandonScaleY);
|
||||
} else {
|
||||
if (!(flagUnk2 & 0x4000)) {
|
||||
tempFlags = 0;
|
||||
if (curObject->flags & 1) {
|
||||
tempFlags = 1;
|
||||
}
|
||||
tempFlags |= 0x900 | flagUnk1;
|
||||
}
|
||||
|
||||
_screen->drawShape(drawPage, _shapes[4+shapesIndex], xpos, ypos, 2, tempFlags | 4, _unkBrandonPoisonFlags, 1, temp, _brandonScaleX, _brandonScaleY);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (shapesIndex != -1) {
|
||||
int tempFlags = 0;
|
||||
if (curObject->flags & 1) {
|
||||
tempFlags = 1;
|
||||
}
|
||||
_screen->drawShape(drawPage, _shapes[4+shapesIndex], xpos, ypos, 2, tempFlags | 0x800, temp);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
xpos = curObject->x1;
|
||||
ypos = curObject->y1;
|
||||
|
||||
curObject->flags |= 0x800;
|
||||
if (curObject->index == 0) {
|
||||
flagUnk3 = 0x100;
|
||||
|
||||
+3
-3
@@ -545,10 +545,10 @@ protected:
|
||||
int _lastFindWayRet;
|
||||
int *_movFacingTable;
|
||||
|
||||
int8 _charSayUnk1; // this is byte_2EE24
|
||||
int8 _charSayUnk1;
|
||||
int8 _charSayUnk2;
|
||||
int8 _charSayUnk3; // this is byte_2EE25
|
||||
int8 _charSayUnk4; // this is byte_2EE26
|
||||
int8 _charSayUnk3;
|
||||
int8 _charSayUnk4;
|
||||
|
||||
uint8 _configTalkspeed;
|
||||
AnimObject *_objectQueue;
|
||||
|
||||
+61
-3
@@ -649,7 +649,52 @@ int KyraEngine::cmd_runWSAFrames(ScriptState *script) {
|
||||
}
|
||||
|
||||
int KyraEngine::cmd_popBrandonIntoScene(ScriptState *script) {
|
||||
warning("STUB: cmd_popBrandonIntoScene");
|
||||
debug(9, "cmd_popBrandonIntoScene(0x%X)", script);
|
||||
int changeScaleMode = stackPos(3);
|
||||
int xpos = stackPos(0) & 0xFFFC;
|
||||
int ypos = stackPos(1) & 0xFFFE;
|
||||
int facing = stackPos(2);
|
||||
_currentCharacter->x1 = _currentCharacter->x2 = xpos;
|
||||
_currentCharacter->y1 = _currentCharacter->y2 = ypos;
|
||||
_currentCharacter->facing = facing;
|
||||
_currentCharacter->currentAnimFrame = 7;
|
||||
int xOffset = _defaultShapeTable[0].xOffset;
|
||||
int yOffset = _defaultShapeTable[0].yOffset;
|
||||
int width = _defaultShapeTable[0].w << 3;
|
||||
int height = _defaultShapeTable[0].h;
|
||||
AnimObject *curAnim = _charactersAnimState;
|
||||
|
||||
if (changeScaleMode) {
|
||||
curAnim->x1 = _currentCharacter->x1;
|
||||
curAnim->y1 = _currentCharacter->y1;
|
||||
_brandonScaleY = _scaleTable[_currentCharacter->y1];
|
||||
_brandonScaleX = _brandonScaleY;
|
||||
|
||||
int animWidth = fetchAnimWidth(curAnim->sceneAnimPtr, _brandonScaleX) >> 1;
|
||||
int animHeight = fetchAnimHeight(curAnim->sceneAnimPtr, _brandonScaleY);
|
||||
|
||||
animWidth = (xOffset * animWidth) / width;
|
||||
animHeight = (yOffset * animHeight) / height;
|
||||
|
||||
curAnim->x2 = curAnim->x1 += animWidth;
|
||||
curAnim->y2 = curAnim->y1 += animHeight;
|
||||
} else {
|
||||
curAnim->x2 = curAnim->x1 = _currentCharacter->x1 + xOffset;
|
||||
curAnim->y2 = curAnim->y1 = _currentCharacter->y1 + yOffset;
|
||||
}
|
||||
|
||||
int scaleModeBackup = _scaleMode;
|
||||
if (changeScaleMode) {
|
||||
_scaleMode = 1;
|
||||
}
|
||||
|
||||
animRefreshNPC(0);
|
||||
preserveAllBackgrounds();
|
||||
prepDrawAllObjects();
|
||||
copyChangedObjectsForward(0);
|
||||
|
||||
_scaleMode = scaleModeBackup;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -702,7 +747,21 @@ int KyraEngine::cmd_getCharacterY(ScriptState *script) {
|
||||
}
|
||||
|
||||
int KyraEngine::cmd_changeCharactersFacing(ScriptState *script) {
|
||||
warning("STUB: cmd_changeCharactersFacing");
|
||||
debug(9, "cmd_changeCharactersFacing(0x%X)", script);
|
||||
int character = stackPos(0);
|
||||
int facing = stackPos(1);
|
||||
int newAnimFrame = stackPos(2);
|
||||
|
||||
restoreAllObjectBackgrounds();
|
||||
if (newAnimFrame != -1) {
|
||||
_characterList[character].currentAnimFrame = newAnimFrame;
|
||||
}
|
||||
_characterList[character].facing = facing;
|
||||
animRefreshNPC(character);
|
||||
preserveAllBackgrounds();
|
||||
prepDrawAllObjects();
|
||||
copyChangedObjectsForward(0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -739,7 +798,6 @@ int KyraEngine::cmd_displayWSASequentialFrames(ScriptState *script) {
|
||||
|
||||
int KyraEngine::cmd_drawCharacterStanding(ScriptState *script) {
|
||||
debug(9, "cmd_drawCharacterStanding(0x%X)", script);
|
||||
// XXX
|
||||
int character = stackPos(0);
|
||||
int animFrame = stackPos(1);
|
||||
int newFacing = stackPos(2);
|
||||
|
||||
Reference in New Issue
Block a user