aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/xeen/dialogs_party.cpp5
-rw-r--r--engines/xeen/interface.cpp31
-rw-r--r--engines/xeen/interface.h15
-rw-r--r--engines/xeen/party.cpp6
-rw-r--r--engines/xeen/resources.cpp66
-rw-r--r--engines/xeen/resources.h2
-rw-r--r--engines/xeen/screen.cpp17
-rw-r--r--engines/xeen/screen.h2
-rw-r--r--engines/xeen/spells.cpp2
9 files changed, 106 insertions, 40 deletions
diff --git a/engines/xeen/dialogs_party.cpp b/engines/xeen/dialogs_party.cpp
index e1e080a1db..39b4615ad5 100644
--- a/engines/xeen/dialogs_party.cpp
+++ b/engines/xeen/dialogs_party.cpp
@@ -45,6 +45,7 @@ void PartyDialog::show(XeenEngine *vm) {
void PartyDialog::execute() {
EventsManager &events = *_vm->_events;
+ Interface &intf = *_vm->_interface;
Map &map = *_vm->_map;
Party &party = *_vm->_party;
Screen &screen = *_vm->_screen;
@@ -118,9 +119,9 @@ void PartyDialog::execute() {
ErrorScroll::show(_vm, Res.NO_ONE_TO_ADVENTURE_WITH);
} else {
if (_vm->_mode != MODE_0) {
- for (int idx = 4; idx >= 0; --idx) {
+ for (int idx = OBSCURITY_NONE; idx >= OBSCURITY_BLACK; --idx) {
events.updateGameCounter();
- screen.frameWindow(idx);
+ intf.obscureScene((Obscurity)idx);
w.update();
while (events.timeElapsed() < 1)
diff --git a/engines/xeen/interface.cpp b/engines/xeen/interface.cpp
index 3147d0a47e..458c89cc00 100644
--- a/engines/xeen/interface.cpp
+++ b/engines/xeen/interface.cpp
@@ -134,7 +134,7 @@ void PartyDrawer::resetHighlight() {
Interface::Interface(XeenEngine *vm) : ButtonContainer(vm), InterfaceScene(vm),
PartyDrawer(vm), _vm(vm) {
_buttonsLoaded = false;
- _intrIndex1 = 0;
+ _obscurity = OBSCURITY_NONE;
_steppingFX = 0;
_falling = false;
_blessedUIFrame = 0;
@@ -1269,6 +1269,9 @@ void Interface::draw3d(bool updateFlag, bool pauseFlag) {
// Draw the minimap
drawMinimap();
+ // Handle any darkness-based oscurity
+ obscureScene(_obscurity);
+
if (_falling == 1)
handleFalling();
@@ -1903,5 +1906,31 @@ void Interface::spellFX(Character *c) {
_tillMove = tillMove;
}
+void Interface::obscureScene(Obscurity obscurity) {
+ Screen &screen = *g_vm->_screen;
+ const byte *lookup;
+
+ switch (obscurity) {
+ case OBSCURITY_BLACK:
+ // Totally dark (black) background
+ screen.fillRect(Common::Rect(8, 8, 224, 140), 0);
+ break;
+
+ case OBSCURITY_1:
+ case OBSCURITY_2:
+ case OBSCURITY_3:
+ lookup = &Res.DARKNESS_XLAT[obscurity - 1][0];
+ for (int yp = 8; yp < 140; ++yp) {
+ byte *destP = (byte *)screen.getBasePtr(8, yp);
+ for (int xp = 8; xp < 224; ++xp, ++destP)
+ *destP = lookup[*destP];
+ }
+ break;
+
+ default:
+ // Full daylight, so no obscurity
+ break;
+ }
+}
} // End of namespace Xeen
diff --git a/engines/xeen/interface.h b/engines/xeen/interface.h
index 48d75ab8a0..a249e6f025 100644
--- a/engines/xeen/interface.h
+++ b/engines/xeen/interface.h
@@ -34,6 +34,14 @@ namespace Xeen {
class XeenEngine;
+enum Obscurity {
+ OBSCURITY_BLACK = 0,
+ OBSCURITY_3 = 1,
+ OBSCURITY_2 = 2,
+ OBSCURITY_1 = 3,
+ OBSCURITY_NONE = 4
+};
+
#define HILIGHT_CHAR_DISABLED -2
#define HILIGHT_CHAR_NONE -1
@@ -123,7 +131,7 @@ private:
*/
void nextChar();
public:
- int _intrIndex1;
+ Obscurity _obscurity;
Common::String _interfaceText;
int _falling;
int _face1State, _face2State;
@@ -181,6 +189,11 @@ public:
void doCombat();
void spellFX(Character *c);
+
+ /**
+ * Optionally obscures the scene due to low light conditions
+ */
+ void obscureScene(Obscurity obscurity);
};
} // End of namespace Xeen
diff --git a/engines/xeen/party.cpp b/engines/xeen/party.cpp
index ce30859c1f..abedaa46ed 100644
--- a/engines/xeen/party.cpp
+++ b/engines/xeen/party.cpp
@@ -462,6 +462,7 @@ void Party::resetTemps() {
}
void Party::handleLight() {
+ Interface &intf = *_vm->_interface;
Map &map = *_vm->_map;
if (_stepped) {
@@ -474,8 +475,9 @@ void Party::handleLight() {
}
}
- _vm->_interface->_intrIndex1 = _lightCount ||
- (map.mazeData()._mazeFlags2 & FLAG_IS_DARK) == 0 ? 4 : 0;
+ // Set whether the scene is completely dark or not
+ intf._obscurity = _lightCount ||
+ (map.mazeData()._mazeFlags2 & FLAG_IS_DARK) == 0 ? OBSCURITY_NONE : OBSCURITY_BLACK;
}
int Party::subtract(ConsumableType consumableId, uint amount, PartyBank whereId, ErrorWaitType wait) {
diff --git a/engines/xeen/resources.cpp b/engines/xeen/resources.cpp
index 1f3c241341..c60897cb81 100644
--- a/engines/xeen/resources.cpp
+++ b/engines/xeen/resources.cpp
@@ -387,19 +387,59 @@ const char *const Resources::NO_ONE_TO_ADVENTURE_WITH = "You have no one to adve
const char *const Resources::YOUR_ROSTER_IS_FULL = "Your Roster is full!";
-const byte Resources::BACKGROUND_XLAT[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0xF7, 0xFF, 0x09, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0xF9, 0xFF, 0x07, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0xF7, 0xFF, 0x09, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0xF5, 0xFF, 0x0B, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0xF3, 0xFF, 0x0D, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00
+const byte Resources::DARKNESS_XLAT[3][256] = {
+ {
+ 0, 25, 26, 27, 28, 29, 30, 31, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 44, 45, 46, 47, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 60, 61, 62, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 76, 77, 78, 79, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 92, 93, 94, 95, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 108, 109, 110, 111, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 124, 125, 126, 127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 140, 141, 142, 143, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 168, 169, 170, 171, 172, 173, 174, 175, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 188, 189, 190, 191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 204, 205, 206, 207, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 220, 221, 222, 223, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 236, 237, 238, 239, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 252, 253, 254, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+ }, {
+ 0, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 40, 41, 42, 43, 44, 45, 46, 47, 0, 0, 0, 0, 0, 0, 0, 0,
+ 56, 57, 58, 59, 60, 61, 62, 63, 0, 0, 0, 0, 0, 0, 0, 0,
+ 72, 73, 74, 75, 76, 77, 78, 79, 0, 0, 0, 0, 0, 0, 0, 0,
+ 88, 89, 90, 91, 92, 93, 94, 95, 0, 0, 0, 0, 0, 0, 0, 0,
+ 104, 105, 106, 107, 108, 109, 110, 111, 0, 0, 0, 0, 0, 0, 0, 0,
+ 120, 121, 122, 123, 124, 125, 126, 127, 0, 0, 0, 0, 0, 0, 0, 0,
+ 136, 137, 138, 139, 140, 141, 142, 143, 0, 0, 0, 0, 0, 0, 0, 0,
+ 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 184, 185, 186, 187, 188, 189, 190, 191, 0, 0, 0, 0, 0, 0, 0, 0,
+ 200, 201, 202, 203, 204, 205, 206, 207, 0, 0, 0, 0, 0, 0, 0, 0,
+ 216, 217, 218, 219, 220, 221, 222, 223, 0, 0, 0, 0, 0, 0, 0, 0,
+ 232, 233, 234, 235, 236, 237, 238, 239, 0, 0, 0, 0, 0, 0, 0, 0,
+ 248, 249, 250, 251, 252, 253, 254, 255, 0, 0, 0, 0, 0, 0, 0, 0
+ }, {
+ 0, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
+ 24, 25, 26, 27, 28, 29, 30, 31, 0, 0, 0, 0, 0, 0, 0, 0,
+ 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 0, 0, 0, 0,
+ 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 0, 0, 0, 0,
+ 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 0, 0, 0, 0,
+ 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 0, 0, 0, 0,
+ 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 0, 0, 0, 0,
+ 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 0, 0, 0, 0,
+ 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 0, 0, 0, 0,
+ 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167,
+ 168, 169, 170, 171, 172, 173, 174, 175, 0, 0, 0, 0, 0, 0, 0, 0,
+ 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 0, 0, 0, 0,
+ 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 0, 0, 0, 0,
+ 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 0, 0, 0, 0,
+ 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 0, 0, 0, 0,
+ 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 0, 0, 0, 0
+ }
};
const char *const Resources::PLEASE_WAIT = "\014""d\003""c\011""000"
diff --git a/engines/xeen/resources.h b/engines/xeen/resources.h
index 1ad6cfff61..dab3dffd8d 100644
--- a/engines/xeen/resources.h
+++ b/engines/xeen/resources.h
@@ -80,7 +80,7 @@ public:
static const int CHAR_FACES_X[6];
static const int HP_BARS_X[6];
static const char *const NO_ONE_TO_ADVENTURE_WITH;
- static const byte BACKGROUND_XLAT[];
+ static const byte DARKNESS_XLAT[3][256];
static const char *const YOUR_ROSTER_IS_FULL;
static const char *const PLEASE_WAIT;
static const char *const OOPS;
diff --git a/engines/xeen/screen.cpp b/engines/xeen/screen.cpp
index 54d0b8f4fd..1561c82488 100644
--- a/engines/xeen/screen.cpp
+++ b/engines/xeen/screen.cpp
@@ -169,21 +169,4 @@ void Screen::restoreBackground(int slot) {
blitFrom(_savedScreens[slot - 1]);
}
-void Screen::frameWindow(uint bgType) {
- if (bgType >= 4)
- return;
-
- if (bgType == 0) {
- // Totally black background
- _vm->_screen->fillRect(Common::Rect(8, 8, 224, 140), 0);
- } else {
- const byte *lookup = Res.BACKGROUND_XLAT + bgType;
- for (int yp = 8; yp < 140; ++yp) {
- byte *destP = (byte *)_vm->_screen->getBasePtr(8, yp);
- for (int xp = 8; xp < 224; ++xp, ++destP)
- *destP = lookup[*destP];
- }
- }
-}
-
} // End of namespace Xeen
diff --git a/engines/xeen/screen.h b/engines/xeen/screen.h
index eebc192712..0880042fd6 100644
--- a/engines/xeen/screen.h
+++ b/engines/xeen/screen.h
@@ -102,8 +102,6 @@ public:
void saveBackground(int slot = 1);
void restoreBackground(int slot = 1);
-
- void frameWindow(uint bgType);
};
} // End of namespace Xeen
diff --git a/engines/xeen/spells.cpp b/engines/xeen/spells.cpp
index 4e40c01761..255e5ceb55 100644
--- a/engines/xeen/spells.cpp
+++ b/engines/xeen/spells.cpp
@@ -816,7 +816,7 @@ void Spells::light() {
Sound &sound = *_vm->_sound;
++party._lightCount;
- if (intf._intrIndex1)
+ if (intf._obscurity != OBSCURITY_BLACK)
party._stepped = true;
sound.playFX(39);
}