aboutsummaryrefslogtreecommitdiff
path: root/scumm
diff options
context:
space:
mode:
authorJames Brown2003-05-21 10:13:06 +0000
committerJames Brown2003-05-21 10:13:06 +0000
commit60ac300bf3982d3f7ae34521e93918215fb7f4a8 (patch)
tree67294d49a992f1d8a824b8879a87b998445aeee7 /scumm
parent0c0cb618769afe273f9935ae4404d6a4ca08723d (diff)
downloadscummvm-rg350-60ac300bf3982d3f7ae34521e93918215fb7f4a8.tar.gz
scummvm-rg350-60ac300bf3982d3f7ae34521e93918215fb7f4a8.tar.bz2
scummvm-rg350-60ac300bf3982d3f7ae34521e93918215fb7f4a8.zip
Work on V2 inventory hack a little more
svn-id: r7776
Diffstat (limited to 'scumm')
-rw-r--r--scumm/script_v2.cpp18
-rw-r--r--scumm/scumm.h1
-rw-r--r--scumm/scummvm.cpp9
-rw-r--r--scumm/verbs.cpp59
4 files changed, 59 insertions, 28 deletions
diff --git a/scumm/script_v2.cpp b/scumm/script_v2.cpp
index 38fbc860c5..043871cbb9 100644
--- a/scumm/script_v2.cpp
+++ b/scumm/script_v2.cpp
@@ -875,21 +875,25 @@ void Scumm_v2::o2_doSentence() {
void Scumm_v2::o2_drawSentence() {
ScummVM::Rect sentenceline;
static char sentence[80];
+ byte *temp;
int slot = getVerbSlot(_scummVars[VAR_SENTENCE_VERB],0);
if (!(_userState & 32))
return;
strcpy(sentence, (char*)getResourceAddress(rtVerb, slot));
-
- if (_scummVars[27] > 0) {
- strcat(sentence, " ");
- strcat(sentence, (char*)getObjOrActorName(_scummVars[VAR_SENTENCE_OBJECT1]));
+ if (_scummVars[VAR_SENTENCE_OBJECT1] > 0) {
+ if (temp = getObjOrActorName(_scummVars[VAR_SENTENCE_OBJECT1])) {
+ strcat(sentence, " ");
+ strcat(sentence, (char*)temp);
+ }
}
- if (_scummVars[28] > 0) {
- strcat(sentence, " ");
- strcat(sentence, (char*)getObjOrActorName(_scummVars[VAR_SENTENCE_OBJECT2]));
+ if (_scummVars[VAR_SENTENCE_OBJECT2] > 0) {
+ if (temp = getObjOrActorName(_scummVars[VAR_SENTENCE_OBJECT2])) {
+ strcat(sentence, " with ");
+ strcat(sentence, (char*)temp);
+ }
}
_string[2].charset = 1;
diff --git a/scumm/scumm.h b/scumm/scumm.h
index be7fe62064..f5b4037546 100644
--- a/scumm/scumm.h
+++ b/scumm/scumm.h
@@ -713,6 +713,7 @@ protected:
void runObjectScript(int script, int entry, bool freezeResistant, bool recursive, int *vars);
void setVerbObject(uint room, uint object, uint verb);
+ void checkV2Inventory(int x, int y);
void redrawV2Inventory();
public:
diff --git a/scumm/scummvm.cpp b/scumm/scummvm.cpp
index c952e1cb4c..1767704595 100644
--- a/scumm/scummvm.cpp
+++ b/scumm/scummvm.cpp
@@ -1868,9 +1868,12 @@ int Scumm::getKeyInput() {
if (zone->number == 0) // Clicked in scene
_scummVars[VAR_CLICK_AREA] = 2;
- else if (zone->number == 2) // Clicked in verb/sentence
- _scummVars[VAR_CLICK_AREA] = 1;
-
+ else if (zone->number == 2) { // Clicked in verb/sentence
+ if (_mouse.y > zone->topline + 32)
+ _scummVars[VAR_CLICK_AREA] = 3; // Inventory
+ else
+ _scummVars[VAR_CLICK_AREA] = 1; // Verb
+ }
} else if (_lastKeyHit) // Key Input
_scummVars[VAR_CLICK_AREA] = 4;
}
diff --git a/scumm/verbs.cpp b/scumm/verbs.cpp
index 74a4b80a29..500e5ac044 100644
--- a/scumm/verbs.cpp
+++ b/scumm/verbs.cpp
@@ -27,35 +27,53 @@
#include "scumm.h"
#include "verbs.h"
+void Scumm::checkV2Inventory(int x, int y) {
+ int object = 0;
+
+ if ((y < virtscr[2].topline + 34) || !(_mouseButStat & MBS_LEFT_CLICK))
+ return;
+
+ object = ((y - virtscr[2].topline - 34) / 8) * 2;
+ if (x > 150)
+ object++;
+
+ object = findInventory(_scummVars[VAR_EGO], object+1);
+ if (object > 0) {
+ _scummVars[35] = object;
+ runScript(4, 0, 0, 0);
+ }
+}
+
void Scumm::redrawV2Inventory() {
int i, items = 0, curInventoryCount = 0;
bool alternate = false;
+ int max_inv = getInventoryCount(_scummVars[VAR_EGO]);
if (!(_userState & 64))
return;
- if (curInventoryCount > _maxInventoryItems)
- curInventoryCount = _maxInventoryItems;
+ if (curInventoryCount > max_inv)
+ curInventoryCount = max_inv;
- for (i = curInventoryCount + 1; i <= _maxInventoryItems; i++) {
- if (_inventory[i] != 0) {
- _string[1].charset = 1;
- _string[1].ypos = virtscr[2].topline + 34 + (8*(items / 2));
- _string[1].color = 5;
- _messagePtr = getObjOrActorName(_inventory[i]);
+ _string[1].charset = 1;
+ _string[1].color = 5;
- if (alternate)
- _string[1].xpos = 200;
- else
- _string[1].xpos = 0;
+ items = 0;
+ for (i = curInventoryCount + 1; i <= max_inv; i++) {
+ int obj = findInventory(_scummVars[VAR_EGO], i);
+ if ((obj == 0) || (items == 4)) break;
+
+ _string[1].ypos = virtscr[2].topline + 34 + (8*(items / 2));
+ if (alternate)
+ _string[1].xpos = 200;
+ else
+ _string[1].xpos = 0;
- drawString(1);
+ _messagePtr = getObjOrActorName(obj);
+ drawString(1);
+ items++;
- items++;
- alternate = !alternate;
- }
- if (items == 4)
- break;
+ alternate = !alternate;
}
if (curInventoryCount > 0) { // Draw Up Arrow
@@ -72,6 +90,7 @@ void Scumm::redrawV2Inventory() {
drawString(1);
}
}
+
void Scumm::redrawVerbs() {
int i;
int verb = (_cursor.state > 0 ? checkMouseOver(_mouse.x, _mouse.y) : 0);
@@ -158,6 +177,10 @@ int Scumm::checkMouseOver(int x, int y) {
return i;
} while (--vs, --i);
+
+ if (_features & GF_AFTER_V2)
+ checkV2Inventory(x, y);
+
return 0;
}