2017-05-31 18:49:03 +02:00
|
|
|
/* 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 SUPERNOVA_H
|
|
|
|
#define SUPERNOVA_H
|
|
|
|
|
2017-06-03 22:58:42 +02:00
|
|
|
#include "audio/audiostream.h"
|
|
|
|
#include "audio/mixer.h"
|
|
|
|
#include "audio/decoders/raw.h"
|
|
|
|
#include "common/array.h"
|
2017-05-31 18:49:03 +02:00
|
|
|
#include "common/random.h"
|
2017-06-03 22:58:42 +02:00
|
|
|
#include "common/scummsys.h"
|
2017-06-18 21:04:23 +02:00
|
|
|
#include "common/events.h"
|
2017-05-31 18:49:03 +02:00
|
|
|
#include "engines/engine.h"
|
|
|
|
|
|
|
|
#include "supernova/console.h"
|
2017-06-03 22:58:42 +02:00
|
|
|
#include "supernova/graphics.h"
|
2017-06-18 21:04:23 +02:00
|
|
|
#include "supernova/rooms.h"
|
2017-06-09 06:47:56 +02:00
|
|
|
#include "supernova/msn_def.h"
|
2017-05-31 18:49:03 +02:00
|
|
|
|
2017-06-18 21:04:23 +02:00
|
|
|
|
2017-05-31 18:49:03 +02:00
|
|
|
namespace Supernova {
|
|
|
|
|
2017-06-18 17:05:21 +02:00
|
|
|
struct ScreenBuffer {
|
|
|
|
ScreenBuffer()
|
|
|
|
: _x(0)
|
|
|
|
, _y(0)
|
|
|
|
, _width(0)
|
|
|
|
, _height(0)
|
|
|
|
, _pitch(0)
|
|
|
|
, _pixels(0)
|
|
|
|
{}
|
|
|
|
|
|
|
|
byte *_pixels;
|
|
|
|
int _x;
|
|
|
|
int _y;
|
|
|
|
int _width;
|
|
|
|
int _height;
|
|
|
|
int _pitch;
|
|
|
|
};
|
|
|
|
class ScreenBufferStack {
|
|
|
|
public:
|
|
|
|
ScreenBufferStack();
|
|
|
|
|
|
|
|
void push(int x, int y, int width, int height, int pitch = 320);
|
|
|
|
void restore();
|
|
|
|
|
|
|
|
private:
|
|
|
|
ScreenBuffer _buffer[8];
|
|
|
|
ScreenBuffer *_last;
|
|
|
|
};
|
|
|
|
|
2017-05-31 18:49:03 +02:00
|
|
|
class SupernovaEngine : public Engine {
|
|
|
|
public:
|
|
|
|
SupernovaEngine(OSystem *syst);
|
|
|
|
~SupernovaEngine();
|
|
|
|
|
|
|
|
virtual Common::Error run();
|
|
|
|
|
|
|
|
Common::RandomSource *_rnd;
|
|
|
|
Console *_console;
|
2017-06-03 22:58:42 +02:00
|
|
|
Audio::SoundHandle _soundHandle;
|
2017-06-18 21:04:23 +02:00
|
|
|
ScreenBufferStack _screenBuffer;
|
|
|
|
MSNImageDecoder _currentImage;
|
|
|
|
Common::Event _event;
|
2017-06-05 16:27:06 +02:00
|
|
|
bool _gameRunning;
|
2017-06-18 21:04:23 +02:00
|
|
|
|
2017-06-13 14:24:13 +02:00
|
|
|
byte _imageIndex;
|
|
|
|
byte _sectionIndex;
|
2017-06-10 00:17:19 +02:00
|
|
|
byte _menuBrightness;
|
|
|
|
byte _brightness;
|
2017-06-13 20:22:37 +02:00
|
|
|
uint _delay;
|
2017-06-18 18:28:01 +02:00
|
|
|
bool _messageDisplayed;
|
2017-06-21 07:45:25 +02:00
|
|
|
int _textCursorX;
|
|
|
|
int _textCursorY;
|
|
|
|
int _textColor;
|
2017-06-15 22:57:59 +02:00
|
|
|
|
2017-06-21 12:55:20 +02:00
|
|
|
int getDOSTicks();
|
2017-06-03 22:58:42 +02:00
|
|
|
void initData();
|
2017-06-05 16:27:06 +02:00
|
|
|
void initPalette();
|
2017-06-10 00:17:19 +02:00
|
|
|
void paletteFadeIn();
|
|
|
|
void paletteFadeOut();
|
|
|
|
void paletteBrightness();
|
2017-06-05 16:27:06 +02:00
|
|
|
void updateEvents();
|
2017-06-03 22:58:42 +02:00
|
|
|
void playSound(int filenumber, int offset = 0);
|
2017-06-05 16:27:06 +02:00
|
|
|
void playSoundMod(int filenumber);
|
2017-06-03 22:58:42 +02:00
|
|
|
void stopSound();
|
2017-06-13 20:22:37 +02:00
|
|
|
void renderImage(int filenumber, int section, bool fullscreen = false);
|
2017-06-18 21:04:23 +02:00
|
|
|
void saveScreen(int x, int y, int width, int height);
|
|
|
|
void restoreScreen();
|
|
|
|
void renderRoom(Room &room);
|
2017-06-18 18:28:01 +02:00
|
|
|
void renderMessage(const char *text, MessagePosition position = kMessageNormal);
|
|
|
|
void removeMessage();
|
2017-06-09 06:47:56 +02:00
|
|
|
void renderText(const char *text, int x, int y, byte color);
|
2017-06-21 07:45:25 +02:00
|
|
|
void renderText(const char *text);
|
2017-06-07 18:34:11 +02:00
|
|
|
void renderBox(int x, int y, int width, int height, byte color);
|
2017-06-18 21:04:23 +02:00
|
|
|
void setColor63(byte value);
|
2017-05-31 18:49:03 +02:00
|
|
|
};
|
|
|
|
|
2017-06-18 18:28:01 +02:00
|
|
|
|
2017-06-15 22:57:59 +02:00
|
|
|
class Inventory {
|
|
|
|
public:
|
|
|
|
Inventory();
|
|
|
|
|
|
|
|
void add(Object &obj);
|
|
|
|
void remove(Object &obj);
|
2017-06-18 18:20:46 +02:00
|
|
|
Object *get(size_t index) const;
|
|
|
|
Object *get(ObjectID id) const;
|
2017-06-15 22:57:59 +02:00
|
|
|
|
|
|
|
private:
|
|
|
|
Object *_inventory[kMaxCarry];
|
|
|
|
size_t _numObjects;
|
|
|
|
};
|
|
|
|
|
2017-06-18 21:04:23 +02:00
|
|
|
class GameManager {
|
|
|
|
public:
|
|
|
|
GameManager(SupernovaEngine *vm, Common::Event *event);
|
|
|
|
|
|
|
|
void processInput();
|
|
|
|
void executeRoom();
|
|
|
|
|
|
|
|
SupernovaEngine *_vm;
|
|
|
|
Common::Event *_event;
|
|
|
|
uint16 _key;
|
|
|
|
Room *_currentRoom;
|
|
|
|
Room _rooms[kRoomsNum];
|
|
|
|
Inventory _inventory;
|
|
|
|
GameState _state;
|
2017-06-21 13:09:55 +02:00
|
|
|
int _status;
|
2017-06-18 21:04:23 +02:00
|
|
|
Action _inputVerb;
|
|
|
|
Object _inputObject[2];
|
|
|
|
bool _waitEvent;
|
|
|
|
bool _newRoom;
|
|
|
|
bool _newOverlay;
|
|
|
|
int _timer1;
|
|
|
|
int _timer2;
|
2017-06-21 13:09:55 +02:00
|
|
|
// 0 PC Speaker | 1 SoundBlaster | 2 No Sound
|
|
|
|
int _soundDevice;
|
2017-06-18 21:04:23 +02:00
|
|
|
|
|
|
|
void takeObject(Object &obj);
|
|
|
|
|
|
|
|
bool genericInteract(Action verb, Object &obj1, Object &obj2);
|
|
|
|
bool isHelmetOff();
|
|
|
|
void great(uint number);
|
|
|
|
bool airless();
|
2017-06-21 12:58:39 +02:00
|
|
|
void shock();
|
2017-06-18 22:16:02 +02:00
|
|
|
void mouseInput();
|
|
|
|
void mouseInput2();
|
|
|
|
void mouseInput3();
|
2017-06-21 12:58:39 +02:00
|
|
|
void mouseWait(int delay);
|
|
|
|
void wait2(int delay);
|
|
|
|
void turnOff();
|
|
|
|
void turnOn();
|
2017-06-20 11:21:18 +02:00
|
|
|
void screenShake();
|
2017-06-21 12:58:39 +02:00
|
|
|
void loadTime();
|
2017-06-20 11:21:18 +02:00
|
|
|
void saveTime();
|
2017-06-21 12:58:39 +02:00
|
|
|
bool saveGame(int number);
|
2017-06-20 11:21:18 +02:00
|
|
|
void errorTemp();
|
2017-06-18 22:16:02 +02:00
|
|
|
void roomBrightness();
|
2017-06-18 21:04:23 +02:00
|
|
|
void palette();
|
2017-06-18 22:16:02 +02:00
|
|
|
void showMenu();
|
|
|
|
void drawMapExits();
|
|
|
|
void animationOff();
|
|
|
|
void animationOn();
|
|
|
|
void loadOverlayStart();
|
2017-06-21 12:58:39 +02:00
|
|
|
void openLocker(const Room *room, Object *obj, Object *lock, int section);
|
|
|
|
void closeLocker(const Room *room, Object *obj, Object *lock, int section);
|
|
|
|
void edit(char *text, int x, int y, int length);
|
2017-06-18 21:04:23 +02:00
|
|
|
int invertSection(int section);
|
|
|
|
};
|
|
|
|
|
2017-05-31 18:49:03 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|