aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--saga/interface.cpp39
-rw-r--r--saga/interface.h12
-rw-r--r--saga/script.cpp23
-rw-r--r--saga/script.h2
-rw-r--r--saga/sthread.cpp3
5 files changed, 45 insertions, 34 deletions
diff --git a/saga/interface.cpp b/saga/interface.cpp
index 429edf48ec..a0f8f7ad27 100644
--- a/saga/interface.cpp
+++ b/saga/interface.cpp
@@ -133,6 +133,7 @@ Interface::Interface(SagaEngine *vm) : _vm(vm), _initialized(false) {
_savedMode = -1;
_inMainMode = false;
*_statusText = 0;
+ _statusOnceColor = -1;
_inventoryCount = 0;
_inventorySize = ITE_INVENTORY_SIZE;
@@ -283,6 +284,7 @@ int Interface::setStatusText(const char *new_txt) {
assert(new_txt != NULL);
strncpy(_statusText, new_txt, STATUS_TEXT_LEN);
+ _statusOnceColor = -1;
return SUCCESS;
}
@@ -417,6 +419,7 @@ int Interface::drawStatusBar(SURFACE *ds) {
Rect rect;
int string_w;
+ int color;
// Disable this for IHNM for now, since that game uses the full screen
// in some cases.
@@ -436,8 +439,13 @@ int Interface::drawStatusBar(SURFACE *ds) {
string_w = _vm->_font->getStringWidth(SMALL_FONT_ID, _statusText, 0, 0);
+ if (_statusOnceColor == -1)
+ color = _vm->getDisplayInfo().statusTextColor;
+ else
+ color = _statusOnceColor;
+
_vm->_font->draw(SMALL_FONT_ID, ds, _statusText, 0, (_vm->getDisplayInfo().statusWidth / 2) - (string_w / 2),
- _vm->getDisplayInfo().statusY + _vm->getDisplayInfo().statusTextY, _vm->getDisplayInfo().statusTextColor, 0, 0);
+ _vm->getDisplayInfo().statusY + _vm->getDisplayInfo().statusTextY, color, 0, 0);
return SUCCESS;
}
@@ -742,15 +750,6 @@ bool Interface::converseAddText(const char *text, int replyId, byte replyFlags,
return false;
}
-enum converseColors {
- kColorBrightWhite = 0x2,
- kColorGrey = 0xa,
- kColorDarkGrey = 0xb,
- kColorGreen = 0xba,
- kColorBlack = 0xf,
- kColorBlue = 0x93
-};
-
void Interface::converseDisplayText(int pos) {
int end;
@@ -768,7 +767,7 @@ void Interface::converseDisplayText(int pos) {
_converseEndPos = end;
- converseDisplayTextLine(kColorBrightWhite, false, true);
+ converseDisplayTextLine(kITEColorBrightWhite, false, true);
}
@@ -796,10 +795,10 @@ void Interface::converseDisplayTextLine(int textcolor, bool btnDown, bool rebuil
&& _converseText[_conversePos].stringNum
== _converseText[relpos].stringNum) {
textcolors[0][i] = textcolor;
- textcolors[1][i] = (!btnDown) ? kColorDarkGrey : kColorGrey;
+ textcolors[1][i] = (!btnDown) ? kITEColorDarkGrey : kITEColorGrey;
} else {
- textcolors[0][i] = kColorBlue;
- textcolors[1][i] = kColorDarkGrey;
+ textcolors[0][i] = kITEColorBlue;
+ textcolors[1][i] = kITEColorDarkGrey;
}
}
// if no colors have changed, exit
@@ -813,7 +812,7 @@ void Interface::converseDisplayTextLine(int textcolor, bool btnDown, bool rebuil
rect.moveTo(_conversePanel.x + x, _conversePanel.y + y);
- drawRect(ds, &rect, kColorDarkGrey);
+ drawRect(ds, &rect, kITEColorDarkGrey);
rect.top = rect.left = 0;
rect.right = CONVERSE_MAX_TEXT_WIDTH;
@@ -836,13 +835,13 @@ void Interface::converseDisplayTextLine(int textcolor, bool btnDown, bool rebuil
byte tcolor, bcolor;
if (_converseText[relpos].textNum == 0) { // first entry
- tcolor = kColorGreen;
- bcolor = kColorBlack;
+ tcolor = kITEColorGreen;
+ bcolor = kITEColorBlack;
_vm->_font->draw(SMALL_FONT_ID, ds, bullet, strlen(bullet),
scrx + 2, scry, tcolor, bcolor, FONT_SHADOW | FONT_DONTMAP);
}
_vm->_font->draw(SMALL_FONT_ID, ds, str, strlen(str),
- scrx + 9, scry, foregnd, kColorBlack, FONT_SHADOW);
+ scrx + 9, scry, foregnd, kITEColorBlack, FONT_SHADOW);
}
}
@@ -853,7 +852,7 @@ void Interface::converseChangePos(int chg) {
if ((chg < 0 && _converseStartPos + chg >= 0) ||
(chg > 0 && _converseStartPos < _converseEndPos)) {
_converseStartPos += chg;
- converseDisplayTextLine(kColorBlue, false, true);
+ converseDisplayTextLine(kITEColorBlue, false, true);
}
}
@@ -865,7 +864,7 @@ void Interface::converseSetPos(int key) {
return;
// FIXME: wait until Andrew defines proper color
- converseSetTextLines(selection, kColorBrightWhite, false);
+ converseSetTextLines(selection, kITEColorBrightWhite, false);
ct = &_converseText[_conversePos];
diff --git a/saga/interface.h b/saga/interface.h
index 4781b84b69..d66acc8dfa 100644
--- a/saga/interface.h
+++ b/saga/interface.h
@@ -91,6 +91,16 @@ struct Converse {
int replyBit;
};
+enum ITEColors {
+ kITEColorBrightWhite = 0x2,
+ kITEColorGrey = 0xa,
+ kITEColorDarkGrey = 0xb,
+ kITEColorGreen = 0xba,
+ kITEColorBlack = 0xf,
+ kITEColorBlue = 0x93
+};
+
+
class Interface {
public:
Interface(SagaEngine *vm);
@@ -105,6 +115,7 @@ public:
void restoreMode();
bool isInMainMode() { return _inMainMode; }
int setStatusText(const char *new_txt);
+ void setStatusOnceColor(int color) { _statusOnceColor = color; }
int loadScenePortraits(int resourceId);
int setLeftPortrait(int portrait);
int setRightPortrait(int portrait);
@@ -165,6 +176,7 @@ private:
int _lockedMode;
bool _inMainMode;
char _statusText[STATUS_TEXT_LEN];
+ int _statusOnceColor;
int _leftPortrait;
int _rightPortrait;
diff --git a/saga/script.cpp b/saga/script.cpp
index e587456852..b75b963adc 100644
--- a/saga/script.cpp
+++ b/saga/script.cpp
@@ -563,7 +563,7 @@ void Script::scriptExec(int argc, const char **argv) {
}
// verb
-void Script::showVerb() {
+void Script::showVerb(int statuscolor) {
const char *verbName;
const char *object1Name;
const char *object2Name;
@@ -609,6 +609,8 @@ void Script::showVerb() {
_vm->_interface->setStatusText(statusString);
}
}
+ if (statuscolor != -1)
+ _vm->_interface->setStatusOnceColor(statuscolor);
}
void Script::setVerb(int verb) {
@@ -683,7 +685,6 @@ void Script::doVerb() {
if ((hitZone->getFlags() & kHitZoneExit) == 0) {
scriptEntrypointNumber = hitZone->getScriptNumber();
}
-
} else {
if (objectType & (kGameObjectActor | kGameObjectObject)) {
scriptEntrypointNumber = _vm->_actor->getObjectScriptEntrypointNumber(_pendingObject[0]);
@@ -752,11 +753,10 @@ void Script::hitObject(bool leftButton) {
_pendingVerb = verb;
_leftButtonVerb = verb;
- if (_pendingVerb > kVerbNone) {
- // statusColor = BRIGHT_WHITE;
- }
- showVerb();
- /*statusColor = GREEN_BA;*/
+ if (_pendingVerb > kVerbNone)
+ showVerb(kITEColorBrightWhite);
+ else
+ showVerb();
_secondObjectNeeded = false;
_firstObjectSet = false;
@@ -787,11 +787,10 @@ void Script::hitObject(bool leftButton) {
}
_leftButtonVerb = verb;
- if (_pendingVerb > kVerbNone) {
- // statusColor = BRIGHT_WHITE;
- }
- showVerb();
- //statusColor = GREEN_BA;
+ if (_pendingVerb > kVerbNone)
+ showVerb(kITEColorBrightWhite);
+ else
+ showVerb();
}
}
diff --git a/saga/script.h b/saga/script.h
index 0a9861e163..8bf227e6c8 100644
--- a/saga/script.h
+++ b/saga/script.h
@@ -262,7 +262,7 @@ public:
const char * getScriptString(int index) const { return _currentScript->strings.getString(index); }
void doVerb();
- void showVerb();
+ void showVerb(int statuscolor = -1);
void setVerb(int verb);
int getCurrentVerb() const { return _currentVerb; }
void setPointerVerb();
diff --git a/saga/sthread.cpp b/saga/sthread.cpp
index 6fbc253775..06742837c7 100644
--- a/saga/sthread.cpp
+++ b/saga/sthread.cpp
@@ -260,7 +260,7 @@ void Script::runThread(ScriptThread *thread, int instr_limit) {
// debug print (opCode name etc) should be placed here
// SDebugPrintInstr(thread)
-// debug(2, "Executing thread offset: %lu (%x) stack: %d", thread->instructionOffset, operandChar, thread->stackSize());
+ debug(8, "Executing thread offset: %lu (%x) stack: %d", thread->instructionOffset, operandChar, thread->stackSize());
switch (operandChar) {
case 0x01: // nextblock
// Some sort of "jump to the start of the next memory
@@ -463,6 +463,7 @@ void Script::runThread(ScriptThread *thread, int instr_limit) {
data = thread->pop();
n_switch = scriptS.readUint16LE();
+
for (i = 0; i < n_switch; i++) {
switch_num = scriptS.readUint16LE();
switch_jmp = scriptS.readUint16LE();