aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/kyra/gui_v3.cpp125
-rw-r--r--engines/kyra/kyra_v3.cpp2
-rw-r--r--engines/kyra/kyra_v3.h3
-rw-r--r--engines/kyra/staticres.cpp3
-rw-r--r--engines/kyra/text_v3.cpp2
5 files changed, 131 insertions, 4 deletions
diff --git a/engines/kyra/gui_v3.cpp b/engines/kyra/gui_v3.cpp
index 6024673dbb..9e5546763a 100644
--- a/engines/kyra/gui_v3.cpp
+++ b/engines/kyra/gui_v3.cpp
@@ -276,7 +276,7 @@ void KyraEngine_v3::drawMalcolmsMoodText() {
void KyraEngine_v3::drawMalcolmsMoodPointer(int frame, int page) {
debugC(9, kDebugLevelMain, "KyraEngine_v3::drawMalcolmsMoodPointer(%d, %d)", frame, page);
- static const int stateTable[] = {
+ static const uint8 stateTable[] = {
1, 6, 11
};
@@ -452,7 +452,7 @@ int KyraEngine_v3::buttonInventory(Button *button) {
} else if (_itemInHand == 27) {
if (_chatText)
return 0;
- //XXX
+ return buttonJesterStaff(&_mainButtonData[3]);
} else {
if (slotItem >= 0) {
if (itemInventoryMagic(_itemInHand, slot))
@@ -483,6 +483,127 @@ int KyraEngine_v3::buttonInventory(Button *button) {
return 0;
}
+int KyraEngine_v3::buttonMoodChange(Button *button) {
+ if (queryGameFlag(0x219)) {
+ playSoundEffect(0x0D, 0xC8);
+ return 0;
+ }
+
+ static const uint8 frameTable[] = { 1, 6, 11 };
+
+ if (_mouseX >= 245 && _mouseX <= 267 && _mouseY >= 159 && _mouseY <= 198)
+ _malcolmsMood = 0;
+ else if (_mouseX >= 268 && _mouseX <= 289 && _mouseY >= 159 && _mouseY <= 198)
+ _malcolmsMood = 1;
+ else if (_mouseX >= 290 && _mouseX <= 312 && _mouseY >= 159 && _mouseY <= 198)
+ _malcolmsMood = 2;
+
+ int direction = (_invWsaFrame > frameTable[_malcolmsMood]) ? -1 : 1;
+
+ if (_invWsaFrame != frameTable[_malcolmsMood]) {
+ _screen->hideMouse();
+ setGameFlag(3);
+
+ playSoundEffect(0x2E, 0xC8);
+
+ while (_invWsaFrame != frameTable[_malcolmsMood]) {
+ uint32 endTime = _system->getMillis() + 2 * _tickLength;
+ _invWsaFrame += direction;
+
+ drawMalcolmsMoodPointer(_invWsaFrame, 0);
+ _screen->updateScreen();
+
+ while (endTime > _system->getMillis()) {
+ update();
+ _system->delayMillis(10);
+ }
+ }
+
+ resetGameFlag(3);
+ _screen->showMouse();
+
+ drawMalcolmsMoodText();
+ updateDlgIndex();
+
+ ScriptData data;
+ ScriptState state;
+ memset(&data, 0, sizeof(data));
+ memset(&state, 0, sizeof(state));
+
+ _res->exists("_ACTOR.EMC", true);
+ _scriptInterpreter->loadScript("_ACTOR.EMC", &data, &_opcodes);
+ _scriptInterpreter->initScript(&state, &data);
+ _scriptInterpreter->startScript(&state, 1);
+
+ int vocHigh = _vocHigh;
+ _vocHigh = 200;
+ _useActorBuffer = true;
+
+ while (_scriptInterpreter->validScript(&state))
+ _scriptInterpreter->runScript(&state);
+
+ _useActorBuffer = false;
+ _vocHigh = vocHigh;
+ _scriptInterpreter->unloadScript(&data);
+ }
+
+ return 0;
+}
+
+int KyraEngine_v3::buttonShowScore(Button *button) {
+ strcpy(_stringBuffer, (const char*)getTableEntry(_cCodeFile, 18));
+
+ char *buffer = _stringBuffer;
+
+ while (*buffer != '%')
+ ++buffer;
+
+ buffer[0] = (_score / 100) + '0';
+ buffer[1] = ((_score % 100) / 10) + '0';
+ buffer[2] = (_score % 10) + '0';
+
+ while (*buffer != '%')
+ ++buffer;
+
+ buffer[0] = (_scoreMax / 100) + '0';
+ buffer[1] = ((_scoreMax % 100) / 10) + '0';
+ buffer[2] = (_scoreMax % 10) + '0';
+
+ showMessage(_stringBuffer, 0xFF, 0xF0);
+ return 0;
+}
+
+int KyraEngine_v3::buttonJesterStaff(Button *button) {
+ makeCharFacingMouse();
+ if (_itemInHand == 27) {
+ _screen->hideMouse();
+ removeHandItem();
+ playSoundEffect(0x0C, 0xC8);
+ drawJestersStaff(1, 0);
+ updateItemCommand(27, 2, 0xFF);
+ setGameFlag(0x97);
+ _screen->showMouse();
+ } else if (_itemInHand == -1) {
+ if (queryGameFlag(0x97)) {
+ _screen->hideMouse();
+ playSoundEffect(0x0B, 0xC8);
+ setHandItem(27);
+ drawJestersStaff(0, 0);
+ updateItemCommand(27, 0, 0xFF);
+ resetGameFlag(0x97);
+ _screen->showMouse();
+ } else {
+ if (queryGameFlag(0x2F))
+ objectChat((const char*)getTableEntry(_cCodeFile, 20), 0, 204, 20);
+ else
+ objectChat((const char*)getTableEntry(_cCodeFile, 25), 0, 204, 25);
+ }
+ } else {
+ objectChat((const char*)getTableEntry(_cCodeFile, 30), 0, 204, 30);
+ }
+ return 0;
+}
+
#pragma mark -
GUI_v3::GUI_v3(KyraEngine_v3 *vm) : GUI(vm), _vm(vm), _screen(vm->_screen) {
diff --git a/engines/kyra/kyra_v3.cpp b/engines/kyra/kyra_v3.cpp
index a93375d286..b1204db6e4 100644
--- a/engines/kyra/kyra_v3.cpp
+++ b/engines/kyra/kyra_v3.cpp
@@ -809,7 +809,7 @@ void KyraEngine_v3::loadMalcolmShapes(int newShapes) {
filename[numberOffset[i]+1] = lowNum;
_res->exists(filename, true);
_res->loadFileToBuf(filename, _screenBuffer, 64000);
- for (int j = startShape[i]; j < endShape[i]; ++j) {
+ for (int j = startShape[i]; j <= endShape[i]; ++j) {
if (j == 87)
continue;
addShapeToPool(_screenBuffer, j, j-startShape[i]);
diff --git a/engines/kyra/kyra_v3.h b/engines/kyra/kyra_v3.h
index 946344cdb1..bb99f1f39d 100644
--- a/engines/kyra/kyra_v3.h
+++ b/engines/kyra/kyra_v3.h
@@ -157,6 +157,9 @@ private:
bool _enableInventory;
int buttonInventory(Button *button);
+ int buttonMoodChange(Button *button);
+ int buttonShowScore(Button *button);
+ int buttonJesterStaff(Button *button);
// -> main menu
void initMainMenu();
diff --git a/engines/kyra/staticres.cpp b/engines/kyra/staticres.cpp
index 18386e29a7..e079bf4636 100644
--- a/engines/kyra/staticres.cpp
+++ b/engines/kyra/staticres.cpp
@@ -2439,8 +2439,11 @@ void KyraEngine_v3::initMainButtonList(bool disable) {
GUI_V3_BUTTON(_mainButtonData[0], 1, 0, 0, 4, 4, 4, 0x4487, 0, 5, 162, 50, 25, 0xFF, 0xF0, 0xFF, 0xF0, 0xFF, 0xF0, 0);
GUI_V3_BUTTON(_mainButtonData[1], 2, 0, 0, 1, 1, 1, 0x4487, 0, 245, 156, 69, 33, 0xFF, 0xF0, 0xFF, 0xF0, 0xFF, 0xF0, 0);
+ _mainButtonData[1].buttonCallback = BUTTON_FUNCTOR(KyraEngine_v3, this, &KyraEngine_v3::buttonMoodChange);
GUI_V3_BUTTON(_mainButtonData[2], 3, 0, 0, 1, 1, 1, 0x4487, 0, 215, 191, 24, 9, 0xFF, 0xF0, 0xFF, 0xF0, 0xFF, 0xF0, 0);
+ _mainButtonData[2].buttonCallback = BUTTON_FUNCTOR(KyraEngine_v3, this, &KyraEngine_v3::buttonShowScore);
GUI_V3_BUTTON(_mainButtonData[3], 4, 0, 0, 1, 1, 1, 0x4487, 0, 215, 155, 25, 36, 0xFF, 0xF0, 0xFF, 0xF0, 0xFF, 0xF0, 0);
+ _mainButtonData[3].buttonCallback = BUTTON_FUNCTOR(KyraEngine_v3, this, &KyraEngine_v3::buttonJesterStaff);
Button::Callback buttonInventoryFunctor = BUTTON_FUNCTOR(KyraEngine_v3, this, &KyraEngine_v3::buttonInventory);
for (int i = 0; i < 5; ++i) {
diff --git a/engines/kyra/text_v3.cpp b/engines/kyra/text_v3.cpp
index 640095ff1c..834903b18f 100644
--- a/engines/kyra/text_v3.cpp
+++ b/engines/kyra/text_v3.cpp
@@ -223,7 +223,7 @@ void KyraEngine_v3::objectChat(const char *str, int object, int vocHigh, int voc
static const char *talkFilenameTable[] = {
"MTFL00S.EMC", "MTFL00Q.EMC", "MTFL00E.EMC", "MTFL00T.EMC",
- "MTFR00S.EMC", "MTFR00Q.EMC", "MTFR00E.EMC", "MTRF00T.EMC",
+ "MTFR00S.EMC", "MTFR00Q.EMC", "MTFR00E.EMC", "MTFR00T.EMC",
"MTL00S.EMC", "MTL00Q.EMC", "MTL00E.EMC", "MTL00T.EMC",
"MTR00S.EMC", "MTR00Q.EMC", "MTR00E.EMC", "MTR00T.EMC",
"MTA00S.EMC", "MTA00Q.EMC", "MTA00Q.EMC", "MTA00T.EMC"