[Scummvm-cvs-logs] CVS: scummvm/kyra kyra.cpp,1.67,1.68 kyra.h,1.33,1.34 script_v1.cpp,1.19,1.20
Johannes Schickel
lordhoto at users.sourceforge.net
Thu Nov 10 10:59:04 CET 2005
Update of /cvsroot/scummvm/scummvm/kyra
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20986
Modified Files:
kyra.cpp kyra.h script_v1.cpp
Log Message:
Fixed preserveAllBackgrounds and implemented:
cmd_changeCharactersFacing + cmd_popBrandonIntoScene
and extended prepDrawAllObjects so that it could draw talking animations.
Also removed a few useless comments.
Index: kyra.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/kyra/kyra.cpp,v
retrieving revision 1.67
retrieving revision 1.68
diff -u -d -r1.67 -r1.68
--- kyra.cpp 10 Nov 2005 14:08:50 -0000 1.67
+++ kyra.cpp 10 Nov 2005 18:58:44 -0000 1.68
@@ -513,8 +513,6 @@
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 @@
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 @@
}
// 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;
Index: kyra.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/kyra/kyra.h,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -d -r1.33 -r1.34
--- kyra.h 10 Nov 2005 14:08:50 -0000 1.33
+++ kyra.h 10 Nov 2005 18:58:44 -0000 1.34
@@ -545,10 +545,10 @@
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;
Index: script_v1.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/kyra/script_v1.cpp,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- script_v1.cpp 10 Nov 2005 14:08:50 -0000 1.19
+++ script_v1.cpp 10 Nov 2005 18:58:44 -0000 1.20
@@ -649,7 +649,52 @@
}
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_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_drawCharacterStanding(ScriptState *script) {
debug(9, "cmd_drawCharacterStanding(0x%X)", script);
- // XXX
int character = stackPos(0);
int animFrame = stackPos(1);
int newFacing = stackPos(2);
More information about the Scummvm-git-logs
mailing list