aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/mads/assets.cpp30
-rw-r--r--engines/mads/assets.h34
-rw-r--r--engines/mads/events.cpp19
-rw-r--r--engines/mads/events.h30
-rw-r--r--engines/mads/game.cpp11
-rw-r--r--engines/mads/game.h9
-rw-r--r--engines/mads/mads.cpp1
-rw-r--r--engines/mads/module.mk1
-rw-r--r--engines/mads/palette.cpp64
-rw-r--r--engines/mads/palette.h23
10 files changed, 222 insertions, 0 deletions
diff --git a/engines/mads/assets.cpp b/engines/mads/assets.cpp
new file mode 100644
index 0000000000..7c1b169396
--- /dev/null
+++ b/engines/mads/assets.cpp
@@ -0,0 +1,30 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "common/scummsys.h"
+#include "mads/mads.h"
+#include "mads/events.h"
+
+namespace MADS {
+
+
+} // End of namespace MADS
diff --git a/engines/mads/assets.h b/engines/mads/assets.h
new file mode 100644
index 0000000000..dcd7390b75
--- /dev/null
+++ b/engines/mads/assets.h
@@ -0,0 +1,34 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef MADS_ASSETS_H
+#define MADS_ASSETS_H
+
+#include "common/scummsys.h"
+#include "mads/msprite.h"
+
+namespace MADS {
+
+
+} // End of namespace MADS
+
+#endif /* MADS_ASSETS_H */
diff --git a/engines/mads/events.cpp b/engines/mads/events.cpp
index 0950ac02d2..ec0628710c 100644
--- a/engines/mads/events.cpp
+++ b/engines/mads/events.cpp
@@ -30,6 +30,25 @@ namespace MADS {
EventsManager::EventsManager(MADSEngine *vm) {
_vm = vm;
+ _cursorSprites = nullptr;
+}
+
+EventsManager::~EventsManager() {
+ delete _cursorSprites;
+}
+
+void EventsManager::loadCursors(const Common::String &spritesName) {
+ error("TODO: load SpriteSet");
+}
+
+void EventsManager::setCursor(CursorType cursorId) {
+ _cursorId = cursorId;
+ _newCursorId = cursorId;
+ changeCursor();
+}
+
+void EventsManager::changeCursor() {
+
}
void EventsManager::handleEvents() {
diff --git a/engines/mads/events.h b/engines/mads/events.h
index 33d5c8e31b..860f36d69f 100644
--- a/engines/mads/events.h
+++ b/engines/mads/events.h
@@ -24,17 +24,47 @@
#define MADS_EVENTS_H
#include "common/scummsys.h"
+#include "mads/msprite.h"
namespace MADS {
+enum CursorType { CURSOR_NONE = 0, CURSOR_ARROW = 1, CURSOR_WAIT = 2, CURSOR_GO_DOWN = 3,
+ CURSOR_GO_UP = 4, CURSOR_GO_LEFT = 5, CURSOR_GO_RIGHT = 6 };
+
class MADSEngine;
class EventsManager {
private:
MADSEngine *_vm;
+ CursorType _cursorId;
+ CursorType _newCursorId;
+ void *_cursorSprites;
+
+ /**
+ * Updates the cursor image when the current cursor changes
+ */
+ void changeCursor();
public:
+ /**
+ * Constructor
+ */
EventsManager(MADSEngine *vm);
+ /**
+ * Destructor
+ */
+ ~EventsManager();
+
+ /**
+ * Loads the sprite set containing the cursors
+ */
+ void loadCursors(const Common::String &spritesName);
+
+ /**
+ * Sets the cursor
+ */
+ void setCursor(CursorType cursorId);
+
void handleEvents();
};
diff --git a/engines/mads/game.cpp b/engines/mads/game.cpp
index 0a04fda6cf..48c79ba32d 100644
--- a/engines/mads/game.cpp
+++ b/engines/mads/game.cpp
@@ -37,6 +37,7 @@ Game *Game::init(MADSEngine *vm) {
}
Game::Game(MADSEngine *vm): _vm(vm), _surface(nullptr) {
+ _sectionNumber = _priorSectionNumber = 0;
}
Game::~Game() {
@@ -48,4 +49,14 @@ void Game::run() {
return;
}
+void Game::initSection(int sectionNumber) {
+ _priorSectionNumber = _sectionNumber;
+ _sectionNumber = sectionNumber;
+
+ _vm->_palette->resetGamePalette(18, 10);
+ _vm->_palette->setLowRange();
+
+ // TODO
+}
+
} // End of namespace MADS
diff --git a/engines/mads/game.h b/engines/mads/game.h
index 2f0dcf7d48..bb15a8e35b 100644
--- a/engines/mads/game.h
+++ b/engines/mads/game.h
@@ -40,9 +40,18 @@ protected:
* Perform any copy protection check
*/
virtual bool checkCopyProtection() = 0;
+
+ /**
+ * Initialises the current section number of the game
+ */
+ void initSection(int sectionNumber);
+
public:
static Game *init(MADSEngine *vm);
public:
+ int _sectionNumber;
+ int _priorSectionNumber;
+public:
virtual ~Game();
/**
diff --git a/engines/mads/mads.cpp b/engines/mads/mads.cpp
index 827c62ac61..687852a59b 100644
--- a/engines/mads/mads.cpp
+++ b/engines/mads/mads.cpp
@@ -81,6 +81,7 @@ void MADSEngine::initialise() {
_userInterface = UserInterface::init(this);
_game = Game::init(this);
+ _events->loadCursors("*CURSOR.SS");
_screen->empty();
}
diff --git a/engines/mads/module.mk b/engines/mads/module.mk
index 179c1979b4..ec85355abb 100644
--- a/engines/mads/module.mk
+++ b/engines/mads/module.mk
@@ -4,6 +4,7 @@ MODULE_OBJS := \
nebular/dialogs_nebular.o \
nebular/game_nebular.o \
nebular/sound_nebular.o \
+ assets.o \
compression.o \
detection.o \
dialogs.o \
diff --git a/engines/mads/palette.cpp b/engines/mads/palette.cpp
index c858984a52..2d7bd42f29 100644
--- a/engines/mads/palette.cpp
+++ b/engines/mads/palette.cpp
@@ -310,4 +310,68 @@ void Palette::setSystemPalette() {
blockRange(0, 4);
}
+void Palette::resetGamePalette(int lowRange, int highRange) {
+ Common::fill((byte *)&_gamePalette[0], (byte *)&_gamePalette[PALETTE_COUNT], 0);
+ initRange(_mainPalette);
+
+ // Init low range to common RGB values
+ if (lowRange) {
+ _gamePalette[0].r = 1;
+ _gamePalette[0].b = 0;
+
+ Common::fill(&_gamePalette[1], &_gamePalette[lowRange - 1], _gamePalette[0]);
+ }
+
+ // Init high range to common RGB values
+ if (highRange) {
+ _gamePalette[255].r = 1;
+ _gamePalette[255].b = 0;
+
+ Common::fill(&_gamePalette[255 - highRange], &_gamePalette[254], _gamePalette[255]);
+ }
+}
+
+void Palette::initRange(byte *palette) {
+ int var6 = 0;
+ int vdx = 0;
+ int vbx = 0;
+ do {
+ int vdi = (vdx == 1) ? 0 : 0x2A;
+ int var8 = 0;
+ int varE = vbx;
+ int var10 = vdx;
+ do {
+ int vdx = 0;
+ do {
+ int vcx = 0;
+ int var4 = vdx;
+ do {
+ int var2 = var6 + vcx;
+ byte *destP = &palette[var2 * 3];
+
+ destP[0] = (var8) ? vdi & 0xFF : vbx & 0XFF;
+ destP[1] = (var4) ? vdi & 0xFF : vbx & 0XFF;
+ destP[2] = (vcx) ? vdi & 0xFF : vbx & 0XFF;
+ } while (++vcx < 2);
+
+ var6 += 2;
+ vdx = var4;
+ } while (++vdx < 2);
+ } while (++var8 < 2);
+
+ vdx = var10 + 1;
+ vbx = varE + 21;
+ } while (vbx < 42);
+
+ palette[19] = 21;
+}
+
+void Palette::setLowRange() {
+ _mainPalette[0] = _mainPalette[1] = _mainPalette[2] = 0;
+ _mainPalette[3] = _mainPalette[4] = _mainPalette[5] = 0x15;
+ _mainPalette[6] = _mainPalette[7] = _mainPalette[8] = 0x2A;
+ _mainPalette[9] = _mainPalette[10] = _mainPalette[11] = 0x3F;
+ _vm->_palette->setPalette(_mainPalette, 0, 4);
+}
+
} // End of namespace MADS
diff --git a/engines/mads/palette.h b/engines/mads/palette.h
index 0ef8693a1f..53620d8fff 100644
--- a/engines/mads/palette.h
+++ b/engines/mads/palette.h
@@ -29,6 +29,13 @@ namespace MADS {
class MADSEngine;
+struct RGB4 {
+ byte r;
+ byte g;
+ byte b;
+ byte u;
+};
+
/**
* Used to store a list of RGB values
*/
@@ -75,6 +82,11 @@ private:
*/
void fadeRange(byte *srcPal, byte *destPal, int startIndex, int endIndex,
int numSteps, uint delayAmount);
+
+ /**
+ * Initialises a stanadrd range of colours for the given palette
+ */
+ void initRange(byte *palette);
protected:
MADSEngine *_vm;
bool _colorsChanged;
@@ -87,6 +99,7 @@ protected:
void reset();
public:
byte _mainPalette[PALETTE_SIZE];
+ RGB4 _gamePalette[PALETTE_COUNT];
public:
/**
* Constructor
@@ -171,6 +184,16 @@ public:
*/
static void setGradient(byte *palette, int start, int count, int rgbValue1, int rgbValue2);
+ /**
+ * Resets the game palette
+ */
+ void resetGamePalette(int v1, int v2);
+
+ /**
+ * Set the first four palette entries with preset values
+ */
+ void setLowRange();
+
// Color indexes
uint8 BLACK;
uint8 BLUE;