[Scummvm-cvs-logs] CVS: scummvm/kyra kyra.cpp,1.92,1.93 kyra.h,1.50,1.51 screen.cpp,1.32,1.33 screen.h,1.17,1.18 script_v1.cpp,1.45,1.46 staticres.cpp,1.25,1.26
Johannes Schickel
lordhoto at users.sourceforge.net
Thu Dec 22 10:16:01 CET 2005
Update of /cvsroot/scummvm/scummvm/kyra
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13339
Modified Files:
kyra.cpp kyra.h screen.cpp screen.h script_v1.cpp
staticres.cpp
Log Message:
Completed implementation of processItemDrop
also changed implementation of itemDropDown a bit.
Implemented new opcodes:
- cmd_fadeSpecialPalette
- cmd_setCustomPaletteRange
Index: kyra.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/kyra/kyra.cpp,v
retrieving revision 1.92
retrieving revision 1.93
diff -u -d -r1.92 -r1.93
--- kyra.cpp 20 Dec 2005 10:58:07 -0000 1.92
+++ kyra.cpp 22 Dec 2005 18:14:52 -0000 1.93
@@ -371,6 +371,8 @@
_unkScreenVar1 = 1;
_unkScreenVar2 = 0;
_unkScreenVar3 = 0;
+
+ memset(_specialPalettes, 0, sizeof(_specialPalettes));
return 0;
}
@@ -2987,8 +2989,7 @@
}
if (unk1 == 2) {
- warning("processItemDrop unk1 == 2 is NOT implemented");
- // XXX
+ itemSpecialFX(x, y, item);
}
if (unk1 == 0) {
@@ -3115,9 +3116,13 @@
++addY;
drawY = tempY - 16;
backUpRect0(drawX, drawY);
+ uint32 nextTime = _system->getMillis() + 1 * _tickLength;
_screen->drawShape(0, _shapes[220+item], drawX, drawY, 0, 0);
- delay(1);
_screen->updateScreen();
+ while (_system->getMillis() < nextTime) {
+ if ((nextTime - _system->getMillis()) >= 10)
+ delay(10);
+ }
}
bool skip = false;
@@ -3154,9 +3159,13 @@
drawX = (unkX >> 4) - 8;
drawY = tempY - 16;
backUpRect0(drawX, drawY);
+ uint32 nextTime = _system->getMillis() + 1 * _tickLength;
_screen->drawShape(0, _shapes[220+item], drawX, drawY, 0, 0);
- delay(1);
_screen->updateScreen();
+ while (_system->getMillis() < nextTime) {
+ if ((nextTime - _system->getMillis()) >= 10)
+ delay(10);
+ }
}
restoreRect0(drawX, drawY);
} else {
@@ -3185,6 +3194,74 @@
}
}
+void KyraEngine::itemSpecialFX(int x, int y, int item) {
+ debug(9, "itemSpecialFX(%d, %d, %d)", x, y, item);
+ if (item == 41) {
+ itemSpecialFX1(x, y, item);
+ } else {
+ itemSpecialFX2(x, y, item);
+ }
+}
+
+void KyraEngine::itemSpecialFX1(int x, int y, int item) {
+ debug(9, "itemSpecialFX1(%d, %d, %d)", x, y, item);
+ uint8 *shape = _shapes[220+item];
+ x -= 8;
+ int startY = y;
+ y -= 15;
+ _screen->hideMouse();
+ backUpRect0(x, y);
+ for (int i = 1; i <= 16; ++i) {
+ _screen->setNewShapeHeight(shape, i);
+ --startY;
+ restoreRect0(x, y);
+ uint32 nextTime = _system->getMillis() + 1 * _tickLength;
+ _screen->drawShape(0, shape, x, startY, 0, 0);
+ _screen->updateScreen();
+ while (_system->getMillis() < nextTime) {
+ if ((nextTime - _system->getMillis()) >= 10)
+ delay(10);
+ }
+ }
+ restoreRect0(x, y);
+ _screen->showMouse();
+}
+
+void KyraEngine::itemSpecialFX2(int x, int y, int item) {
+ debug(9, "itemSpecialFX2(%d, %d, %d)", x, y, item);
+ x -= 8;
+ y -= 15;
+ int yAdd = (int8)(((16 - _itemTable[item].height) >> 1) & 0xFF);
+ backUpRect0(x, y);
+ if (item >= 80 && item <= 89) {
+ // snd_kyraPlaySound(55);
+ }
+
+ for (int i = 201; i <= 205; ++i) {
+ restoreRect0(x, y);
+ uint32 nextTime = _system->getMillis() + 3 * _tickLength;
+ _screen->drawShape(0, _shapes[4+i], x, y + yAdd, 0, 0);
+ _screen->updateScreen();
+ while (_system->getMillis() < nextTime) {
+ if ((nextTime - _system->getMillis()) >= 10)
+ delay(10);
+ }
+ }
+
+ for (int i = 204; i >= 201; --i) {
+ restoreRect0(x, y);
+ uint32 nextTime = _system->getMillis() + 3 * _tickLength;
+ _screen->drawShape(0, _shapes[220+item], x, y, 0, 0);
+ _screen->drawShape(0, _shapes[4+i], x, y + yAdd, 0, 0);
+ _screen->updateScreen();
+ while (_system->getMillis() < nextTime) {
+ if ((nextTime - _system->getMillis()) >= 10)
+ delay(10);
+ }
+ }
+ restoreRect0(x, y);
+}
+
#pragma mark -
#pragma mark - Animation specific code
#pragma mark -
Index: kyra.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/kyra/kyra.h,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -d -r1.50 -r1.51
--- kyra.h 20 Dec 2005 12:42:22 -0000 1.50
+++ kyra.h 22 Dec 2005 18:14:52 -0000 1.51
@@ -191,6 +191,9 @@
const char **seqCPSTable() { return (const char **)_seq_CPSTable; }
const char **seqCOLTable() { return (const char **)_seq_COLTable; }
const char **seqTextsTable() { return (const char **)_seq_textsTable; }
+
+ const uint8 **palTable1() { return (const uint8 **)&_specialPalettes[0]; }
+ const uint8 **palTable2() { return (const uint8 **)&_specialPalettes[29]; }
bool seq_skipSequence() const;
void quitGame();
@@ -491,6 +494,9 @@
int isDropable(int x, int y);
void itemDropDown(int x, int y, int destX, int destY, byte freeItem, int item);
void dropItem(int unk1, int item, int x, int y, int unk2);
+ void itemSpecialFX(int x, int y, int item);
+ void itemSpecialFX1(int x, int y, int item);
+ void itemSpecialFX2(int x, int y, int item);
void animRemoveGameItem(int index);
void animAddGameItem(int index, uint16 sceneId);
@@ -713,6 +719,8 @@
int _roomFilenameTableSize;
uint8 *_amuleteAnim;
+
+ uint8 *_specialPalettes[33];
Timer _timers[34];
uint32 _timerNextRun;
Index: screen.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/kyra/screen.cpp,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -d -r1.32 -r1.33
--- screen.cpp 20 Dec 2005 10:58:07 -0000 1.32
+++ screen.cpp 22 Dec 2005 18:14:52 -0000 1.33
@@ -140,6 +140,19 @@
fadePalette(blackPal, 0x54);
}
+void Screen::fadeSpecialPalette(int palIndex, int startIndex, int size, int fadeTime) {
+ debug(9, "fadeSpecialPalette(%d, %d, %d, %d)", palIndex, startIndex, size, fadeTime);
+ assert(_vm->palTable1()[palIndex]);
+ assert(_currentPalette);
+ uint8 tempPal[768];
+ memcpy(tempPal, _currentPalette, 768);
+ memcpy(&tempPal[startIndex*3], _vm->palTable1()[palIndex], size*3);
+ fadePalette(tempPal, fadeTime*9);
+ memcpy(&_currentPalette[startIndex*3], &tempPal[startIndex*3], size*3);
+ setScreenPalette(_currentPalette);
+ _system->updateScreen();
+}
+
void Screen::fadePalette(const uint8 *palData, int delay) {
debug(9, "Screen::fadePalette(0x%X, %d)", palData, delay);
uint8 fadePal[768];
Index: screen.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/kyra/screen.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- screen.h 8 Dec 2005 17:19:18 -0000 1.17
+++ screen.h 22 Dec 2005 18:14:52 -0000 1.18
@@ -92,6 +92,7 @@
void setPagePixel(int pageNum, int x, int y, uint8 color);
void fadeFromBlack();
void fadeToBlack();
+ void fadeSpecialPalette(int palIndex, int startIndex, int size, int fadeTime);
void fadePalette(const uint8 *palData, int delay);
void setScreenPalette(const uint8 *palData);
void copyToPage0(int y, int h, uint8 page, uint8 *seqBuf);
Index: script_v1.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/kyra/script_v1.cpp,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -d -r1.45 -r1.46
--- script_v1.cpp 22 Dec 2005 01:49:59 -0000 1.45
+++ script_v1.cpp 22 Dec 2005 18:14:52 -0000 1.46
@@ -509,7 +509,8 @@
}
int KyraEngine::cmd_fadeSpecialPalette(ScriptState *script) {
- warning("STUB: cmd_fadeSpecialPalette");
+ debug(3, "cmd_fadeSpecialPalette(0x%X) (%d, %d, %d, %d)", script, stackPos(0), stackPos(1), stackPos(2), stackPos(3));
+ _screen->fadeSpecialPalette(stackPos(0), stackPos(1), stackPos(2), stackPos(3));
return 0;
}
@@ -791,7 +792,10 @@
}
int KyraEngine::cmd_setCustomPaletteRange(ScriptState *script) {
- warning("STUB: cmd_setCustomPaletteRange");
+ debug(3, "cmd_setCustomPaletteRange(0x%X) (%d, %d, %d)", script, stackPos(0), stackPos(1), stackPos(2));
+ uint8 *screenPal = _screen->_currentPalette;
+ memcpy(&screenPal[stackPos(1)*3], _specialPalettes[stackPos(0)], stackPos(2)*3);
+ _screen->setScreenPalette(screenPal);
return 0;
}
@@ -802,7 +806,7 @@
int KyraEngine::cmd_customPrintTalkString(ScriptState *script) {
if (_features & GF_TALKIE) {
- debug(3, "cmd_customPrintTalkString(0x%X) ('%s', %d, %d, %d)", script, stackPosString(1), stackPos(2), stackPos(3), stackPos(4) & 0xFF);
+ debug(3, "cmd_customPrintTalkString(0x%X) (%d, '%s', %d, %d, %d)", script, stackPos(0), stackPosString(1), stackPos(2), stackPos(3), stackPos(4) & 0xFF);
while (snd_voicePlaying() && !_fastMode) {
delay(10);
}
Index: staticres.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/kyra/staticres.cpp,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- staticres.cpp 20 Dec 2005 12:42:22 -0000 1.25
+++ staticres.cpp 22 Dec 2005 18:14:52 -0000 1.26
@@ -26,7 +26,7 @@
namespace Kyra {
-#define RESFILE_VERSION 5
+#define RESFILE_VERSION 6
#define GAME_FLAGS (GF_FLOPPY | GF_TALKIE | GF_DEMO | GF_AUDIOCD)
#define LANGUAGE_FLAGS (GF_ENGLISH | GF_FRENCH | GF_GERMAN | GF_SPANISH | GF_LNGUNK)
@@ -162,6 +162,7 @@
temp = 0; \
}
+
if ((type & RES_INTRO) || type == RES_ALL) {
loadRawFile(resFile, "FOREST.SEQ", _seq_Forest);
loadRawFile(resFile, "KALLAK-WRITING.SEQ", _seq_KallakWriting);
@@ -196,6 +197,21 @@
res_loadLangTable("NODROP.", &resFile, (byte***)&_noDropList, &_noDropList_Size, loadNativeLanguage);
loadRawFile(resFile, "AMULETEANIM.SEQ", _amuleteAnim);
+
+ for (int i = 1; i <= 33; ++i) {
+ char buffer[32];
+ sprintf(buffer, "PALTABLE%d.PAL", i);
+ if (_features & GF_TALKIE) {
+ strcat(buffer, ".CD");
+ } else if (_features & GF_DEMO) {
+ strcat(buffer, ".DEM");
+ }
+ temp = getFile(resFile, buffer);
+ if (temp) {
+ _specialPalettes[i-1] = temp;
+ temp = 0;
+ }
+ }
}
#undef loadRooms
@@ -304,6 +320,11 @@
delete [] _amuleteAnim;
_amuleteAnim = 0;
+
+ for (int i = 0; i < 33; ++i) {
+ delete [] _specialPalettes[i];
+ _specialPalettes[i] = 0;
+ }
}
}
More information about the Scummvm-git-logs
mailing list