mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-21 03:31:40 +00:00
T7G: Stage one of move to ScummVM's CursorMan: rename groovie one so it doesn't have same name
svn-id: r35793
This commit is contained in:
parent
8eb7d55eca
commit
9446bfa503
@ -28,33 +28,28 @@
|
||||
|
||||
#include "graphics/cursorman.h"
|
||||
|
||||
// HACK: Since CursorMan is the name of the global
|
||||
// cursor manager we just undefine it here
|
||||
#define GlobCursorMan (::Graphics::CursorManager::instance())
|
||||
#undef CursorMan
|
||||
|
||||
namespace Groovie {
|
||||
|
||||
// Cursor Manager
|
||||
|
||||
CursorMan::CursorMan(OSystem *system) :
|
||||
GrvCursorMan::GrvCursorMan(OSystem *system) :
|
||||
_syst(system), _lastTime(0), _current(0), _cursor(NULL) {
|
||||
}
|
||||
|
||||
CursorMan::~CursorMan() {
|
||||
GrvCursorMan::~GrvCursorMan() {
|
||||
// Delete the cursors
|
||||
for (uint cursor = 0; cursor < _cursors.size(); cursor++) {
|
||||
delete _cursors[cursor];
|
||||
}
|
||||
|
||||
GlobCursorMan.popAllCursors();
|
||||
CursorMan.popAllCursors();
|
||||
}
|
||||
|
||||
uint8 CursorMan::getStyle() {
|
||||
uint8 GrvCursorMan::getStyle() {
|
||||
return _current;
|
||||
}
|
||||
|
||||
void CursorMan::setStyle(uint8 newStyle) {
|
||||
void GrvCursorMan::setStyle(uint8 newStyle) {
|
||||
// Reset the animation
|
||||
_lastFrame = 254;
|
||||
_lastTime = 1;
|
||||
@ -68,7 +63,7 @@ void CursorMan::setStyle(uint8 newStyle) {
|
||||
animate();
|
||||
}
|
||||
|
||||
void CursorMan::animate() {
|
||||
void GrvCursorMan::animate() {
|
||||
if (_lastTime) {
|
||||
int newTime = _syst->getMillis();
|
||||
if (_lastTime - newTime >= 75) {
|
||||
@ -113,13 +108,13 @@ Cursor_t7g::Cursor_t7g(OSystem *system, uint8 *img, uint8 *pal) :
|
||||
|
||||
void Cursor_t7g::enable() {
|
||||
// Apply the palette
|
||||
GlobCursorMan.replaceCursorPalette(_pal, 0, 32);
|
||||
CursorMan.replaceCursorPalette(_pal, 0, 32);
|
||||
}
|
||||
|
||||
void Cursor_t7g::showFrame(uint16 frame) {
|
||||
// Set the mouse cursor
|
||||
int offset = _width * _height * frame;
|
||||
GlobCursorMan.replaceCursor((const byte *)_img + offset, _width, _height, _width >> 1, _height >> 1, 0);
|
||||
CursorMan.replaceCursor((const byte *)_img + offset, _width, _height, _width >> 1, _height >> 1, 0);
|
||||
}
|
||||
|
||||
|
||||
@ -135,11 +130,11 @@ static const uint16 cursorDataOffsets[NUM_IMGS] = {
|
||||
|
||||
#define NUM_STYLES 11
|
||||
// pyramid is cursor 8, eyes are 9 & 10
|
||||
const uint CursorMan_t7g::_cursorImg[NUM_STYLES] = {3, 5, 4, 3, 1, 0, 2, 6, 7, 8, 8};
|
||||
const uint CursorMan_t7g::_cursorPal[NUM_STYLES] = {0, 0, 0, 0, 2, 0, 1, 3, 5, 4, 6};
|
||||
const uint GrvCursorMan_t7g::_cursorImg[NUM_STYLES] = {3, 5, 4, 3, 1, 0, 2, 6, 7, 8, 8};
|
||||
const uint GrvCursorMan_t7g::_cursorPal[NUM_STYLES] = {0, 0, 0, 0, 2, 0, 1, 3, 5, 4, 6};
|
||||
|
||||
CursorMan_t7g::CursorMan_t7g(OSystem *system) :
|
||||
CursorMan(system) {
|
||||
GrvCursorMan_t7g::GrvCursorMan_t7g(OSystem *system) :
|
||||
GrvCursorMan(system) {
|
||||
|
||||
// Open the cursors file
|
||||
Common::File robgjd;
|
||||
@ -169,7 +164,7 @@ CursorMan_t7g::CursorMan_t7g(OSystem *system) :
|
||||
robgjd.close();
|
||||
}
|
||||
|
||||
CursorMan_t7g::~CursorMan_t7g() {
|
||||
GrvCursorMan_t7g::~GrvCursorMan_t7g() {
|
||||
// Delete the images
|
||||
for (uint img = 0; img < _images.size(); img++) {
|
||||
delete[] _images[img];
|
||||
@ -181,7 +176,7 @@ CursorMan_t7g::~CursorMan_t7g() {
|
||||
}
|
||||
}
|
||||
|
||||
byte *CursorMan_t7g::loadImage(Common::File &file) {
|
||||
byte *GrvCursorMan_t7g::loadImage(Common::File &file) {
|
||||
uint16 decompbytes = 0, offset, i, length;
|
||||
uint8 flagbyte, lengthmask = 0x0F, offsetlen, var_8;
|
||||
byte *cursorStorage = new byte[65536];
|
||||
@ -219,7 +214,7 @@ byte *CursorMan_t7g::loadImage(Common::File &file) {
|
||||
return cursorStorage;
|
||||
}
|
||||
|
||||
byte *CursorMan_t7g::loadPalette(Common::File &file) {
|
||||
byte *GrvCursorMan_t7g::loadPalette(Common::File &file) {
|
||||
byte *palette = new byte[4 * 32];
|
||||
for (uint8 colournum = 0; colournum < 32; colournum++) {
|
||||
palette[colournum * 4 + 0] = file.readByte();
|
||||
@ -287,8 +282,8 @@ void Cursor_v2::showFrame(uint16 frame) {
|
||||
|
||||
// v2 Cursor Manager
|
||||
|
||||
CursorMan_v2::CursorMan_v2(OSystem *system) :
|
||||
CursorMan(system) {
|
||||
GrvCursorMan_v2::GrvCursorMan_v2(OSystem *system) :
|
||||
GrvCursorMan(system) {
|
||||
|
||||
// Open the icons file
|
||||
Common::File iconsFile;
|
||||
@ -317,7 +312,7 @@ CursorMan_v2::CursorMan_v2(OSystem *system) :
|
||||
iconsFile.close();
|
||||
}
|
||||
|
||||
CursorMan_v2::~CursorMan_v2() {
|
||||
GrvCursorMan_v2::~GrvCursorMan_v2() {
|
||||
}
|
||||
|
||||
} // End of Groovie namespace
|
||||
|
@ -44,10 +44,10 @@ protected:
|
||||
uint16 _numFrames;
|
||||
};
|
||||
|
||||
class CursorMan {
|
||||
class GrvCursorMan {
|
||||
public:
|
||||
CursorMan(OSystem *system);
|
||||
virtual ~CursorMan();
|
||||
GrvCursorMan(OSystem *system);
|
||||
virtual ~GrvCursorMan();
|
||||
|
||||
virtual void animate();
|
||||
virtual void setStyle(uint8 newStyle);
|
||||
@ -66,10 +66,10 @@ protected:
|
||||
Cursor *_cursor;
|
||||
};
|
||||
|
||||
class CursorMan_t7g : public CursorMan {
|
||||
class GrvCursorMan_t7g : public GrvCursorMan {
|
||||
public:
|
||||
CursorMan_t7g(OSystem *system);
|
||||
~CursorMan_t7g();
|
||||
GrvCursorMan_t7g(OSystem *system);
|
||||
~GrvCursorMan_t7g();
|
||||
|
||||
private:
|
||||
// Styles data
|
||||
@ -85,10 +85,10 @@ private:
|
||||
byte *loadPalette(Common::File &file);
|
||||
};
|
||||
|
||||
class CursorMan_v2 : public CursorMan {
|
||||
class GrvCursorMan_v2 : public GrvCursorMan {
|
||||
public:
|
||||
CursorMan_v2(OSystem *system);
|
||||
~CursorMan_v2();
|
||||
GrvCursorMan_v2(OSystem *system);
|
||||
~GrvCursorMan_v2();
|
||||
};
|
||||
|
||||
} // End of Groovie namespace
|
||||
|
@ -36,7 +36,7 @@ namespace Groovie {
|
||||
|
||||
GroovieEngine::GroovieEngine(OSystem *syst, GroovieGameDescription *gd) :
|
||||
Engine(syst), _gameDescription(gd), _debugger(NULL), _script(this),
|
||||
_resMan(NULL), _cursorMan(NULL), _videoPlayer(NULL), _musicPlayer(NULL),
|
||||
_resMan(NULL), _grvCursorMan(NULL), _videoPlayer(NULL), _musicPlayer(NULL),
|
||||
_graphicsMan(NULL), _waitingForInput(false) {
|
||||
|
||||
// Adding the default directories
|
||||
@ -62,7 +62,7 @@ GroovieEngine::~GroovieEngine() {
|
||||
// Delete the remaining objects
|
||||
delete _debugger;
|
||||
delete _resMan;
|
||||
delete _cursorMan;
|
||||
delete _grvCursorMan;
|
||||
delete _videoPlayer;
|
||||
delete _musicPlayer;
|
||||
delete _graphicsMan;
|
||||
@ -83,12 +83,12 @@ Common::Error GroovieEngine::init() {
|
||||
switch (_gameDescription->version) {
|
||||
case kGroovieT7G:
|
||||
_resMan = new ResMan_t7g();
|
||||
_cursorMan = new CursorMan_t7g(_system);
|
||||
_grvCursorMan = new GrvCursorMan_t7g(_system);
|
||||
_videoPlayer = new VDXPlayer(this);
|
||||
break;
|
||||
case kGroovieV2:
|
||||
_resMan = new ResMan_v2();
|
||||
_cursorMan = new CursorMan_v2(_system);
|
||||
_grvCursorMan = new GrvCursorMan_v2(_system);
|
||||
_videoPlayer = new ROQPlayer(this);
|
||||
break;
|
||||
}
|
||||
@ -227,7 +227,7 @@ Common::Error GroovieEngine::go() {
|
||||
|
||||
if (_waitingForInput) {
|
||||
// Still waiting for input, just update the mouse, game timer and then wait a bit more
|
||||
_cursorMan->animate();
|
||||
_grvCursorMan->animate();
|
||||
_system->updateScreen();
|
||||
tmr++;
|
||||
// Wait a little bit between increments. While mouse is moving, this triggers
|
||||
|
@ -92,7 +92,7 @@ public:
|
||||
|
||||
Script _script;
|
||||
ResMan *_resMan;
|
||||
CursorMan *_cursorMan;
|
||||
GrvCursorMan *_grvCursorMan;
|
||||
VideoPlayer *_videoPlayer;
|
||||
MusicPlayer *_musicPlayer;
|
||||
GraphicsMan *_graphicsMan;
|
||||
|
@ -699,8 +699,8 @@ void Script::o_inputloopend() {
|
||||
|
||||
// Nothing to do
|
||||
if (_inputLoopAddress) {
|
||||
if (_newCursorStyle != _vm->_cursorMan->getStyle()) {
|
||||
_vm->_cursorMan->setStyle(_newCursorStyle);
|
||||
if (_newCursorStyle != _vm->_grvCursorMan->getStyle()) {
|
||||
_vm->_grvCursorMan->setStyle(_newCursorStyle);
|
||||
}
|
||||
_vm->_system->showMouse(true);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user