mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-18 07:39:08 +00:00
AVALANCHE: Change _graphics into a pointer, modify the rest of the code accordingly. Introduce AvalanhceEngine::initialize(), use it in AvalancheEninge::run(), modify rest of the code accordingly.
This commit is contained in:
parent
ba581b0b32
commit
8c5ce549e6
@ -45,12 +45,22 @@ AvalancheEngine *AvalancheEngine::s_Engine = 0;
|
||||
|
||||
AvalancheEngine::AvalancheEngine(OSystem *syst, const AvalancheGameDescription *gd) : Engine(syst), _gameDescription(gd) {
|
||||
_system = syst;
|
||||
s_Engine = this;
|
||||
_console = new AvalancheConsole(this);
|
||||
|
||||
_rnd = new Common::RandomSource("avalanche");
|
||||
_rnd->setSeed(42);
|
||||
}
|
||||
|
||||
_graph.setParent(this);
|
||||
AvalancheEngine::~AvalancheEngine() {
|
||||
delete _console;
|
||||
delete _rnd;
|
||||
|
||||
delete _graphics;
|
||||
}
|
||||
|
||||
Common::ErrorCode AvalancheEngine::initialize() {
|
||||
_graphics = new Graphics(this);
|
||||
|
||||
_gyro.setParent(this);
|
||||
_enhanced.setParent(this);
|
||||
@ -69,12 +79,18 @@ AvalancheEngine::AvalancheEngine(OSystem *syst, const AvalancheGameDescription *
|
||||
_dropdown.setParent(this);
|
||||
_closing.setParent(this);
|
||||
_avalot.setParent(this);
|
||||
|
||||
_graphics->init();
|
||||
|
||||
_scrolls.init();
|
||||
_lucerna.init();
|
||||
_acci.init();
|
||||
_basher.init();
|
||||
|
||||
|
||||
return Common::kNoError;
|
||||
}
|
||||
|
||||
AvalancheEngine::~AvalancheEngine() {
|
||||
delete _console;
|
||||
delete _rnd;
|
||||
}
|
||||
|
||||
GUI::Debugger *AvalancheEngine::getDebugger() {
|
||||
return _console;
|
||||
@ -252,17 +268,10 @@ void AvalancheEngine::run_avalot() {
|
||||
|
||||
|
||||
Common::Error AvalancheEngine::run() {
|
||||
s_Engine = this;
|
||||
Common::ErrorCode err = initialize();
|
||||
if (err != Common::kNoError)
|
||||
return err;
|
||||
|
||||
_console = new AvalancheConsole(this);
|
||||
|
||||
_scrolls.init();
|
||||
_lucerna.init();
|
||||
_acci.init();
|
||||
_basher.init();
|
||||
_graph.init();
|
||||
|
||||
|
||||
|
||||
|
||||
// From bootstrp:
|
||||
|
@ -65,7 +65,7 @@ static const int kSavegameVersion = 1;
|
||||
|
||||
class AvalancheEngine : public Engine {
|
||||
public:
|
||||
Graphics _graph;
|
||||
Graphics *_graphics;
|
||||
|
||||
Avalot _avalot;
|
||||
Gyro _gyro;
|
||||
@ -86,11 +86,13 @@ public:
|
||||
Closing _closing;
|
||||
|
||||
|
||||
OSystem *_system;
|
||||
|
||||
|
||||
AvalancheEngine(OSystem *syst, const AvalancheGameDescription *gd);
|
||||
~AvalancheEngine();
|
||||
|
||||
OSystem *_system;
|
||||
Common::ErrorCode initialize();
|
||||
|
||||
GUI::Debugger *getDebugger();
|
||||
|
||||
|
@ -99,7 +99,7 @@ void Avalot::setup() {
|
||||
_vm->_gyro.enid_filename = ""; /* undefined. */
|
||||
_vm->_lucerna.toolbar();
|
||||
_vm->_scrolls.state(2);
|
||||
_vm->_graph.refreshScreen(); //_vm->_pingo.copy03(); Replace it with refreshScreen() since they 'almost' have the same functionality.
|
||||
_vm->_graphics->refreshScreen(); //_vm->_pingo.copy03(); Replace it with refreshScreen() since they 'almost' have the same functionality.
|
||||
for (byte i = 0; i < 3; i++)
|
||||
_vm->_gyro.lastscore[i] = -1; /* impossible digits */
|
||||
|
||||
@ -206,7 +206,7 @@ void Avalot::run(Common::String arg) {
|
||||
|
||||
_vm->updateEvents(); // The event handler.
|
||||
|
||||
_vm->_graph.refreshScreen(); // TODO: Maybe it'll have a better place later. Move it there when it's needed.
|
||||
_vm->_graphics->refreshScreen(); // TODO: Maybe it'll have a better place later. Move it there when it's needed.
|
||||
|
||||
} while (! _vm->_gyro.lmo);
|
||||
|
||||
|
@ -197,7 +197,7 @@ void menuset::update() {
|
||||
/*setactivepage(3);
|
||||
setfillstyle(1, _dr->menu_b);
|
||||
bar(0, 0, 640, 9);*/
|
||||
_dr->_vm->_graph.drawBar(0, 0, 640, 10, _dr->menu_b);
|
||||
_dr->_vm->_graphics->drawBar(0, 0, 640, 10, _dr->menu_b);
|
||||
|
||||
savecp = _dr->_vm->_gyro.cp;
|
||||
_dr->_vm->_gyro.cp = 3;
|
||||
@ -290,7 +290,7 @@ void Dropdown::chalk(int16 x, int16 y, char t, Common::String z, bool valid) {
|
||||
byte pixel = ~(_vm->_gyro.little[z[fv]][ff] & ander); // Note that it's the bitwise NOT operator!
|
||||
for (byte bit = 0; bit < 8; bit++) {
|
||||
byte pixelBit = (pixel >> bit) & 1;
|
||||
*_vm->_graph.getPixel(x * 8 + fv * 8 + 7 - bit, y + ff) = pixelBit + (pixelBit << 1) + (pixelBit << 2);
|
||||
*_vm->_graphics->getPixel(x * 8 + fv * 8 + 7 - bit, y + ff) = pixelBit + (pixelBit << 1) + (pixelBit << 2);
|
||||
// We don't have to bother with the planes, since they all have the same value. See the original.
|
||||
// Note that it's the bitwise OR operator!
|
||||
}
|
||||
@ -306,7 +306,7 @@ void Dropdown::chalk(int16 x, int16 y, char t, Common::String z, bool valid) {
|
||||
byte pixel = ~ ander;
|
||||
for (byte bit = 0; bit < 8; bit++) {
|
||||
byte pixelBit = (pixel >> bit) & 1;
|
||||
*_vm->_graph.getPixel(x * 8 + fv * 8 + 7 - bit, y + 8) = pixelBit | (pixelBit << 1) | (pixelBit << 2);
|
||||
*_vm->_graphics->getPixel(x * 8 + fv * 8 + 7 - bit, y + 8) = pixelBit | (pixelBit << 1) | (pixelBit << 2);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -43,7 +43,7 @@ const byte Graphics::_egaPaletteIndex[16] = {0, 1, 2, 3, 4, 5, 20, 7, 56, 57, 58
|
||||
|
||||
|
||||
|
||||
void Graphics::setParent(AvalancheEngine *vm) {
|
||||
Graphics::Graphics(AvalancheEngine *vm) {
|
||||
_vm = vm;
|
||||
}
|
||||
|
||||
|
@ -61,7 +61,7 @@ public:
|
||||
|
||||
|
||||
|
||||
void setParent(AvalancheEngine *vm);
|
||||
Graphics(AvalancheEngine *vm);
|
||||
|
||||
void init();
|
||||
|
||||
|
@ -217,7 +217,7 @@ void Lucerna::load(byte n) { /* Load2, actually */
|
||||
|
||||
_vm->_gyro.clear_vmc();
|
||||
|
||||
_vm->_graph.flesh_colours();
|
||||
_vm->_graphics->flesh_colours();
|
||||
|
||||
xx = _vm->_gyro.strf(n);
|
||||
Common::String filename;
|
||||
@ -245,8 +245,8 @@ void Lucerna::load(byte n) { /* Load2, actually */
|
||||
|
||||
::Graphics::Surface background;
|
||||
|
||||
uint16 backgroundWidht = _vm->_graph.kScreenWidth;
|
||||
byte backgroundHeight = 8 * 12080 / _vm->_graph.kScreenWidth; // With 640 width it's 151
|
||||
uint16 backgroundWidht = _vm->_graphics->kScreenWidth;
|
||||
byte backgroundHeight = 8 * 12080 / _vm->_graphics->kScreenWidth; // With 640 width it's 151
|
||||
// The 8 = number of bits in a byte, and 12080 comes from the original code (see above)
|
||||
|
||||
background.create(backgroundWidht, backgroundHeight, ::Graphics::PixelFormat::createFormatCLUT8());
|
||||
@ -263,7 +263,7 @@ void Lucerna::load(byte n) { /* Load2, actually */
|
||||
|
||||
for (uint16 y = 0; y < backgroundHeight; y++)
|
||||
for (uint16 x = 0; x < backgroundWidht; x++)
|
||||
*_vm->_graph.getPixel(x + 0, y + 10) = *(byte *)background.getBasePtr(x, y);
|
||||
*_vm->_graphics->getPixel(x + 0, y + 10) = *(byte *)background.getBasePtr(x, y);
|
||||
|
||||
background.free();
|
||||
|
||||
@ -274,9 +274,9 @@ void Lucerna::load(byte n) { /* Load2, actually */
|
||||
load_also(xx);
|
||||
_vm->_celer.load_chunks(xx);
|
||||
|
||||
_vm->_graph.refreshScreen(); // _vm->_pingo.copy03(); - See Avalot::setup()
|
||||
_vm->_graphics->refreshScreen(); // _vm->_pingo.copy03(); - See Avalot::setup()
|
||||
|
||||
bit = *_vm->_graph.getPixel(0,0);
|
||||
bit = *_vm->_graphics->getPixel(0,0);
|
||||
|
||||
_vm->_logger.log_newroom(_vm->_gyro.roomname);
|
||||
|
||||
@ -766,7 +766,7 @@ void Lucerna::thinkabout(byte z, bool th) { /* Hey!!! Get it and put it!!! *
|
||||
|
||||
f.read(buffer, picsize);
|
||||
|
||||
_vm->_graph.drawPicture(buffer, 205, 170);
|
||||
_vm->_graphics->drawPicture(buffer, 205, 170);
|
||||
|
||||
delete[] buffer;
|
||||
|
||||
@ -823,7 +823,7 @@ void Lucerna::toolbar() {
|
||||
|
||||
f.read(buffer, bufferSize);
|
||||
|
||||
_vm->_graph.drawPicture(buffer, 5, 169);
|
||||
_vm->_graphics->drawPicture(buffer, 5, 169);
|
||||
|
||||
delete[] buffer;
|
||||
|
||||
@ -859,7 +859,7 @@ void Lucerna::showscore() {
|
||||
|
||||
for (byte fv = 0; fv < 3; fv ++)
|
||||
if (_vm->_gyro.lastscore[fv] != numbers[fv])
|
||||
_vm->_graph.drawPicture(_vm->_gyro.digit[numbers[fv]], 250 + (fv + 1) * 15, 177);
|
||||
_vm->_graphics->drawPicture(_vm->_gyro.digit[numbers[fv]], 250 + (fv + 1) * 15, 177);
|
||||
|
||||
for (byte fv = 0; fv < 2; fv ++)
|
||||
_vm->_trip.getset[fv].remember(scorespace);
|
||||
@ -1052,7 +1052,7 @@ void Lucerna::showrw() { // It's data is loaded in load_digits().
|
||||
putimage(0, 161, rwlite[with.rw], 0);
|
||||
}*/
|
||||
|
||||
_vm->_graph.drawPicture(_vm->_gyro.rwlite[_vm->_gyro.dna.rw], 0, 161);
|
||||
_vm->_graphics->drawPicture(_vm->_gyro.rwlite[_vm->_gyro.dna.rw], 0, 161);
|
||||
|
||||
_vm->_gyro.on();
|
||||
//setactivepage(1 - cp);
|
||||
|
@ -92,7 +92,7 @@ void Scrolls::state(byte x) { /* Sets "Ready" light to whatever */
|
||||
|
||||
_vm->_gyro.super_off();
|
||||
|
||||
_vm->_graph.drawBar(419, 195, 438, 197, color);
|
||||
_vm->_graphics->drawBar(419, 195, 438, 197, color);
|
||||
|
||||
_vm->_gyro.super_on();
|
||||
_vm->_gyro.ledstatus = x;
|
||||
|
@ -153,7 +153,7 @@ void triptype::andexor() {
|
||||
return;
|
||||
byte picnum = face * a.seq + step; // There'll maybe problem because of the different array indexes in Pascal (starting from 1).
|
||||
|
||||
_tr->_vm->_graph.drawSprite(_info, picnum, x, y);
|
||||
_tr->_vm->_graphics->drawSprite(_info, picnum, x, y);
|
||||
}
|
||||
|
||||
void triptype::turn(byte whichway) {
|
||||
|
Loading…
Reference in New Issue
Block a user