[Scummvm-git-logs] scummvm master -> c585e07c3c1c5dba706b67f39782599719ed0889
sev-
noreply at scummvm.org
Wed Sep 28 09:30:31 UTC 2022
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
5eac0c0324 PEGASUS: Get rid of g_engine type cast
c585e07c3c PEGASUS: Remove redundant assignments
Commit: 5eac0c0324b38c30dadccb0dcdced6d206c84741
https://github.com/scummvm/scummvm/commit/5eac0c0324b38c30dadccb0dcdced6d206c84741
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2022-09-28T11:30:00+02:00
Commit Message:
PEGASUS: Get rid of g_engine type cast
Changed paths:
engines/pegasus/ai/ai_action.cpp
engines/pegasus/ai/ai_area.cpp
engines/pegasus/ai/ai_condition.cpp
engines/pegasus/cursor.cpp
engines/pegasus/elements.cpp
engines/pegasus/energymonitor.cpp
engines/pegasus/fader.cpp
engines/pegasus/input.cpp
engines/pegasus/interface.cpp
engines/pegasus/items/biochips/aichip.cpp
engines/pegasus/items/biochips/arthurchip.cpp
engines/pegasus/items/biochips/biochipitem.cpp
engines/pegasus/items/biochips/mapimage.cpp
engines/pegasus/items/biochips/opticalchip.cpp
engines/pegasus/items/biochips/pegasuschip.cpp
engines/pegasus/items/inventory/inventoryitem.cpp
engines/pegasus/items/inventory/keycard.cpp
engines/pegasus/items/inventorypicture.cpp
engines/pegasus/items/item.cpp
engines/pegasus/menu.cpp
engines/pegasus/neighborhood/caldoria/caldoria4dsystem.cpp
engines/pegasus/neighborhood/caldoria/caldoriabomb.cpp
engines/pegasus/neighborhood/caldoria/caldoriamessages.cpp
engines/pegasus/neighborhood/mars/canyonchase.cpp
engines/pegasus/neighborhood/mars/energybeam.cpp
engines/pegasus/neighborhood/mars/mars.cpp
engines/pegasus/neighborhood/mars/planetmover.cpp
engines/pegasus/neighborhood/mars/reactor.cpp
engines/pegasus/neighborhood/mars/robotship.cpp
engines/pegasus/neighborhood/mars/shuttlehud.cpp
engines/pegasus/neighborhood/mars/spacejunk.cpp
engines/pegasus/neighborhood/mars/tractorbeam.cpp
engines/pegasus/neighborhood/mars/tunnelpod.cpp
engines/pegasus/neighborhood/norad/alpha/ecrmonitor.cpp
engines/pegasus/neighborhood/norad/alpha/fillingstation.cpp
engines/pegasus/neighborhood/norad/alpha/subchase.cpp
engines/pegasus/neighborhood/norad/delta/globegame.cpp
engines/pegasus/neighborhood/norad/norad.cpp
engines/pegasus/neighborhood/norad/noradelevator.cpp
engines/pegasus/neighborhood/norad/pressuredoor.cpp
engines/pegasus/neighborhood/norad/subcontrolroom.cpp
engines/pegasus/neighborhood/norad/subplatform.cpp
engines/pegasus/neighborhood/prehistoric/prehistoric.cpp
engines/pegasus/neighborhood/tsa/fulltsa.cpp
engines/pegasus/neighborhood/wsc/moleculebin.cpp
engines/pegasus/neighborhood/wsc/wsc.cpp
engines/pegasus/pegasus.cpp
engines/pegasus/pegasus.h
engines/pegasus/surface.cpp
engines/pegasus/timers.cpp
diff --git a/engines/pegasus/ai/ai_action.cpp b/engines/pegasus/ai/ai_action.cpp
index 20cf9a0d607..25f471402c9 100644
--- a/engines/pegasus/ai/ai_action.cpp
+++ b/engines/pegasus/ai/ai_action.cpp
@@ -45,7 +45,7 @@ AIPlayMessageAction::AIPlayMessageAction(const Common::String &movieName, bool k
}
void AIPlayMessageAction::performAIAction(AIRule *) {
- if (g_AIArea && ((PegasusEngine *)g_engine)->isChattyAI()) {
+ if (g_AIArea && g_vm->isChattyAI()) {
g_AIArea->checkMiddleArea();
g_AIArea->playAIMovie(kRightAreaSignature, _movieName, _keepLastFrame, _interruptionFilter);
}
diff --git a/engines/pegasus/ai/ai_area.cpp b/engines/pegasus/ai/ai_area.cpp
index 08182ce0a20..ba08b472d5c 100644
--- a/engines/pegasus/ai/ai_area.cpp
+++ b/engines/pegasus/ai/ai_area.cpp
@@ -50,17 +50,17 @@ AIArea::AIArea(InputHandler *nextHandler) : InputHandler(nextHandler), _leftArea
_middleBiochipTime = 0xffffffff;
_rightBiochipTime = 0xffffffff;
_lockCount = 0;
- ((PegasusEngine *)g_engine)->requestToggle(false);
+ g_vm->requestToggle(false);
startIdling();
}
AIArea::~AIArea() {
if (_middleAreaOwner == kBiochipSignature) {
- BiochipItem *currentBiochip = ((PegasusEngine *)g_engine)->getCurrentBiochip();
+ BiochipItem *currentBiochip = g_vm->getCurrentBiochip();
if (currentBiochip && currentBiochip->isSelected())
currentBiochip->giveUpSharedArea();
} else if (_middleAreaOwner == kInventorySignature) {
- InventoryItem *currentItem = ((PegasusEngine *)g_engine)->getCurrentInventoryItem();
+ InventoryItem *currentItem = g_vm->getCurrentInventoryItem();
if (currentItem && currentItem->isSelected())
currentItem->giveUpSharedArea();
}
@@ -75,21 +75,17 @@ AIArea::~AIArea() {
// Save last state of AI rules...
void AIArea::saveAIState() {
- PegasusEngine *vm = (PegasusEngine *)g_engine;
-
- delete vm->_aiSaveStream;
+ delete g_vm->_aiSaveStream;
Common::MemoryWriteStreamDynamic out(DisposeAfterUse::NO);
writeAIRules(&out);
- vm->_aiSaveStream = new Common::MemoryReadStream(out.getData(), out.size(), DisposeAfterUse::YES);
+ g_vm->_aiSaveStream = new Common::MemoryReadStream(out.getData(), out.size(), DisposeAfterUse::YES);
}
void AIArea::restoreAIState() {
- PegasusEngine *vm = (PegasusEngine *)g_engine;
-
- if (vm->_aiSaveStream)
- readAIRules(vm->_aiSaveStream);
+ if (g_vm->_aiSaveStream)
+ readAIRules(g_vm->_aiSaveStream);
}
void AIArea::writeAIRules(Common::WriteStream *stream) {
@@ -108,7 +104,7 @@ void AIArea::initAIArea() {
_leftAreaMovie.moveElementTo(kAILeftAreaLeft, kAILeftAreaTop);
_leftAreaMovie.setDisplayOrder(kAILeftAreaOrder);
_leftAreaMovie.startDisplaying();
- _leftAreaMovie.setVolume(((PegasusEngine *)g_engine)->getSoundFXLevel());
+ _leftAreaMovie.setVolume(g_vm->getSoundFXLevel());
_middleAreaMovie.shareSurface(this);
_middleAreaMovie.initFromMovieFile("Images/Items/Middle Area Movie");
@@ -116,7 +112,7 @@ void AIArea::initAIArea() {
_middleAreaMovie.moveMovieBoxTo(kAIMiddleAreaLeft - kAILeftAreaLeft, 0);
_middleAreaMovie.setDisplayOrder(kAIMiddleAreaOrder);
_middleAreaMovie.startDisplaying();
- _middleAreaMovie.setVolume(((PegasusEngine *)g_engine)->getSoundFXLevel());
+ _middleAreaMovie.setVolume(g_vm->getSoundFXLevel());
_rightAreaMovie.shareSurface(this);
_rightAreaMovie.initFromMovieFile("Images/Items/Right Area Movie");
@@ -124,7 +120,7 @@ void AIArea::initAIArea() {
_rightAreaMovie.moveMovieBoxTo(kAIRightAreaLeft - kAILeftAreaLeft, 0);
_rightAreaMovie.setDisplayOrder(kAIRightAreaOrder);
_rightAreaMovie.startDisplaying();
- _rightAreaMovie.setVolume(((PegasusEngine *)g_engine)->getSoundFXLevel());
+ _rightAreaMovie.setVolume(g_vm->getSoundFXLevel());
_AIMovie.setDisplayOrder(kAIMovieOrder);
}
@@ -215,8 +211,6 @@ void AIArea::setAIAreaToTime(const LowerClientSignature client, const LowerAreaS
// kInventorySignature kMiddleAreaSignature
void AIArea::playAIAreaSequence(const LowerClientSignature, const LowerAreaSignature area, const TimeValue start, const TimeValue stop) {
- PegasusEngine *vm = (PegasusEngine *)g_engine;
-
lockAIOut();
switch (area) {
@@ -234,17 +228,17 @@ void AIArea::playAIAreaSequence(const LowerClientSignature, const LowerAreaSigna
_middleAreaMovie.setTime(start);
_middleAreaMovie.show();
_middleAreaMovie.start();
- vm->_cursor->hide();
+ g_vm->_cursor->hide();
while (_middleAreaMovie.isRunning()) {
InputDevice.pumpEvents();
- vm->checkCallBacks();
- vm->refreshDisplay();
+ g_vm->checkCallBacks();
+ g_vm->refreshDisplay();
g_system->delayMillis(10);
}
_middleAreaMovie.stop();
- vm->_cursor->hideUntilMoved();
+ g_vm->_cursor->hideUntilMoved();
if (_middleAreaOwner == kInventorySignature)
setAIAreaToTime(_middleAreaOwner, kMiddleAreaSignature, _middleInventoryTime);
@@ -259,17 +253,17 @@ void AIArea::playAIAreaSequence(const LowerClientSignature, const LowerAreaSigna
_rightAreaMovie.setTime(start);
_rightAreaMovie.show();
_rightAreaMovie.start();
- vm->_cursor->hide();
+ g_vm->_cursor->hide();
while (_rightAreaMovie.isRunning()) {
InputDevice.pumpEvents();
- vm->checkCallBacks();
- vm->refreshDisplay();
+ g_vm->checkCallBacks();
+ g_vm->refreshDisplay();
g_system->delayMillis(10);
}
_rightAreaMovie.stop();
- vm->_cursor->hideUntilMoved();
+ g_vm->_cursor->hideUntilMoved();
setAIAreaToTime(_rightAreaOwner, kRightAreaSignature, _rightBiochipTime);
break;
default:
@@ -280,8 +274,6 @@ void AIArea::playAIAreaSequence(const LowerClientSignature, const LowerAreaSigna
}
bool AIArea::playAIMovie(const LowerAreaSignature area, const Common::String &movieName, bool keepLastFrame, const InputBits interruptFilter) {
- PegasusEngine *vm = (PegasusEngine *)g_engine;
-
lockAIOut();
InputDevice.waitInput(interruptFilter);
@@ -304,32 +296,32 @@ bool AIArea::playAIMovie(const LowerAreaSignature area, const Common::String &mo
_AIMovie.startDisplaying();
_AIMovie.show();
_AIMovie.redrawMovieWorld();
- _AIMovie.setVolume(vm->getSoundFXLevel());
+ _AIMovie.setVolume(g_vm->getSoundFXLevel());
_AIMovie.start();
- vm->_cursor->hide();
+ g_vm->_cursor->hide();
bool result = true;
- bool saveAllowed = vm->swapSaveAllowed(false);
- bool openAllowed = vm->swapLoadAllowed(false);
+ bool saveAllowed = g_vm->swapSaveAllowed(false);
+ bool openAllowed = g_vm->swapLoadAllowed(false);
while (_AIMovie.isRunning()) {
Input input;
InputDevice.getInput(input, interruptFilter);
- if (input.anyInput() || vm->shouldQuit() || vm->saveRequested() || vm->loadRequested()) {
+ if (input.anyInput() || g_vm->shouldQuit() || g_vm->saveRequested() || g_vm->loadRequested()) {
result = false;
break;
}
- vm->checkCallBacks();
- vm->refreshDisplay();
+ g_vm->checkCallBacks();
+ g_vm->refreshDisplay();
g_system->delayMillis(10);
}
_AIMovie.stop();
- vm->swapSaveAllowed(saveAllowed);
- vm->swapLoadAllowed(openAllowed);
+ g_vm->swapSaveAllowed(saveAllowed);
+ g_vm->swapLoadAllowed(openAllowed);
// This used to keep the last frame up even if the movie was interrupted.
// However, this only occurs in the recalibration, where interruption means skip the
@@ -350,7 +342,7 @@ bool AIArea::playAIMovie(const LowerAreaSignature area, const Common::String &mo
}
}
- vm->_cursor->hideUntilMoved();
+ g_vm->_cursor->hideUntilMoved();
unlockAI();
return result;
}
@@ -384,14 +376,14 @@ void AIArea::setMiddleMovieTime(const LowerClientSignature client, const TimeVal
if (client == kInventorySignature) {
_middleInventoryTime = time;
if (_middleAreaOwner == kBiochipSignature) {
- BiochipItem *currentBiochip = ((PegasusEngine *)g_engine)->getCurrentBiochip();
+ BiochipItem *currentBiochip = g_vm->getCurrentBiochip();
if (currentBiochip && currentBiochip->isSelected())
currentBiochip->giveUpSharedArea();
}
} else {
_middleBiochipTime = time;
if (_middleAreaOwner == kInventorySignature) {
- InventoryItem *currentItem = ((PegasusEngine *)g_engine)->getCurrentInventoryItem();
+ InventoryItem *currentItem = g_vm->getCurrentInventoryItem();
if (currentItem && currentItem->isSelected())
currentItem->giveUpSharedArea();
}
@@ -428,13 +420,13 @@ void AIArea::handleInput(const Input &input, const Hotspot *cursorSpot) {
void AIArea::toggleMiddleAreaOwner() {
if (_middleAreaOwner == kInventorySignature) {
- BiochipItem *currentBiochip = ((PegasusEngine *)g_engine)->getCurrentBiochip();
+ BiochipItem *currentBiochip = g_vm->getCurrentBiochip();
if (currentBiochip) {
setMiddleMovieTime(kBiochipSignature, currentBiochip->getSharedAreaTime());
currentBiochip->takeSharedArea();
}
} else if (_middleAreaOwner == kBiochipSignature) {
- InventoryItem *currentItem = ((PegasusEngine *)g_engine)->getCurrentInventoryItem();
+ InventoryItem *currentItem = g_vm->getCurrentInventoryItem();
if (currentItem) {
setMiddleMovieTime(kInventorySignature, currentItem->getSharedAreaTime());
currentItem->takeSharedArea();
@@ -443,31 +435,29 @@ void AIArea::toggleMiddleAreaOwner() {
}
void AIArea::activateHotspots() {
- PegasusEngine *vm = (PegasusEngine *)g_engine;
-
if (_middleAreaOwner == kBiochipSignature) {
- BiochipItem *currentBiochip = ((PegasusEngine *)g_engine)->getCurrentBiochip();
+ BiochipItem *currentBiochip = g_vm->getCurrentBiochip();
if (currentBiochip)
switch (currentBiochip->getObjectID()) {
case kAIBiochip:
((AIChip *)currentBiochip)->activateAIHotspots();
break;
case kPegasusBiochip:
- if (!vm->isDemo())
+ if (!g_vm->isDemo())
((PegasusChip *)currentBiochip)->activatePegasusHotspots();
break;
case kOpticalBiochip:
((OpticalChip *)currentBiochip)->activateOpticalHotspots();
break;
case kArthurBiochip:
- if (vm->isDVD())
+ if (g_vm->isDVD())
((ArthurChip *)currentBiochip)->activateArthurHotspots();
break;
default:
break;
}
} else if (_middleAreaOwner == kInventorySignature) {
- InventoryItem *currentItem = ((PegasusEngine *)g_engine)->getCurrentInventoryItem();
+ InventoryItem *currentItem = g_vm->getCurrentInventoryItem();
if (currentItem && currentItem->getObjectID() == kAirMask)
((AirMask *)currentItem)->activateAirMaskHotspots();
}
@@ -476,12 +466,10 @@ void AIArea::activateHotspots() {
}
void AIArea::clickInHotspot(const Input &input, const Hotspot *hotspot) {
- PegasusEngine *vm = (PegasusEngine *)g_engine;
-
bool handled = false;
if (_middleAreaOwner == kBiochipSignature) {
- BiochipItem *currentBiochip = ((PegasusEngine *)g_engine)->getCurrentBiochip();
+ BiochipItem *currentBiochip = g_vm->getCurrentBiochip();
if (currentBiochip) {
switch (currentBiochip->getObjectID()) {
@@ -492,7 +480,7 @@ void AIArea::clickInHotspot(const Input &input, const Hotspot *hotspot) {
}
break;
case kPegasusBiochip:
- if (!vm->isDemo() && ((hotspot->getHotspotFlags() & kPegasusBiochipSpotFlag) != 0)) {
+ if (!g_vm->isDemo() && ((hotspot->getHotspotFlags() & kPegasusBiochipSpotFlag) != 0)) {
((PegasusChip *)currentBiochip)->clickInPegasusHotspot();
handled = true;
}
@@ -504,7 +492,7 @@ void AIArea::clickInHotspot(const Input &input, const Hotspot *hotspot) {
}
break;
case kArthurBiochip:
- if (vm->isDVD() && (hotspot->getHotspotFlags() & kArthurBiochipSpotFlag) != 0) {
+ if (g_vm->isDVD() && (hotspot->getHotspotFlags() & kArthurBiochipSpotFlag) != 0) {
((ArthurChip *)currentBiochip)->clickInArthurHotspot(hotspot->getObjectID());
handled = true;
}
@@ -514,7 +502,7 @@ void AIArea::clickInHotspot(const Input &input, const Hotspot *hotspot) {
}
}
} else if (_middleAreaOwner == kInventorySignature) {
- InventoryItem *currentItem = ((PegasusEngine *)g_engine)->getCurrentInventoryItem();
+ InventoryItem *currentItem = g_vm->getCurrentInventoryItem();
if (currentItem) {
switch (currentItem->getObjectID()) {
@@ -557,7 +545,7 @@ void AIArea::forceAIUnlocked() {
}
void AIArea::checkRules() {
- if (_lockCount == 0 && ((PegasusEngine *)g_engine)->playerAlive())
+ if (_lockCount == 0 && g_vm->playerAlive())
for (AIRuleList::iterator it = _AIRules.begin(); it != _AIRules.end(); it++)
if ((*it)->fireRule())
break;
@@ -579,7 +567,7 @@ void AIArea::removeAllRules() {
}
void AIArea::checkMiddleArea() {
- BiochipItem *currentBiochip = ((PegasusEngine *)g_engine)->getCurrentBiochip();
+ BiochipItem *currentBiochip = g_vm->getCurrentBiochip();
if (currentBiochip) {
if (_middleAreaOwner == kBiochipSignature) {
@@ -610,10 +598,10 @@ void AIArea::checkMiddleArea() {
TimeValue AIArea::getBigInfoTime() {
if (_middleAreaOwner == kInventorySignature) {
- InventoryItem *currentItem = ((PegasusEngine *)g_engine)->getCurrentInventoryItem();
+ InventoryItem *currentItem = g_vm->getCurrentInventoryItem();
return currentItem->getInfoLeftTime();
} else if (_middleAreaOwner == kBiochipSignature) {
- BiochipItem *currentBiochip = ((PegasusEngine *)g_engine)->getCurrentBiochip();
+ BiochipItem *currentBiochip = g_vm->getCurrentBiochip();
return currentBiochip->getInfoLeftTime();
}
@@ -622,10 +610,10 @@ TimeValue AIArea::getBigInfoTime() {
void AIArea::getSmallInfoSegment(TimeValue &start, TimeValue &stop) {
if (_middleAreaOwner == kInventorySignature) {
- InventoryItem *currentItem = ((PegasusEngine *)g_engine)->getCurrentInventoryItem();
+ InventoryItem *currentItem = g_vm->getCurrentInventoryItem();
currentItem->getInfoRightTimes(start, stop);
} else if (_middleAreaOwner == kBiochipSignature) {
- BiochipItem *currentBiochip = ((PegasusEngine *)g_engine)->getCurrentBiochip();
+ BiochipItem *currentBiochip = g_vm->getCurrentBiochip();
currentBiochip->getInfoRightTimes(start, stop);
} else {
start = 0xffffffff;
diff --git a/engines/pegasus/ai/ai_condition.cpp b/engines/pegasus/ai/ai_condition.cpp
index afe054c9d83..93eac97b705 100644
--- a/engines/pegasus/ai/ai_condition.cpp
+++ b/engines/pegasus/ai/ai_condition.cpp
@@ -230,7 +230,7 @@ AICurrentItemCondition::AICurrentItemCondition(const ItemID item) {
}
bool AICurrentItemCondition::fireCondition() {
- InventoryItem *item = ((PegasusEngine *)g_engine)->getCurrentInventoryItem();
+ InventoryItem *item = g_vm->getCurrentInventoryItem();
if (_item == kNoItemID)
return item == nullptr;
@@ -243,7 +243,7 @@ AICurrentBiochipCondition::AICurrentBiochipCondition(const ItemID biochip) {
}
bool AICurrentBiochipCondition::fireCondition() {
- BiochipItem *biochip = ((PegasusEngine *)g_engine)->getCurrentBiochip();
+ BiochipItem *biochip = g_vm->getCurrentBiochip();
if (_biochip == kNoItemID)
return biochip == nullptr;
diff --git a/engines/pegasus/cursor.cpp b/engines/pegasus/cursor.cpp
index 45dc6d8d25f..5e4d9a757d9 100644
--- a/engines/pegasus/cursor.cpp
+++ b/engines/pegasus/cursor.cpp
@@ -54,7 +54,7 @@ Cursor::~Cursor() {
}
void Cursor::addCursorFrames(uint16 id) {
- PegasusEngine *vm = (PegasusEngine *)g_engine;
+ PegasusEngine *vm = g_vm;
Common::SeekableReadStream *cursStream = vm->_resFork->getResource(MKTAG('C', 'u', 'r', 's'), id);
if (!cursStream)
error("Could not load cursor frames set %d", id);
@@ -135,7 +135,7 @@ void Cursor::loadCursorImage(CursorInfo &cursorInfo) {
if (cursorInfo.surface)
return;
- PegasusEngine *vm = (PegasusEngine *)g_engine;
+ PegasusEngine *vm = g_vm;
if (vm->isDVD()) {
// The DVD version has some higher color PICT images for its cursors
diff --git a/engines/pegasus/elements.cpp b/engines/pegasus/elements.cpp
index 081c8472e95..98f7f7ad672 100644
--- a/engines/pegasus/elements.cpp
+++ b/engines/pegasus/elements.cpp
@@ -41,15 +41,15 @@ DisplayElement::DisplayElement(const DisplayElementID id) : IDObject(id) {
DisplayElement::~DisplayElement() {
if (isDisplaying())
- ((PegasusEngine *)g_engine)->_gfx->removeDisplayElement(this);
+ g_vm->_gfx->removeDisplayElement(this);
}
void DisplayElement::setDisplayOrder(const DisplayOrder order) {
if (_elementOrder != order) {
_elementOrder = order;
if (isDisplaying()) {
- ((PegasusEngine *)g_engine)->_gfx->removeDisplayElement(this);
- ((PegasusEngine *)g_engine)->_gfx->addDisplayElement(this);
+ g_vm->_gfx->removeDisplayElement(this);
+ g_vm->_gfx->addDisplayElement(this);
triggerRedraw();
}
}
@@ -57,7 +57,7 @@ void DisplayElement::setDisplayOrder(const DisplayOrder order) {
void DisplayElement::startDisplaying() {
if (!isDisplaying()) {
- ((PegasusEngine *)g_engine)->_gfx->addDisplayElement(this);
+ g_vm->_gfx->addDisplayElement(this);
triggerRedraw();
}
}
@@ -65,7 +65,7 @@ void DisplayElement::startDisplaying() {
void DisplayElement::stopDisplaying() {
if (isDisplaying()) {
triggerRedraw();
- ((PegasusEngine *)g_engine)->_gfx->removeDisplayElement(this);
+ g_vm->_gfx->removeDisplayElement(this);
}
}
@@ -140,7 +140,7 @@ void DisplayElement::show() {
// -- The element is visible.
// -- The element is part of the active layer OR is one of the reserved items.
void DisplayElement::triggerRedraw() {
- GraphicsManager *gfx = ((PegasusEngine *)g_engine)->_gfx;
+ GraphicsManager *gfx = g_vm->_gfx;
if (_triggeredElement == this) {
if (validToDraw(gfx->getBackOfActiveLayer(), gfx->getFrontOfActiveLayer()))
@@ -171,7 +171,7 @@ DropHighlight::DropHighlight(const DisplayElementID id) : DisplayElement(id) {
}
void DropHighlight::draw(const Common::Rect &) {
- Graphics::Surface *screen = ((PegasusEngine *)g_engine)->_gfx->getWorkArea();
+ Graphics::Surface *screen = g_vm->_gfx->getWorkArea();
// Since this is only used in two different ways, I'm only
// going to implement it in those two ways. Deal with it.
@@ -340,7 +340,7 @@ void Sprite::discardFrames() {
void Sprite::addPICTResourceFrame(const ResIDType pictID, bool transparent, const CoordType left, const CoordType top) {
SpriteFrame *frame = new SpriteFrame();
- frame->initFromPICTResource(((PegasusEngine *)g_engine)->_resFork, pictID, transparent);
+ frame->initFromPICTResource(g_vm->_resFork, pictID, transparent);
addFrame(frame, left, top);
}
@@ -496,7 +496,7 @@ void ScreenDimmer::draw(const Common::Rect &r) {
// The output is identical to the original
uint32 black = g_system->getScreenFormat().RGBToColor(0, 0, 0);
- Graphics::Surface *screen = ((PegasusEngine *)g_engine)->_gfx->getWorkArea();
+ Graphics::Surface *screen = g_vm->_gfx->getWorkArea();
byte bytesPerPixel = g_system->getScreenFormat().bytesPerPixel;
// We're currently doing it to the whole screen to simplify the code
@@ -559,7 +559,7 @@ void SoundLevel::draw(const Common::Rect &r) {
levelRect = r.findIntersectingRect(levelRect);
if (!levelRect.isEmpty()) {
- Graphics::Surface *screen = ((PegasusEngine *)g_engine)->_gfx->getWorkArea();
+ Graphics::Surface *screen = g_vm->_gfx->getWorkArea();
screen->fillRect(levelRect, g_system->getScreenFormat().RGBToColor(0, 0, 0));
}
}
diff --git a/engines/pegasus/energymonitor.cpp b/engines/pegasus/energymonitor.cpp
index 3748451119b..00383afa6f5 100644
--- a/engines/pegasus/energymonitor.cpp
+++ b/engines/pegasus/energymonitor.cpp
@@ -74,7 +74,7 @@ enum {
EnergyMonitor *g_energyMonitor = nullptr;
EnergyMonitor::EnergyMonitor() : IdlerAnimation(kEnergyBarID), _energyLight(kWarningLightID) {
- PegasusEngine *vm = (PegasusEngine *)g_engine;
+ PegasusEngine *vm = g_vm;
_stage = kStageNoStage;
@@ -162,7 +162,7 @@ int32 EnergyMonitor::getCurrentEnergy() {
void EnergyMonitor::timeChanged(const TimeValue currentTime) {
if (currentTime == getStop()) {
- PegasusEngine *vm = (PegasusEngine *)g_engine;
+ PegasusEngine *vm = g_vm;
if (vm->getEnergyDeathReason() != -1)
vm->die(vm->getEnergyDeathReason());
} else {
@@ -239,13 +239,13 @@ void EnergyMonitor::draw(const Common::Rect &r) {
Common::Rect r2 = r.findIntersectingRect(_levelRect);
if (!r2.isEmpty()) {
- Graphics::Surface *screen = ((PegasusEngine *)g_engine)->_gfx->getWorkArea();
+ Graphics::Surface *screen = g_vm->_gfx->getWorkArea();
screen->fillRect(r2, _barColor);
}
}
void EnergyMonitor::calibrateEnergyBar() {
- PegasusEngine *vm = (PegasusEngine *)g_engine;
+ PegasusEngine *vm = g_vm;
_calibrating = true;
@@ -284,7 +284,7 @@ void EnergyMonitor::calibrateEnergyBar() {
}
void EnergyMonitor::restoreLastEnergyValue() {
- PegasusEngine *vm = (PegasusEngine *)g_engine;
+ PegasusEngine *vm = g_vm;
_dontFlash = true;
setEnergyValue(vm->getSavedEnergyValue());
@@ -292,7 +292,7 @@ void EnergyMonitor::restoreLastEnergyValue() {
}
void EnergyMonitor::saveCurrentEnergyValue() {
- ((PegasusEngine *)g_engine)->setLastEnergyValue(getCurrentEnergy());
+ g_vm->setLastEnergyValue(getCurrentEnergy());
}
} // End of namespace Pegasus
diff --git a/engines/pegasus/fader.cpp b/engines/pegasus/fader.cpp
index 4db8c18419e..85c9d8be7f3 100644
--- a/engines/pegasus/fader.cpp
+++ b/engines/pegasus/fader.cpp
@@ -94,7 +94,7 @@ void Fader::startFaderSync(const FaderMoveSpec &spec) {
while (isFading()) {
InputDevice.pumpEvents();
- ((PegasusEngine *)g_engine)->checkCallBacks();
+ g_vm->checkCallBacks();
useIdleTime();
}
diff --git a/engines/pegasus/input.cpp b/engines/pegasus/input.cpp
index 0f432670828..b22cf96db72 100644
--- a/engines/pegasus/input.cpp
+++ b/engines/pegasus/input.cpp
@@ -96,9 +96,9 @@ void InputDeviceManager::getInput(Input &input, const InputBits filter) {
if (_keysDown[kPegasusActionShowBiochip])
currentBits |= (kRawButtonDown << kRightFireButtonShift);
- if (((PegasusEngine *)g_engine)->isDVD()) {
+ if (g_vm->isDVD()) {
if (_keysDown[kPegasusActionToggleChattyAI] && !_AKeyWasDown) {
- ((PegasusEngine *)g_engine)->requestToggle();
+ g_vm->requestToggle();
_AKeyWasDown = true;
} else if (!_keysDown[kPegasusActionToggleChattyAI])
_AKeyWasDown = false;
@@ -155,10 +155,10 @@ bool InputDeviceManager::notifyEvent(const Common::Event &event) {
case Common::EVENT_CUSTOM_ENGINE_ACTION_START:
switch ((PegasusAction)event.customType) {
case kPegasusActionSaveGameState:
- ((PegasusEngine *)g_engine)->requestSave();
+ g_vm->requestSave();
break;
case kPegasusActionLoadGameState:
- ((PegasusEngine *)g_engine)->requestLoad();
+ g_vm->requestLoad();
break;
default:
// Otherwise, set the action to down if we have it
@@ -180,7 +180,7 @@ bool InputDeviceManager::notifyEvent(const Common::Event &event) {
}
void InputDeviceManager::pumpEvents() {
- PegasusEngine *vm = ((PegasusEngine *)g_engine);
+ PegasusEngine *vm = g_vm;
bool saveAllowed = vm->swapSaveAllowed(false);
bool openAllowed = vm->swapLoadAllowed(false);
@@ -233,7 +233,7 @@ void InputHandler::pollForInput() {
}
void InputHandler::getInput(Input &input, Hotspot *&cursorSpot) {
- Cursor *cursor = ((PegasusEngine *)g_engine)->_cursor;
+ Cursor *cursor = g_vm->_cursor;
if (_inputHandler)
_lastFilter = _inputHandler->getInputFilter();
diff --git a/engines/pegasus/interface.cpp b/engines/pegasus/interface.cpp
index e9eb1cdb67f..625643f961b 100644
--- a/engines/pegasus/interface.cpp
+++ b/engines/pegasus/interface.cpp
@@ -34,14 +34,14 @@ namespace Pegasus {
Interface *g_interface = nullptr;
-Interface::Interface() : InputHandler(nullptr), _interfaceNotification(kInterfaceNotificationID, (NotificationManager *)((PegasusEngine *)g_engine)),
+Interface::Interface() : InputHandler(nullptr), _interfaceNotification(kInterfaceNotificationID, (NotificationManager *)g_vm),
_currentItemSpot(kCurrentItemSpotID), _currentBiochipSpot(kCurrentBiochipSpotID),
_background1(kInterface1ID), _background2(kInterface2ID), _background3(kInterface3ID),
_background4(kInterface4ID), _datePicture(kDateID), _inventoryPush(kInventoryPushID),
_inventoryLid(kInventoryLidID, kNoDisplayElement),
- _inventoryPanel(kNoDisplayElement, (InputHandler *)((PegasusEngine *)g_engine), ((PegasusEngine *)g_engine)->getItemsInventory()),
+ _inventoryPanel(kNoDisplayElement, (InputHandler *)g_vm, (g_vm)->getItemsInventory()),
_biochipPush(kBiochipPushID), _biochipLid(kBiochipLidID, kNoDisplayElement),
- _biochipPanel(kNoDisplayElement, (InputHandler *)((PegasusEngine *)g_engine), ((PegasusEngine *)g_engine)->getBiochipsInventory()) {
+ _biochipPanel(kNoDisplayElement, (InputHandler *)g_vm, (g_vm)->getBiochipsInventory()) {
g_energyMonitor = nullptr;
_previousHandler = nullptr;
_inventoryRaised = false;
@@ -126,7 +126,7 @@ void Interface::throwAwayDateMonitor() {
void Interface::setDate(const uint16 dateResID) {
validateDateMonitor();
- _datePicture.initFromPICTResource(((PegasusEngine *)g_engine)->_resFork, dateResID);
+ _datePicture.initFromPICTResource(g_vm->_resFork, dateResID);
_datePicture.triggerRedraw();
}
@@ -159,7 +159,7 @@ void Interface::throwAwayNotifications() {
void Interface::validateAIArea() {
if (!g_AIArea) {
- new AIArea((InputHandler *)((PegasusEngine *)g_engine));
+ new AIArea((InputHandler *)g_vm);
if (g_AIArea)
g_AIArea->initAIArea();
}
@@ -185,7 +185,7 @@ void Interface::validateInventoryPanel() {
_inventoryLid.setDisplayOrder(kInventoryLidOrder);
_inventoryLid.startDisplaying();
- if (((PegasusEngine *)g_engine)->isDVD()) {
+ if (g_vm->isDVD()) {
_inventoryOpenSound.initFromAIFFFile("Sounds/Items/Inventory Panel Open.aif");
_inventoryCloseSound.initFromAIFFFile("Sounds/Items/Inventory Panel Close.aif");
}
@@ -235,7 +235,7 @@ void Interface::validateBiochipPanel() {
_biochipLid.setDisplayOrder(kBiochipLidOrder);
_biochipLid.startDisplaying();
- if (((PegasusEngine *)g_engine)->isDVD()) {
+ if (g_vm->isDVD()) {
_biochipOpenSound.initFromAIFFFile("Sounds/Items/Biochip Panel Open.aif");
_biochipCloseSound.initFromAIFFFile("Sounds/Items/Biochip Panel Close.aif");
}
@@ -397,9 +397,9 @@ void Interface::raiseInventoryDrawer(const bool doCallBacks) {
_inventoryPush.show();
_inventoryLid.start();
- if (((PegasusEngine *)g_engine)->isDVD()) {
+ if (g_vm->isDVD()) {
_inventoryCloseSound.stopSound();
- _inventoryOpenSound.setVolume(((PegasusEngine *)g_engine)->getSoundFXLevel());
+ _inventoryOpenSound.setVolume(g_vm->getSoundFXLevel());
_inventoryOpenSound.playSound();
}
}
@@ -417,7 +417,7 @@ void Interface::raiseInventoryDrawerForMessage() {
// The DVD version has a different image for the inventory
// for the end message.
- if (((PegasusEngine *)g_engine)->isDVD()) {
+ if (g_vm->isDVD()) {
_inventoryPanel.setCommPicture();
_inventoryPanel.throwAwayInventoryImage();
_inventoryPanel.initInventoryImage(&_inventoryPush);
@@ -473,9 +473,9 @@ void Interface::lowerInventoryDrawer(const bool doCallBacks) {
moveSpec.makeTwoKnotFaderSpec(60, 0, 1000, 15, 0);
_inventoryPush.startFader(moveSpec);
- if (((PegasusEngine *)g_engine)->isDVD()) {
+ if (g_vm->isDVD()) {
_inventoryOpenSound.stopSound();
- _inventoryCloseSound.setVolume(((PegasusEngine *)g_engine)->getSoundFXLevel());
+ _inventoryCloseSound.setVolume(g_vm->getSoundFXLevel());
_inventoryCloseSound.playSound();
}
}
@@ -520,9 +520,9 @@ void Interface::raiseBiochipDrawer(const bool doCallBacks) {
_biochipPush.show();
_biochipLid.start();
- if (((PegasusEngine *)g_engine)->isDVD()) {
+ if (g_vm->isDVD()) {
_biochipCloseSound.stopSound();
- _biochipOpenSound.setVolume(((PegasusEngine *)g_engine)->getSoundFXLevel());
+ _biochipOpenSound.setVolume(g_vm->getSoundFXLevel());
_biochipOpenSound.playSound();
}
}
@@ -560,9 +560,9 @@ void Interface::lowerBiochipDrawer(const bool doCallBacks) {
moveSpec.makeTwoKnotFaderSpec(60, 0, 1000, 9, 0);
_biochipPush.startFader(moveSpec);
- if (((PegasusEngine *)g_engine)->isDVD()) {
+ if (g_vm->isDVD()) {
_biochipOpenSound.stopSound();
- _biochipCloseSound.setVolume(((PegasusEngine *)g_engine)->getSoundFXLevel());
+ _biochipCloseSound.setVolume(g_vm->getSoundFXLevel());
_biochipCloseSound.playSound();
}
}
@@ -597,7 +597,7 @@ void Interface::calibrateCompass() {
g_compass->startFader(compassMove);
- PegasusEngine *vm = (PegasusEngine *)g_engine;
+ PegasusEngine *vm = g_vm;
while (g_compass->isFading()) {
vm->refreshDisplay();
@@ -613,7 +613,7 @@ void Interface::calibrateEnergyBar() {
}
void Interface::raiseInventoryDrawerSync() {
- PegasusEngine *vm = (PegasusEngine *)g_engine;
+ PegasusEngine *vm = g_vm;
raiseInventoryDrawer(false);
@@ -639,7 +639,7 @@ void Interface::raiseInventoryDrawerSync() {
}
void Interface::lowerInventoryDrawerSync() {
- PegasusEngine *vm = (PegasusEngine *)g_engine;
+ PegasusEngine *vm = g_vm;
lowerInventoryDrawer(false);
@@ -665,7 +665,7 @@ void Interface::lowerInventoryDrawerSync() {
}
void Interface::raiseBiochipDrawerSync() {
- PegasusEngine *vm = (PegasusEngine *)g_engine;
+ PegasusEngine *vm = g_vm;
raiseBiochipDrawer(false);
@@ -691,7 +691,7 @@ void Interface::raiseBiochipDrawerSync() {
}
void Interface::lowerBiochipDrawerSync() {
- PegasusEngine *vm = (PegasusEngine *)g_engine;
+ PegasusEngine *vm = g_vm;
lowerBiochipDrawer(false);
diff --git a/engines/pegasus/items/biochips/aichip.cpp b/engines/pegasus/items/biochips/aichip.cpp
index 8d1996887f8..8c884e48893 100644
--- a/engines/pegasus/items/biochips/aichip.cpp
+++ b/engines/pegasus/items/biochips/aichip.cpp
@@ -112,7 +112,7 @@ void AIChip::takeSharedArea() {
void AIChip::setUpAIChip() {
if (!_playingMovie) {
- PegasusEngine *vm = (PegasusEngine *)g_engine;
+ PegasusEngine *vm = g_vm;
uint numSolves;
if (GameState.getWalkthroughMode()) {
@@ -131,7 +131,7 @@ void AIChip::setUpAIChip() {
// Only does something when there are hints or solves available.
void AIChip::setUpAIChipRude() {
if (!_playingMovie) {
- PegasusEngine *vm = (PegasusEngine *)g_engine;
+ PegasusEngine *vm = g_vm;
uint numSolves;
if (GameState.getWalkthroughMode()) {
@@ -150,7 +150,7 @@ void AIChip::setUpAIChipRude() {
}
void AIChip::activateAIHotspots() {
- PegasusEngine *vm = (PegasusEngine *)g_engine;
+ PegasusEngine *vm = g_vm;
_briefingSpot.setActive();
_scanSpot.setActive();
@@ -173,7 +173,7 @@ void AIChip::activateAIHotspots() {
}
void AIChip::showBriefingClicked() {
- PegasusEngine *vm = (PegasusEngine *)g_engine;
+ PegasusEngine *vm = g_vm;
_playingMovie = true;
@@ -193,7 +193,7 @@ void AIChip::showBriefingClicked() {
}
void AIChip::showEnvScanClicked() {
- PegasusEngine *vm = (PegasusEngine *)g_engine;
+ PegasusEngine *vm = g_vm;
_playingMovie = true;
@@ -219,7 +219,7 @@ void AIChip::clearClicked() {
}
void AIChip::clickInAIHotspot(HotSpotID id) {
- PegasusEngine *vm = (PegasusEngine *)g_engine;
+ PegasusEngine *vm = g_vm;
Common::String movieName;
diff --git a/engines/pegasus/items/biochips/arthurchip.cpp b/engines/pegasus/items/biochips/arthurchip.cpp
index a595d1a11a2..15b47bedc4e 100644
--- a/engines/pegasus/items/biochips/arthurchip.cpp
+++ b/engines/pegasus/items/biochips/arthurchip.cpp
@@ -131,7 +131,7 @@ void ArthurChip::select() {
}
void ArthurChip::setUpArthurChip() {
- PegasusEngine *vm = (PegasusEngine *)g_engine;
+ PegasusEngine *vm = g_vm;
ItemState state = getItemState();
if (vm->isChattyArthur()) {
@@ -159,7 +159,7 @@ void ArthurChip::activateArthurHotspots() {
}
void ArthurChip::clickInArthurHotspot(HotSpotID id) {
- PegasusEngine *vm = (PegasusEngine *)g_engine;
+ PegasusEngine *vm = g_vm;
ItemState state, newState;
if (id == kArthurHeadSpotID) {
@@ -226,7 +226,7 @@ void ArthurChip::clickInArthurHotspot(HotSpotID id) {
setItemState(newState);
switch (id) {
case kArthurWisdomSpotID:
- playArthurMovie(kArthurWisdomMovies[((PegasusEngine *)g_engine)->getRandomNumber((
+ playArthurMovie(kArthurWisdomMovies[g_vm->getRandomNumber((
sizeof(kArthurWisdomMovies) / sizeof(const char *)) - 1)]);
break;
case kChattyArthurSpotID:
@@ -253,7 +253,7 @@ void ArthurChip::playArthurMovie(const Common::String &movieName) {
}
bool ArthurChip::playArthurMovieForEvent(const Common::String &movieName, ArthurEvent event) {
- PegasusEngine *vm = (PegasusEngine *)g_engine;
+ PegasusEngine *vm = g_vm;
if (vm->isDVD() && vm->playerHasItemID(kArthurBiochip) &&
vm->isChattyArthur() && !Arthur._arthurFlags.getFlag(event)) {
diff --git a/engines/pegasus/items/biochips/biochipitem.cpp b/engines/pegasus/items/biochips/biochipitem.cpp
index fa5c60c03c1..51b0d4870b5 100644
--- a/engines/pegasus/items/biochips/biochipitem.cpp
+++ b/engines/pegasus/items/biochips/biochipitem.cpp
@@ -34,7 +34,7 @@ namespace Pegasus {
BiochipItem::BiochipItem(const ItemID id, const NeighborhoodID neighborhood, const RoomID room, const DirectionConstant direction) :
Item(id, neighborhood, room, direction) {
- PegasusEngine *vm = (PegasusEngine *)g_engine;
+ PegasusEngine *vm = g_vm;
Common::SeekableReadStream *biochipInfo = vm->_resFork->getResource(MKTAG('B', 'i', 'o', 'I'), kItemBaseResID + id);
if (biochipInfo) {
diff --git a/engines/pegasus/items/biochips/mapimage.cpp b/engines/pegasus/items/biochips/mapimage.cpp
index 03b04d7ea8d..16ab08ed9ec 100644
--- a/engines/pegasus/items/biochips/mapimage.cpp
+++ b/engines/pegasus/items/biochips/mapimage.cpp
@@ -266,14 +266,14 @@ void MapImage::readFromStream(Common::ReadStream *stream) {
void MapImage::loadGearRoomIfNecessary() {
if (_whichArea != kMapGearRoom) {
- _mapImage.getImageFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kMapOfGearRoomPICTID);
+ _mapImage.getImageFromPICTResource(g_vm->_resFork, kMapOfGearRoomPICTID);
Common::Rect bounds;
_mapImage.getSurfaceBounds(bounds);
_mapMask.allocateSurface(bounds);
_whichArea = kMapGearRoom;
- GraphicsManager *gfx = ((PegasusEngine *)g_engine)->_gfx;
+ GraphicsManager *gfx = g_vm->_gfx;
gfx->setCurSurface(_mapMask.getSurface());
gfx->getCurSurface()->fillRect(bounds, g_system->getScreenFormat().RGBToColor(0xff, 0xff, 0xff));
@@ -289,14 +289,14 @@ void MapImage::loadGearRoomIfNecessary() {
void MapImage::loadMazeIfNecessary() {
if (_whichArea != kMapMaze) {
- _mapImage.getImageFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kMapOfMazePICTID);
+ _mapImage.getImageFromPICTResource(g_vm->_resFork, kMapOfMazePICTID);
Common::Rect bounds;
_mapImage.getSurfaceBounds(bounds);
_mapMask.allocateSurface(bounds);
_whichArea = kMapMaze;
- GraphicsManager *gfx = ((PegasusEngine *)g_engine)->_gfx;
+ GraphicsManager *gfx = g_vm->_gfx;
gfx->setCurSurface(_mapMask.getSurface());
gfx->getCurSurface()->fillRect(bounds, g_system->getScreenFormat().RGBToColor(0xff, 0xff, 0xff));
@@ -318,7 +318,7 @@ void MapImage::unloadImage() {
}
void MapImage::moveToMapLocation(const NeighborhoodID, const RoomID room, const DirectionConstant dir) {
- GraphicsManager *gfx = ((PegasusEngine *)g_engine)->_gfx;
+ GraphicsManager *gfx = g_vm->_gfx;
int flag = ROOM_TO_FLAG(room, dir);
@@ -339,7 +339,7 @@ void MapImage::moveToMapLocation(const NeighborhoodID, const RoomID room, const
void MapImage::addFlagToMask(const int flag) {
Common::Rect r1;
getRevealedRects(flag, r1);
- ((PegasusEngine *)g_engine)->_gfx->getCurSurface()->fillRect(r1, g_system->getScreenFormat().RGBToColor(0, 0, 0));
+ g_vm->_gfx->getCurSurface()->fillRect(r1, g_system->getScreenFormat().RGBToColor(0, 0, 0));
}
// This function can even be sensitive to open doors.
@@ -368,7 +368,7 @@ void MapImage::getRevealedRects(const uint32 flag, Common::Rect &r1) {
}
void MapImage::drawPlayer() {
- Graphics::Surface *screen = ((PegasusEngine *)g_engine)->_gfx->getCurSurface();
+ Graphics::Surface *screen = g_vm->_gfx->getCurSurface();
CoordType gridX, gridY;
diff --git a/engines/pegasus/items/biochips/opticalchip.cpp b/engines/pegasus/items/biochips/opticalchip.cpp
index 4b2a2dc24af..dd9bd0552a7 100644
--- a/engines/pegasus/items/biochips/opticalchip.cpp
+++ b/engines/pegasus/items/biochips/opticalchip.cpp
@@ -130,7 +130,7 @@ void OpticalChip::playOpMemMovie(HotSpotID id) {
// when you destroyed the shuttle. For the DVD release, we have
// some new videos that can be played instead to workaround a plot
// loophole.
- if (!((PegasusEngine *)g_engine)->isDVD() || _opticalFlags.getFlag(kOpticalAriesExposed))
+ if (!g_vm->isDVD() || _opticalFlags.getFlag(kOpticalAriesExposed))
movieName = "Images/AI/Globals/OMAI";
else if (_itemOwnerID == kPlayerID)
movieName = "Images/AI/Globals/OMN1";
diff --git a/engines/pegasus/items/biochips/pegasuschip.cpp b/engines/pegasus/items/biochips/pegasuschip.cpp
index 6e5f6569527..9ef51792a79 100644
--- a/engines/pegasus/items/biochips/pegasuschip.cpp
+++ b/engines/pegasus/items/biochips/pegasuschip.cpp
@@ -64,7 +64,7 @@ void PegasusChip::setUpPegasusChip() {
setItemState(kPegasusTSA10);
break;
case kPrehistoricID:
- if (((PegasusEngine *)g_engine)->playerHasItemID(kHistoricalLog))
+ if (g_vm->playerHasItemID(kHistoricalLog))
setItemState(kPegasusPrehistoric00);
else
setItemState(kPegasusPrehistoric10);
@@ -97,7 +97,7 @@ void PegasusChip::setUpPegasusChip() {
void PegasusChip::setUpPegasusChipRude() {
switch (GameState.getCurrentNeighborhood()) {
case kPrehistoricID:
- if (((PegasusEngine *)g_engine)->playerHasItemID(kHistoricalLog))
+ if (g_vm->playerHasItemID(kHistoricalLog))
setItemState(kPegasusPrehistoric00);
break;
case kMarsID:
@@ -124,7 +124,7 @@ void PegasusChip::activatePegasusHotspots() {
// WORKAROUND: Don't allow the player to recall if they don't have
// the historical log. Otherwise, gameplay is broken when returning
// to the TSA.
- if (!((PegasusEngine *)g_engine)->playerHasItemID(kHistoricalLog))
+ if (!g_vm->playerHasItemID(kHistoricalLog))
return;
// fall through
case kMarsID:
@@ -139,7 +139,7 @@ void PegasusChip::activatePegasusHotspots() {
}
void PegasusChip::clickInPegasusHotspot() {
- PegasusEngine *vm = (PegasusEngine *)g_engine;
+ PegasusEngine *vm = g_vm;
ItemState thisState = getItemState();
ItemState hiliteState;
diff --git a/engines/pegasus/items/inventory/inventoryitem.cpp b/engines/pegasus/items/inventory/inventoryitem.cpp
index 2a88bde056d..6a521ce27bb 100644
--- a/engines/pegasus/items/inventory/inventoryitem.cpp
+++ b/engines/pegasus/items/inventory/inventoryitem.cpp
@@ -33,7 +33,7 @@ namespace Pegasus {
InventoryItem::InventoryItem(const ItemID id, const NeighborhoodID neighborhood, const RoomID room, const DirectionConstant direction) :
Item(id, neighborhood, room, direction) {
- PegasusEngine *vm = (PegasusEngine *)g_engine;
+ PegasusEngine *vm = g_vm;
Common::SeekableReadStream *leftInfo = vm->_resFork->getResource(MKTAG('L', 'e', 'f', 't'), kItemBaseResID + id);
if (leftInfo) {
diff --git a/engines/pegasus/items/inventory/keycard.cpp b/engines/pegasus/items/inventory/keycard.cpp
index a62c379fc24..1673aec6942 100644
--- a/engines/pegasus/items/inventory/keycard.cpp
+++ b/engines/pegasus/items/inventory/keycard.cpp
@@ -42,7 +42,7 @@ void KeyCard::toggleItemState() {
void KeyCard::setItemState(const ItemState newState) {
if (newState != getItemState()) {
InventoryItem::setItemState(newState);
- ((PegasusEngine *)g_engine)->checkFlashlight();
+ g_vm->checkFlashlight();
}
}
diff --git a/engines/pegasus/items/inventorypicture.cpp b/engines/pegasus/items/inventorypicture.cpp
index 99a013aac0d..a08b0a7cf7c 100644
--- a/engines/pegasus/items/inventorypicture.cpp
+++ b/engines/pegasus/items/inventorypicture.cpp
@@ -322,14 +322,14 @@ void InventoryItemsPicture::setCommPicture() {
}
void InventoryItemsPicture::playEndMessage(DisplayElement *pushElement) {
- PegasusEngine *vm = (PegasusEngine *)g_engine;
+ PegasusEngine *vm = g_vm;
Movie endMessage(0);
_shouldDrawHighlight = false;
endMessage.shareSurface(this);
endMessage.initFromMovieFile("Images/Caldoria/A56 Congrats");
- endMessage.setVolume(((PegasusEngine *)g_engine)->getSoundFXLevel());
+ endMessage.setVolume(g_vm->getSoundFXLevel());
endMessage.moveMovieBoxTo(kFinalMessageLeft - kInventoryPushLeft, kFinalMessageTop - kInventoryPushTop);
endMessage.setTriggeredElement(pushElement);
endMessage.start();
diff --git a/engines/pegasus/items/item.cpp b/engines/pegasus/items/item.cpp
index f3ebdd4faf7..de2dbe96eb3 100644
--- a/engines/pegasus/items/item.cpp
+++ b/engines/pegasus/items/item.cpp
@@ -45,7 +45,7 @@ Item::Item(const ItemID id, const NeighborhoodID neighborhood, const RoomID room
_itemOwnerID = kNoActorID;
_itemState = 0;
- PegasusEngine *vm = (PegasusEngine *)g_engine;
+ PegasusEngine *vm = g_vm;
Common::SeekableReadStream *info = vm->_resFork->getResource(kItemInfoResType, kItemBaseResID + id);
if (info) {
@@ -184,9 +184,9 @@ void Item::setItemState(const ItemState state) {
if (state != _itemState) {
_itemState = state;
- if (getItemType() == kInventoryItemType && ((PegasusEngine *)g_engine)->getCurrentInventoryItem() == (InventoryItem *)this)
+ if (getItemType() == kInventoryItemType && g_vm->getCurrentInventoryItem() == (InventoryItem *)this)
select();
- else if (getItemType() == kBiochipItemType && ((PegasusEngine *)g_engine)->getCurrentBiochip() == (BiochipItem *)this)
+ else if (getItemType() == kBiochipItemType && g_vm->getCurrentBiochip() == (BiochipItem *)this)
select();
}
}
@@ -285,7 +285,7 @@ ItemStateInfo Item::readItemState(Common::SeekableReadStream *stream) {
}
Sprite *Item::getDragSprite(const DisplayElementID id) const {
- PegasusEngine *vm = (PegasusEngine *)g_engine;
+ PegasusEngine *vm = g_vm;
Sprite *result = new Sprite(id);
SpriteFrame *frame = new SpriteFrame();
diff --git a/engines/pegasus/menu.cpp b/engines/pegasus/menu.cpp
index 015da70d248..26145725a8a 100644
--- a/engines/pegasus/menu.cpp
+++ b/engines/pegasus/menu.cpp
@@ -29,7 +29,7 @@
namespace Pegasus {
-GameMenu::GameMenu(const uint32 id) : IDObject(id), InputHandler((InputHandler *)((PegasusEngine *)g_engine)) {
+GameMenu::GameMenu(const uint32 id) : IDObject(id), InputHandler((InputHandler *)g_vm) {
_previousHandler = nullptr;
_lastCommand = kMenuCmdNoCommand;
}
@@ -146,15 +146,15 @@ MainMenu::MainMenu() : GameMenu(kMainMenuID), _menuBackground(0), _overviewButto
_restoreButton(0), _adventureButton(0), _walkthroughButton(0), _startButton(0),
_creditsButton(0), _quitButton(0), _largeSelect(0), _smallSelect(0) {
- bool isDemo = ((PegasusEngine *)g_engine)->isDemo();
+ bool isDemo = g_vm->isDemo();
if (isDemo) {
- if (((PegasusEngine *)g_engine)->isWindows())
+ if (g_vm->isWindows())
_menuBackground.initFromPICTFile("Images/Demo/DemoMenuPC.pict");
else
_menuBackground.initFromPICTFile("Images/Demo/DemoMenu.pict");
} else {
- if (((PegasusEngine *)g_engine)->isDVD())
+ if (g_vm->isDVD())
_menuBackground.initFromPICTFile("Images/Main Menu/MainMenu_hq.mac");
else
_menuBackground.initFromPICTFile("Images/Main Menu/MainMenu.mac");
@@ -229,7 +229,7 @@ MainMenu::MainMenu() : GameMenu(kMainMenuID), _menuBackground(0), _overviewButto
_menuLoop.attachFader(&_menuFader);
_menuLoop.initFromAIFFFile("Sounds/Main Menu.aiff");
- _menuFader.setMasterVolume(((PegasusEngine *)g_engine)->getAmbienceLevel());
+ _menuFader.setMasterVolume(g_vm->getAmbienceLevel());
updateDisplay();
}
@@ -256,7 +256,7 @@ void MainMenu::stopMainMenuLoop() {
}
void MainMenu::handleInput(const Input &input, const Hotspot *cursorSpot) {
- PegasusEngine *vm = (PegasusEngine *)g_engine;
+ PegasusEngine *vm = g_vm;
bool isDemo = vm->isDemo();
if (input.upButtonDown()) {
@@ -347,7 +347,7 @@ void MainMenu::handleInput(const Input &input, const Hotspot *cursorSpot) {
}
void MainMenu::updateDisplay() {
- PegasusEngine *vm = (PegasusEngine *)g_engine;
+ PegasusEngine *vm = g_vm;
if (vm->isDemo()) {
switch (_menuSelection) {
@@ -468,7 +468,7 @@ static const TimeValue kFrameIncrement = 120; // Three frames...
CreditsMenu::CreditsMenu() : GameMenu(kCreditsMenuID), _menuBackground(0), _creditsMovie(0),
_mainMenuButton(0), _largeSelect(0), _smallSelect(0) {
- if (((PegasusEngine *)g_engine)->isDVD())
+ if (g_vm->isDVD())
_menuBackground.initFromPICTFile("Images/Credits/CredScrnScummVM.pict");
else
_menuBackground.initFromPICTFile("Images/Credits/CredScrn.pict");
@@ -476,7 +476,7 @@ CreditsMenu::CreditsMenu() : GameMenu(kCreditsMenuID), _menuBackground(0), _cred
_menuBackground.startDisplaying();
_menuBackground.show();
- if (((PegasusEngine *)g_engine)->isDVD())
+ if (g_vm->isDVD())
_creditsMovie.initFromMovieFile("Images/Credits/Credits_scummVM.movie");
else
_creditsMovie.initFromMovieFile("Images/Credits/Credits.movie");
@@ -505,10 +505,10 @@ CreditsMenu::CreditsMenu() : GameMenu(kCreditsMenuID), _menuBackground(0), _cred
newMenuSelection(kCreditsMenuCoreTeam);
- if (((PegasusEngine *)g_engine)->isDVD()) {
+ if (g_vm->isDVD()) {
_menuLoop.attachFader(&_menuFader);
_menuLoop.initFromAIFFFile("Sounds/Credits.aiff");
- _menuFader.setMasterVolume(((PegasusEngine *)g_engine)->getAmbienceLevel());
+ _menuFader.setMasterVolume(g_vm->getAmbienceLevel());
}
}
@@ -518,7 +518,7 @@ CreditsMenu::~CreditsMenu() {
}
void CreditsMenu::startCreditsMenuLoop() {
- if (((PegasusEngine *)g_engine)->isDVD()) {
+ if (g_vm->isDVD()) {
FaderMoveSpec spec;
_menuLoop.loopSound();
@@ -529,7 +529,7 @@ void CreditsMenu::startCreditsMenuLoop() {
}
void CreditsMenu::stopCreditsMenuLoop() {
- if (((PegasusEngine *)g_engine)->isDVD()) {
+ if (g_vm->isDVD()) {
FaderMoveSpec spec;
spec.makeTwoKnotFaderSpec(30, 0, 255, 30, 0);
@@ -552,14 +552,14 @@ void CreditsMenu::newMenuSelection(const int newSelection) {
break;
case kCreditsMenuOriginalTeam:
_smallSelect.moveElementTo(kOriginalTeamSelectLeft, kOriginalTeamSelectTop);
- if (((PegasusEngine *)g_engine)->isDVD())
+ if (g_vm->isDVD())
_creditsMovie.setTime(kOriginalTeamDVDTime);
else
_creditsMovie.setTime(kOriginalTeamCDTime);
break;
case kCreditsMenuTalent:
_smallSelect.moveElementTo(kTalentSelectLeft, kTalentSelectTop);
- if (((PegasusEngine *)g_engine)->isDVD())
+ if (g_vm->isDVD())
_creditsMovie.setTime(kTalentDVDTime);
else
_creditsMovie.setTime(kTalentCDTime);
@@ -568,7 +568,7 @@ void CreditsMenu::newMenuSelection(const int newSelection) {
_smallSelect.moveElementTo(kOtherTitlesSelectLeft, kOtherTitlesSelectTop);
_smallSelect.show();
_largeSelect.hide();
- if (((PegasusEngine *)g_engine)->isDVD())
+ if (g_vm->isDVD())
_creditsMovie.setTime(kOtherTitlesDVDTime);
else
_creditsMovie.setTime(kOtherTitlesCDTime);
@@ -588,7 +588,7 @@ void CreditsMenu::newMenuSelection(const int newSelection) {
void CreditsMenu::newMovieTime(const TimeValue newTime) {
// The DVD credits have an extra frame in the support team section
- bool isDVD = ((PegasusEngine *)g_engine)->isDVD();
+ bool isDVD = g_vm->isDVD();
if (newTime < kSupportTeamTime) {
_smallSelect.moveElementTo(kCoreTeamSelectLeft, kCoreTeamSelectTop);
@@ -632,7 +632,7 @@ void CreditsMenu::handleInput(const Input &input, const Hotspot *cursorSpot) {
} else if (JMPPPInput::isMenuButtonPressInput(input)) {
if (_menuSelection == kCreditsMenuMainMenu) {
_mainMenuButton.show();
- ((PegasusEngine *)g_engine)->delayShell(kMenuButtonHiliteTime, kMenuButtonHiliteScale);
+ g_vm->delayShell(kMenuButtonHiliteTime, kMenuButtonHiliteScale);
_mainMenuButton.hide();
setLastCommand(kMenuCmdCreditsMainMenu);
}
@@ -691,7 +691,7 @@ enum {
// Never set the current input handler to the DeathMenu.
DeathMenu::DeathMenu(const DeathReason deathReason) : GameMenu(kDeathMenuID), _deathBackground(0), _continueButton(0),
_mainMenuButton(0), _quitButton(0), _restoreButton(0), _largeSelect(0), _smallSelect(0) {
- PegasusEngine *vm = (PegasusEngine *)g_engine;
+ PegasusEngine *vm = g_vm;
bool isDemo = vm->isDemo();
_playerWon = (deathReason == kPlayerWonGame);
@@ -802,7 +802,7 @@ DeathMenu::DeathMenu(const DeathReason deathReason) : GameMenu(kDeathMenuID), _d
_triumphSound.initFromAIFFFile("Sounds/Caldoria/Galactic Triumph.44K.aiff");
else
_triumphSound.initFromQuickTime("Sounds/Caldoria/Galactic Triumph");
- _triumphSound.setVolume(((PegasusEngine *)g_engine)->getAmbienceLevel());
+ _triumphSound.setVolume(g_vm->getAmbienceLevel());
_triumphSound.playSound();
}
@@ -810,7 +810,7 @@ DeathMenu::DeathMenu(const DeathReason deathReason) : GameMenu(kDeathMenuID), _d
}
void DeathMenu::handleInput(const Input &input, const Hotspot *cursorSpot) {
- PegasusEngine *vm = (PegasusEngine *)g_engine;
+ PegasusEngine *vm = g_vm;
if (input.upButtonDown()) {
if (_menuSelection > (vm->isDemo() ? kFirstDeathSelectionDemo : kFirstDeathSelection)) {
@@ -876,7 +876,7 @@ void DeathMenu::handleInput(const Input &input, const Hotspot *cursorSpot) {
}
void DeathMenu::updateDisplay() {
- if (((PegasusEngine *)g_engine)->isDemo()) {
+ if (g_vm->isDemo()) {
switch (_menuSelection) {
case kDeathScreenContinueDemo:
_smallSelect.moveElementTo(kContinueSelectLeft, kContinueSelectTopDemo);
@@ -1068,7 +1068,7 @@ static const CoordType kPauseScoreBottom = kPauseScoreTop + 12;
PauseMenu::PauseMenu() : GameMenu(kPauseMenuID), _pauseBackground(0), _saveButton(0), _restoreButton(0),
_walkthroughButton(0), _continueButton(0), _soundFXLevel(0), _ambienceLevel(0), _quitButton(0),
_largeSelect(0), _smallSelect(0) {
- PegasusEngine *vm = (PegasusEngine *)g_engine;
+ PegasusEngine *vm = g_vm;
_pauseBackground.initFromPICTFile("Images/Pause Screen/PausScrn.pict", true);
@@ -1142,7 +1142,7 @@ PauseMenu::PauseMenu() : GameMenu(kPauseMenuID), _pauseBackground(0), _saveButto
}
void PauseMenu::handleInput(const Input &input, const Hotspot *cursorSpot) {
- PegasusEngine *vm = (PegasusEngine *)g_engine;
+ PegasusEngine *vm = g_vm;
if (input.upButtonDown()) {
if (vm->isDemo()) {
@@ -1302,7 +1302,7 @@ void PauseMenu::updateDisplay() {
break;
}
- ((PegasusEngine *)g_engine)->resetIntroTimer();
+ g_vm->resetIntroTimer();
}
diff --git a/engines/pegasus/neighborhood/caldoria/caldoria4dsystem.cpp b/engines/pegasus/neighborhood/caldoria/caldoria4dsystem.cpp
index 5118e19bc31..83948881827 100644
--- a/engines/pegasus/neighborhood/caldoria/caldoria4dsystem.cpp
+++ b/engines/pegasus/neighborhood/caldoria/caldoria4dsystem.cpp
@@ -382,7 +382,7 @@ void Caldoria4DSystem::playSound(const Common::String &baseFileName) {
Common::String fileName = "Sounds/Caldoria/" + baseFileName;
// Updated DVD files
- if (((PegasusEngine *)g_engine)->isDVD())
+ if (g_vm->isDVD())
fileName += ".44K";
_owner->loadLoopSound1(fileName + ".aiff");
diff --git a/engines/pegasus/neighborhood/caldoria/caldoriabomb.cpp b/engines/pegasus/neighborhood/caldoria/caldoriabomb.cpp
index 65d69d314d2..7cb902db6ed 100644
--- a/engines/pegasus/neighborhood/caldoria/caldoriabomb.cpp
+++ b/engines/pegasus/neighborhood/caldoria/caldoriabomb.cpp
@@ -1011,29 +1011,29 @@ BombGrid::BombGrid(const DisplayElementID id) : Picture(id) {
_transparent = true;
- _yellowDot.initFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kYellowBombPICTBaseID, true);
- _yellowOneSixteenth.initFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kYellowBombPICTBaseID + 1, true);
- _yellowOneEighth.initFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kYellowBombPICTBaseID + 2, true);
- _yellowThreeSixteenths.initFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kYellowBombPICTBaseID + 3, true);
- _yellowOneFourth.initFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kYellowBombPICTBaseID + 4, true);
- _yellowFiveSixteenths.initFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kYellowBombPICTBaseID + 5, true);
- _yellowThreeEighths.initFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kYellowBombPICTBaseID + 6, true);
- _yellowSevenSixteenths.initFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kYellowBombPICTBaseID + 7, true);
- _yellowOneHalf.initFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kYellowBombPICTBaseID + 8, true);
-
- _redDot.initFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kRedBombPICTBaseID, true);
- _redOneSixteenth.initFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kRedBombPICTBaseID + 1, true);
- _redOneEighth.initFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kRedBombPICTBaseID + 2, true);
- _redThreeSixteenths.initFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kRedBombPICTBaseID + 3, true);
- _redOneFourth.initFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kRedBombPICTBaseID + 4, true);
- _redFiveSixteenths.initFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kRedBombPICTBaseID + 5, true);
- _redThreeEighths.initFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kRedBombPICTBaseID + 6, true);
- _redSevenSixteenths.initFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kRedBombPICTBaseID + 7, true);
- _redOneHalf.initFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kRedBombPICTBaseID + 8, true);
+ _yellowDot.initFromPICTResource(g_vm->_resFork, kYellowBombPICTBaseID, true);
+ _yellowOneSixteenth.initFromPICTResource(g_vm->_resFork, kYellowBombPICTBaseID + 1, true);
+ _yellowOneEighth.initFromPICTResource(g_vm->_resFork, kYellowBombPICTBaseID + 2, true);
+ _yellowThreeSixteenths.initFromPICTResource(g_vm->_resFork, kYellowBombPICTBaseID + 3, true);
+ _yellowOneFourth.initFromPICTResource(g_vm->_resFork, kYellowBombPICTBaseID + 4, true);
+ _yellowFiveSixteenths.initFromPICTResource(g_vm->_resFork, kYellowBombPICTBaseID + 5, true);
+ _yellowThreeEighths.initFromPICTResource(g_vm->_resFork, kYellowBombPICTBaseID + 6, true);
+ _yellowSevenSixteenths.initFromPICTResource(g_vm->_resFork, kYellowBombPICTBaseID + 7, true);
+ _yellowOneHalf.initFromPICTResource(g_vm->_resFork, kYellowBombPICTBaseID + 8, true);
+
+ _redDot.initFromPICTResource(g_vm->_resFork, kRedBombPICTBaseID, true);
+ _redOneSixteenth.initFromPICTResource(g_vm->_resFork, kRedBombPICTBaseID + 1, true);
+ _redOneEighth.initFromPICTResource(g_vm->_resFork, kRedBombPICTBaseID + 2, true);
+ _redThreeSixteenths.initFromPICTResource(g_vm->_resFork, kRedBombPICTBaseID + 3, true);
+ _redOneFourth.initFromPICTResource(g_vm->_resFork, kRedBombPICTBaseID + 4, true);
+ _redFiveSixteenths.initFromPICTResource(g_vm->_resFork, kRedBombPICTBaseID + 5, true);
+ _redThreeEighths.initFromPICTResource(g_vm->_resFork, kRedBombPICTBaseID + 6, true);
+ _redSevenSixteenths.initFromPICTResource(g_vm->_resFork, kRedBombPICTBaseID + 7, true);
+ _redOneHalf.initFromPICTResource(g_vm->_resFork, kRedBombPICTBaseID + 8, true);
}
void BombGrid::drawEdges(BombEdgeList edges) {
- GraphicsManager *gfx = ((PegasusEngine *)g_engine)->_gfx;
+ GraphicsManager *gfx = g_vm->_gfx;
gfx->setCurSurface(_surface);
_surface->fillRect(Common::Rect(0, 0, kBombGridWidth, kBombGridHeight), g_system->getScreenFormat().RGBToColor(0xff, 0xff, 0xff));
@@ -1102,8 +1102,8 @@ void BombGrid::drawEdges(BombEdgeList edges) {
BombTimer::BombTimer(const DisplayElementID id) : IdlerAnimation(id) {
_middle = -1;
- _leftImage.getImageFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kTimerLeftPICTID);
- _rightImage.getImageFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kTimerRightPICTID);
+ _leftImage.getImageFromPICTResource(g_vm->_resFork, kTimerLeftPICTID);
+ _rightImage.getImageFromPICTResource(g_vm->_resFork, kTimerRightPICTID);
Common::Rect r;
_leftImage.getSurfaceBounds(r);
@@ -1173,7 +1173,7 @@ void CaldoriaBomb::setSoundFXLevel(const uint16) {
// The transition sounds between levels are ambience, so overwrite what
// Neighborhood::setSoundFXLevel does and keep using the ambience volume level
if (_timer.isRunning())
- _owner->_navMovie.setVolume(((PegasusEngine *)g_engine)->getAmbienceLevel());
+ _owner->_navMovie.setVolume(g_vm->getAmbienceLevel());
}
void CaldoriaBomb::setAmbienceLevel(const uint16 level) {
@@ -1248,10 +1248,10 @@ void CaldoriaBomb::receiveNotification(Notification *notification, const Notific
_timer.start();
_currentLevel = 0;
_lastVertex = -1;
- _owner->_navMovie.setVolume(((PegasusEngine *)g_engine)->getAmbienceLevel());
+ _owner->_navMovie.setVolume(g_vm->getAmbienceLevel());
startBombAmbient("Sounds/Caldoria/BmbLoop1.22K.AIFF");
if (g_arthurChip) {
- if (((PegasusEngine *)g_engine)->getRandomBit())
+ if (g_vm->getRandomBit())
g_arthurChip->playArthurMovieForEvent("Images/AI/Globals/XGLOBA14", kArthurCaldoriaSeeRoofBomb);
else
g_arthurChip->playArthurMovieForEvent("Images/AI/Globals/XGLOBB28", kArthurCaldoriaSeeRoofBomb);
@@ -1281,7 +1281,7 @@ void CaldoriaBomb::receiveNotification(Notification *notification, const Notific
_grid.hide();
_timer.stop();
_timer.hide();
- _owner->_navMovie.setVolume(((PegasusEngine *)g_engine)->getSoundFXLevel());
+ _owner->_navMovie.setVolume(g_vm->getSoundFXLevel());
_owner->loadLoopSound1("");
_owner->playDeathExtra(kCaldoria56BombExplodes, kDeathNuclearExplosion);
}
@@ -1435,7 +1435,7 @@ void CaldoriaBomb::handleInput(const Input &input, const Hotspot *hotspot) {
_timer.stop();
_grid.hide();
_timer.hide();
- _owner->_navMovie.setVolume(((PegasusEngine *)g_engine)->getSoundFXLevel());
+ _owner->_navMovie.setVolume(g_vm->getSoundFXLevel());
_owner->startExtraSequence(kCaldoria56BombStage7, kExtraCompletedFlag, kFilterNoInput);
if (g_arthurChip)
g_arthurChip->playArthurMovieForEvent("Images/AI/Globals/XGLOBA02", kArthurCaldoriaDisarmedNuke);
diff --git a/engines/pegasus/neighborhood/caldoria/caldoriamessages.cpp b/engines/pegasus/neighborhood/caldoria/caldoriamessages.cpp
index 96c15c38334..24486d582f9 100644
--- a/engines/pegasus/neighborhood/caldoria/caldoriamessages.cpp
+++ b/engines/pegasus/neighborhood/caldoria/caldoriamessages.cpp
@@ -109,7 +109,7 @@ void CaldoriaMessages::play1Message(uint messageNumber) {
GameState.setCaldoriaSeenMessages(true);
}
- _messageMovie.setVolume(((PegasusEngine *)g_engine)->getSoundFXLevel());
+ _messageMovie.setVolume(g_vm->getSoundFXLevel());
_messageMovie.moveElementTo(kCaldoriaMessageLeft, kCaldoriaMessageTop);
_messageMovie.setDisplayOrder(kCaldoriaMessagesOrder);
_messageMovie.startDisplaying();
diff --git a/engines/pegasus/neighborhood/mars/canyonchase.cpp b/engines/pegasus/neighborhood/mars/canyonchase.cpp
index da206a6c99a..540a40bc816 100644
--- a/engines/pegasus/neighborhood/mars/canyonchase.cpp
+++ b/engines/pegasus/neighborhood/mars/canyonchase.cpp
@@ -84,7 +84,7 @@ void MusicTimerEvent::fire() {
}
CanyonChase::CanyonChase(Neighborhood *handler) : ChaseInteraction(kMarsCanyonChaseInteractionID, handler,
- kMarsCanyonChaseNotificationID, (PegasusEngine *)g_engine), _canyonMovie1(kNoDisplayElement),
+ kMarsCanyonChaseNotificationID, g_vm), _canyonMovie1(kNoDisplayElement),
_canyonMovie2(kNoDisplayElement), _deathMovie(kNoDisplayElement), _genoMovie(kNoDisplayElement) {
_currentMovie = nullptr;
_currentCallBack = nullptr;
@@ -118,7 +118,7 @@ void CanyonChase::stopCanyonMusicLoop(const long ticks) {
void CanyonChase::openInteraction() {
_canyonMovie1.initFromMovieFile("Images/Mars/Canyon_hq1.mov");
- _canyonMovie1.setVolume(((PegasusEngine *)g_engine)->getSoundFXLevel());
+ _canyonMovie1.setVolume(g_vm->getSoundFXLevel());
_canyonMovie1.moveElementTo(kShuttleWindowLeft, kShuttleWindowTop);
_canyonMovie1.setDisplayOrder(kShuttleMonitorOrder);
@@ -128,7 +128,7 @@ void CanyonChase::openInteraction() {
_canyon1CallBack.scheduleCallBack(kTriggerAtStop, 0, 0);
_canyonMovie2.initFromMovieFile("Images/Mars/Canyon_hq2.mov");
- _canyonMovie2.setVolume(((PegasusEngine *)g_engine)->getSoundFXLevel());
+ _canyonMovie2.setVolume(g_vm->getSoundFXLevel());
_canyonMovie2.moveElementTo(kShuttleWindowLeft, kShuttleWindowTop);
_canyonMovie2.setDisplayOrder(kShuttleMonitorOrder);
@@ -138,7 +138,7 @@ void CanyonChase::openInteraction() {
_canyon2CallBack.scheduleCallBack(kTriggerAtStop, 0, 0);
_deathMovie.initFromMovieFile("Images/Mars/Canyon_hqD.mov");
- _deathMovie.setVolume(((PegasusEngine *)g_engine)->getSoundFXLevel());
+ _deathMovie.setVolume(g_vm->getSoundFXLevel());
_deathMovie.moveElementTo(kShuttleWindowLeft, kShuttleWindowTop);
_deathMovie.setDisplayOrder(kShuttleMonitorOrder);
@@ -149,7 +149,7 @@ void CanyonChase::openInteraction() {
_musicLoop.attachFader(&_musicFader);
_musicLoop.initFromAIFFFile("Sounds/Mars/Canyon Loop.44K.16.AIFF");
- _musicFader.setMasterVolume(((PegasusEngine *)g_engine)->getAmbienceLevel());
+ _musicFader.setMasterVolume(g_vm->getAmbienceLevel());
ChaseInteraction::openInteraction();
@@ -518,7 +518,7 @@ void CanyonChase::musicTimerExpired(MusicTimerEvent &event) {
void CanyonChase::doGenoChase() {
_genoMovie.initFromMovieFile("Images/Mars/Canyon_hqG.mov");
- _genoMovie.setVolume(((PegasusEngine *)g_engine)->getAmbienceLevel());
+ _genoMovie.setVolume(g_vm->getAmbienceLevel());
_genoMovie.moveElementTo(kShuttleWindowLeft, kShuttleWindowTop);
_genoMovie.setDisplayOrder(kShuttleMonitorOrder);
_genoMovie.startDisplaying();
diff --git a/engines/pegasus/neighborhood/mars/energybeam.cpp b/engines/pegasus/neighborhood/mars/energybeam.cpp
index 1ab81e330af..9a58dd8c8b1 100644
--- a/engines/pegasus/neighborhood/mars/energybeam.cpp
+++ b/engines/pegasus/neighborhood/mars/energybeam.cpp
@@ -46,7 +46,7 @@ void EnergyBeam::draw(const Common::Rect &) {
static const int kBeamColorRed1 = 224;
static const int kBeamColorRed2 = 64;
- Graphics::Surface *surface = ((PegasusEngine *)g_engine)->_gfx->getWorkArea();
+ Graphics::Surface *surface = g_vm->_gfx->getWorkArea();
byte red = linearInterp(0, kEnergyBeamTime, _lastTime, kBeamColorRed1, kBeamColorRed2);
uint32 color = surface->format.RGBToColor(red, 0, 0);
diff --git a/engines/pegasus/neighborhood/mars/mars.cpp b/engines/pegasus/neighborhood/mars/mars.cpp
index 956db8ab0c3..f4fd165b5e2 100644
--- a/engines/pegasus/neighborhood/mars/mars.cpp
+++ b/engines/pegasus/neighborhood/mars/mars.cpp
@@ -190,7 +190,7 @@ ArthurOxygen50Action::ArthurOxygen50Action() : AIPlayMessageAction("Images/AI/Ma
}
void ArthurOxygen50Action::performAIAction(AIRule *rule) {
- PegasusEngine *vm = (PegasusEngine *)g_engine;
+ PegasusEngine *vm = g_vm;
if (GameState.isTakenItemID(kArthurBiochip) && g_arthurChip && vm->isChattyArthur())
g_arthurChip->playArthurMovieForEvent("Images/AI/Globals/XGLOBA84", kArthurMarsOxygen50Warning);
@@ -209,7 +209,7 @@ ArthurOxygen25Action::ArthurOxygen25Action() : AIPlayMessageAction("Images/AI/Ma
}
void ArthurOxygen25Action::performAIAction(AIRule *rule) {
- PegasusEngine *vm = (PegasusEngine *)g_engine;
+ PegasusEngine *vm = g_vm;
if (GameState.isTakenItemID(kArthurBiochip) && g_arthurChip && vm->isChattyArthur()) {
if (vm->getRandomBit())
@@ -232,7 +232,7 @@ ArthurOxygen5Action::ArthurOxygen5Action() : AIPlayMessageAction("Images/AI/Mars
}
void ArthurOxygen5Action::performAIAction(AIRule *rule) {
- PegasusEngine *vm = (PegasusEngine *)g_engine;
+ PegasusEngine *vm = g_vm;
if (GameState.isTakenItemID(kArthurBiochip) && g_arthurChip && vm->isChattyArthur()) {
if (vm->getRandomBit())
@@ -4265,7 +4265,7 @@ void Mars::checkAirMask() {
}
void Mars::airStageExpired() {
- if (((PegasusEngine *)g_engine)->playerHasItemID(kAirMask))
+ if (g_vm->playerHasItemID(kAirMask))
die(kDeathNoAirInMaze);
else
die(kDeathNoMaskInMaze);
diff --git a/engines/pegasus/neighborhood/mars/planetmover.cpp b/engines/pegasus/neighborhood/mars/planetmover.cpp
index 1f1a2c7f537..7d4efca882f 100644
--- a/engines/pegasus/neighborhood/mars/planetmover.cpp
+++ b/engines/pegasus/neighborhood/mars/planetmover.cpp
@@ -46,7 +46,7 @@ PlanetMover::PlanetMover() {
void PlanetMover::startMoving(Movie *planetMovie) {
_planetMovie = planetMovie;
_p4 = kPlanetStartTop;
- _r4 = ((PegasusEngine *)g_engine)->getRandomNumber(kMaxVelocity - 1);
+ _r4 = g_vm->getRandomNumber(kMaxVelocity - 1);
if (_r4 + _p4 < kPlanetStopTop)
_r4 = kPlanetStopTop - _p4;
newDestination();
@@ -75,14 +75,14 @@ void PlanetMover::newDestination() {
_p1 = _p4;
_r1 = _r4;
- _p4 = kPlanetStopTop + ((PegasusEngine *)g_engine)->getRandomNumber(kPlanetStartTop - kPlanetStopTop - 1);
- _r4 = ((PegasusEngine *)g_engine)->getRandomNumber(kMaxVelocity - 1);
+ _p4 = kPlanetStopTop + g_vm->getRandomNumber(kPlanetStartTop - kPlanetStopTop - 1);
+ _r4 = g_vm->getRandomNumber(kMaxVelocity - 1);
if (_r4 + _p4 < kPlanetStopTop)
_r4 = kPlanetStopTop - _p4;
stop();
- _duration = kRovingTime + ((PegasusEngine *)g_engine)->getRandomNumber(kRovingSlop - 1);
+ _duration = kRovingTime + g_vm->getRandomNumber(kRovingSlop - 1);
setSegment(0, _duration);
setTime(0);
start();
diff --git a/engines/pegasus/neighborhood/mars/reactor.cpp b/engines/pegasus/neighborhood/mars/reactor.cpp
index d3c032241b4..e9e025ef180 100644
--- a/engines/pegasus/neighborhood/mars/reactor.cpp
+++ b/engines/pegasus/neighborhood/mars/reactor.cpp
@@ -48,7 +48,7 @@ ReactorGuess::ReactorGuess(const DisplayElementID id) : DisplayElement(id) {
}
void ReactorGuess::initReactorGuess() {
- _colors.getImageFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kReactorChoicesPICTID);
+ _colors.getImageFromPICTResource(g_vm->_resFork, kReactorChoicesPICTID);
startDisplaying();
show();
}
@@ -104,7 +104,7 @@ ReactorChoiceHighlight::ReactorChoiceHighlight(const DisplayElementID id) : Disp
}
void ReactorChoiceHighlight::initReactorChoiceHighlight() {
- _colors.getImageFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kReactorChoiceHilitePICTID);
+ _colors.getImageFromPICTResource(g_vm->_resFork, kReactorChoiceHilitePICTID);
startDisplaying();
show();
}
@@ -194,9 +194,9 @@ ReactorHistory::ReactorHistory(const DisplayElementID id) : DisplayElement(id) {
}
void ReactorHistory::initReactorHistory() {
- _colors.getImageFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kReactorHistoryPICTID);
- _digits.getImageFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kReactorDigitsPICTID);
- _answerColors.getImageFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kReactorAnswerPICTID);
+ _colors.getImageFromPICTResource(g_vm->_resFork, kReactorHistoryPICTID);
+ _digits.getImageFromPICTResource(g_vm->_resFork, kReactorDigitsPICTID);
+ _answerColors.getImageFromPICTResource(g_vm->_resFork, kReactorAnswerPICTID);
startDisplaying();
show();
}
diff --git a/engines/pegasus/neighborhood/mars/robotship.cpp b/engines/pegasus/neighborhood/mars/robotship.cpp
index 75ccf9c31ba..b747d5a0542 100644
--- a/engines/pegasus/neighborhood/mars/robotship.cpp
+++ b/engines/pegasus/neighborhood/mars/robotship.cpp
@@ -91,15 +91,15 @@ void RobotShip::cleanUpRobotShip() {
}
void RobotShip::startMoving() {
- if (((PegasusEngine *)g_engine)->getRandomBit()) {
- _p4.x = kInitialLocationLeft + ((PegasusEngine *)g_engine)->getRandomNumber(kInitialLocationWidth - 1);
- if (((PegasusEngine *)g_engine)->getRandomBit())
+ if (g_vm->getRandomBit()) {
+ _p4.x = kInitialLocationLeft + g_vm->getRandomNumber(kInitialLocationWidth - 1);
+ if (g_vm->getRandomBit())
_p4.y = kInitialLocationTop;
else
_p4.y = kInitialLocationTop + kInitialLocationHeight;
} else {
- _p4.y = kInitialLocationTop + ((PegasusEngine *)g_engine)->getRandomNumber(kInitialLocationHeight - 1);
- if (((PegasusEngine *)g_engine)->getRandomBit())
+ _p4.y = kInitialLocationTop + g_vm->getRandomNumber(kInitialLocationHeight - 1);
+ if (g_vm->getRandomBit())
_p4.x = kInitialLocationLeft;
else
_p4.x = kInitialLocationLeft + kInitialLocationWidth;
@@ -118,7 +118,7 @@ void RobotShip::killRobotShip() {
void RobotShip::setUpNextDropTime() {
if (!isSnared()) {
- _dropJunkFuse.primeFuse(kJunkDropBaseTime + ((PegasusEngine *)g_engine)->getRandomNumber(kJunkDropSlopTime));
+ _dropJunkFuse.primeFuse(kJunkDropBaseTime + g_vm->getRandomNumber(kJunkDropSlopTime));
_dropJunkFuse.lightFuse();
}
}
@@ -127,7 +127,7 @@ void RobotShip::timeToDropJunk() {
if (g_spaceJunk) {
CoordType x, y;
_spritesMovie.getCenter(x, y);
- g_spaceJunk->launchJunk(((PegasusEngine *)g_engine)->getRandomNumber(24), x, y);
+ g_spaceJunk->launchJunk(g_vm->getRandomNumber(24), x, y);
}
}
@@ -135,10 +135,10 @@ void RobotShip::newDestination() {
_p1 = _p4;
_r1 = _r4;
- _p4.x = kRovingLeft + ((PegasusEngine *)g_engine)->getRandomNumber(kRovingWidth - 1);
- _p4.y = kRovingTop + ((PegasusEngine *)g_engine)->getRandomNumber(kRovingHeight - 1);
+ _p4.x = kRovingLeft + g_vm->getRandomNumber(kRovingWidth - 1);
+ _p4.y = kRovingTop + g_vm->getRandomNumber(kRovingHeight - 1);
- if (((PegasusEngine *)g_engine)->getRandomNumber(7) < 6) {
+ if (g_vm->getRandomNumber(7) < 6) {
if (!sameSign(_p4.x - kShuttleWindowMidH, kShuttleWindowMidH - _p1.x)) {
if (sign(_p4.x - kShuttleWindowMidH) > 0)
_p4.x -= kRovingWidth;
@@ -147,7 +147,7 @@ void RobotShip::newDestination() {
}
}
- if (((PegasusEngine *)g_engine)->getRandomNumber(7) < 6) {
+ if (g_vm->getRandomNumber(7) < 6) {
if (!sameSign(_p4.y - kShuttleWindowMidV, kShuttleWindowMidV - _p1.y)) {
if (sign(_p4.y - kShuttleWindowMidV) > 0)
_p4.y -= kRovingHeight;
@@ -159,7 +159,7 @@ void RobotShip::newDestination() {
makeVelocityVector(_p4.x, _p4.y, kShuttleWindowLeft + kShuttleWindowWidth / 2,
kShuttleWindowTop + kShuttleWindowHeight / 2, _r4);
stop();
- _duration = kRovingTime + ((PegasusEngine *)g_engine)->getRandomNumber(kRovingSlop - 1);
+ _duration = kRovingTime + g_vm->getRandomNumber(kRovingSlop - 1);
setSegment(0, _duration);
setTime(0);
start();
@@ -212,7 +212,7 @@ bool RobotShip::pointInShuttle(Common::Point &pt) {
void RobotShip::hitByEnergyBeam(Common::Point impactPoint) {
((Mars *)g_neighborhood)->decreaseRobotShuttleEnergy(1, impactPoint);
setGlowing(true);
- ((PegasusEngine *)g_engine)->delayShell(1, 3);
+ g_vm->delayShell(1, 3);
setGlowing(false);
}
@@ -255,7 +255,7 @@ void RobotShip::timeChanged(const TimeValue) {
}
void RobotShip::makeVelocityVector(CoordType x1, CoordType y1, CoordType x2, CoordType y2, Common::Point &vector) {
- CoordType length = ((PegasusEngine *)g_engine)->getRandomNumber(kVelocityVectorSlop - 1) + kVelocityVectorLength;
+ CoordType length = g_vm->getRandomNumber(kVelocityVectorSlop - 1) + kVelocityVectorLength;
vector.x = x2 - x1;
vector.y = y2 - y1;
float oldLength = sqrt((float)(vector.x * vector.x + vector.y * vector.y));
diff --git a/engines/pegasus/neighborhood/mars/shuttlehud.cpp b/engines/pegasus/neighborhood/mars/shuttlehud.cpp
index b99d76cca8d..ed6b2cd5e36 100644
--- a/engines/pegasus/neighborhood/mars/shuttlehud.cpp
+++ b/engines/pegasus/neighborhood/mars/shuttlehud.cpp
@@ -155,7 +155,7 @@ void ShuttleHUD::unlockOnTarget() {
}
void ShuttleHUD::draw(const Common::Rect &) {
- Graphics::Surface *screen = ((PegasusEngine *)g_engine)->_gfx->getWorkArea();
+ Graphics::Surface *screen = g_vm->_gfx->getWorkArea();
for (int y = 0; y < 35; y++) {
Common::Rect r;
diff --git a/engines/pegasus/neighborhood/mars/spacejunk.cpp b/engines/pegasus/neighborhood/mars/spacejunk.cpp
index 5af367b6565..d9daf2c1d1d 100644
--- a/engines/pegasus/neighborhood/mars/spacejunk.cpp
+++ b/engines/pegasus/neighborhood/mars/spacejunk.cpp
@@ -147,7 +147,7 @@ void SpaceJunk::rebound(const TimeValue reboundTime) {
_bounceStart.x = (bounds.left + bounds.right) >> 1;
_bounceStart.y = (bounds.top + bounds.bottom) >> 1;
- PegasusEngine *vm = (PegasusEngine *)g_engine;
+ PegasusEngine *vm = g_vm;
switch (vm->getRandomNumber(3)) {
case 0:
@@ -185,7 +185,7 @@ void SpaceJunk::rebound(const TimeValue reboundTime) {
void SpaceJunk::hitByEnergyBeam(Common::Point) {
rebound(kWeaponReboundTime);
setGlowing(true);
- ((PegasusEngine *)g_engine)->delayShell(1, 3);
+ g_vm->delayShell(1, 3);
setGlowing(false);
}
diff --git a/engines/pegasus/neighborhood/mars/tractorbeam.cpp b/engines/pegasus/neighborhood/mars/tractorbeam.cpp
index 554e3d15fd7..08900a52964 100644
--- a/engines/pegasus/neighborhood/mars/tractorbeam.cpp
+++ b/engines/pegasus/neighborhood/mars/tractorbeam.cpp
@@ -70,7 +70,7 @@ static const int kBVert = 3 * kMaxLevel * kHalfHeight;
WRITE_PIXEL(ptr)
void TractorBeam::draw(const Common::Rect &) {
- Graphics::Surface *screen = ((PegasusEngine *)g_engine)->_gfx->getWorkArea();
+ Graphics::Surface *screen = g_vm->_gfx->getWorkArea();
// Set up vertical DDA.
int blendVert = 0;
diff --git a/engines/pegasus/neighborhood/mars/tunnelpod.cpp b/engines/pegasus/neighborhood/mars/tunnelpod.cpp
index b43a2b184a3..0a1c6bf47ee 100644
--- a/engines/pegasus/neighborhood/mars/tunnelpod.cpp
+++ b/engines/pegasus/neighborhood/mars/tunnelpod.cpp
@@ -64,7 +64,7 @@ enum {
TunnelPod::TunnelPod(Neighborhood *handler) : ChaseInteraction(kMarsTunnelPodInteractionID, handler,
- kMarsTunnelPodNotificationID, (PegasusEngine *)g_engine), _tunnelMainMovie(kNoDisplayElement),
+ kMarsTunnelPodNotificationID, g_vm), _tunnelMainMovie(kNoDisplayElement),
_tunnelAltMovie(kNoDisplayElement), _deathMovie(kNoDisplayElement) {
_currentMovie = nullptr;
_currentCallBack = nullptr;
@@ -85,7 +85,7 @@ void TunnelPod::openInteraction() {
_tunnelCallBack.scheduleCallBack(kTriggerAtStop, 0, 0);
_tunnelMainMovie.initFromMovieFile("Images/Mars/Pod 2345M.mov");
- _tunnelMainMovie.setVolume(((PegasusEngine *)g_engine)->getSoundFXLevel());
+ _tunnelMainMovie.setVolume(g_vm->getSoundFXLevel());
_tunnelMainMovie.moveElementTo(kNavAreaLeft, kNavAreaTop);
_tunnelMainMovie.setDisplayOrder(kNavMovieOrder);
@@ -95,7 +95,7 @@ void TunnelPod::openInteraction() {
_tunnelMainCallBack.scheduleCallBack(kTriggerAtStop, 0, 0);
_tunnelAltMovie.initFromMovieFile("Images/Mars/Pod 345A.mov");
- _tunnelAltMovie.setVolume(((PegasusEngine *)g_engine)->getSoundFXLevel());
+ _tunnelAltMovie.setVolume(g_vm->getSoundFXLevel());
_tunnelAltMovie.moveElementTo(kNavAreaLeft, kNavAreaTop);
_tunnelAltMovie.setDisplayOrder(kNavMovieOrder);
@@ -105,7 +105,7 @@ void TunnelPod::openInteraction() {
_tunnelAltCallBack.scheduleCallBack(kTriggerAtStop, 0, 0);
_deathMovie.initFromMovieFile("Images/Mars/Pod 2D.mov");
- _deathMovie.setVolume(((PegasusEngine *)g_engine)->getSoundFXLevel());
+ _deathMovie.setVolume(g_vm->getSoundFXLevel());
_deathMovie.moveElementTo(kNavAreaLeft, kNavAreaTop);
_deathMovie.setDisplayOrder(kNavMovieOrder);
diff --git a/engines/pegasus/neighborhood/norad/alpha/ecrmonitor.cpp b/engines/pegasus/neighborhood/norad/alpha/ecrmonitor.cpp
index 74222ad7f6b..695ef1c35e3 100644
--- a/engines/pegasus/neighborhood/norad/alpha/ecrmonitor.cpp
+++ b/engines/pegasus/neighborhood/norad/alpha/ecrmonitor.cpp
@@ -61,7 +61,7 @@ static const int kBeforePanTime = 3;
static const int kAfterPanTime = 5;
NoradAlphaECRMonitor::NoradAlphaECRMonitor(Neighborhood *nextHandler) : GameInteraction(kNoradECRMonitorInteractionID, nextHandler),
- _ecrSlideShowNotification(kNoradECRNotificationID, (PegasusEngine *)g_engine), _ecrMovie(kECRSlideShowMovieID),
+ _ecrSlideShowNotification(kNoradECRNotificationID, g_vm), _ecrMovie(kECRSlideShowMovieID),
_ecrPan(kECRPanID) {
}
diff --git a/engines/pegasus/neighborhood/norad/alpha/fillingstation.cpp b/engines/pegasus/neighborhood/norad/alpha/fillingstation.cpp
index 37c2e0d039f..2c2f61f271e 100644
--- a/engines/pegasus/neighborhood/norad/alpha/fillingstation.cpp
+++ b/engines/pegasus/neighborhood/norad/alpha/fillingstation.cpp
@@ -127,7 +127,7 @@ enum {
};
NoradAlphaFillingStation::NoradAlphaFillingStation(Neighborhood *owner) : GameInteraction(kNoradFillingStationInteractionID, owner),
- _rightSideMovie(kN01RightSideID), _rightSideNotification(kNoradFillingStationNotificationID, ((PegasusEngine *)g_engine)) {
+ _rightSideMovie(kN01RightSideID), _rightSideNotification(kNoradFillingStationNotificationID, g_vm) {
_state = kNoState;
}
diff --git a/engines/pegasus/neighborhood/norad/alpha/subchase.cpp b/engines/pegasus/neighborhood/norad/alpha/subchase.cpp
index 2d950443a77..9a749f86dbb 100644
--- a/engines/pegasus/neighborhood/norad/alpha/subchase.cpp
+++ b/engines/pegasus/neighborhood/norad/alpha/subchase.cpp
@@ -97,7 +97,7 @@ void BlinkTimerEvent::fire() {
}
SubChase::SubChase(Neighborhood *handler) : ChaseInteraction(kNoradSubChaseInteractionID, handler,
- kNoradSubChaseNotificationID, (PegasusEngine *)g_engine), _subMovie(kNoDisplayElement),
+ kNoradSubChaseNotificationID, g_vm), _subMovie(kNoDisplayElement),
_hintPict(kNoDisplayElement), _blinkPict(kNoDisplayElement), _canSteerSub(true) {
}
@@ -107,7 +107,7 @@ void SubChase::setSoundFXLevel(const uint16 fxLevel) {
void SubChase::openInteraction() {
_subMovie.initFromMovieFile("Images/Norad Alpha/Sub Chase Movie");
- _subMovie.setVolume(((PegasusEngine *)g_engine)->getSoundFXLevel());
+ _subMovie.setVolume(g_vm->getSoundFXLevel());
_subMovie.moveElementTo(0, 0);
_subMovie.setDisplayOrder(kSubChaseOrder);
_subMovie.startDisplaying();
@@ -177,10 +177,10 @@ void SubChase::receiveNotification(Notification *notification, const Notificatio
((NoradAlpha *)_owner)->die(kDeathSubDestroyed);
} else {
_subMovie.stopDisplaying();
- ((PegasusEngine *)g_engine)->_gfx->enableErase();
- ((PegasusEngine *)g_engine)->_gfx->updateDisplay();
- ((PegasusEngine *)g_engine)->_gfx->disableErase();
- ((PegasusEngine *)g_engine)->jumpToNewEnvironment(kNoradDeltaID, kNorad41, kEast);
+ g_vm->_gfx->enableErase();
+ g_vm->_gfx->updateDisplay();
+ g_vm->_gfx->disableErase();
+ g_vm->jumpToNewEnvironment(kNoradDeltaID, kNorad41, kEast);
}
}
ChaseInteraction::receiveNotification(notification, flags);
@@ -367,7 +367,7 @@ void SubChase::branchRight() {
_subState = kSubBranch6;
break;
case kSubBranch6:
- if (((PegasusEngine *)g_engine)->getRandomBit()) {
+ if (g_vm->getRandomBit()) {
branchStart = kBranch7RightStart;
branchEnd = kBranch7RightEnd;
flag = kChaseExitedBranchZone;
@@ -397,7 +397,7 @@ void SubChase::branchRight() {
}
void SubChase::dontBranch() {
- if (((PegasusEngine *)g_engine)->getRandomBit())
+ if (g_vm->getRandomBit())
branchLeft();
else
branchRight();
diff --git a/engines/pegasus/neighborhood/norad/delta/globegame.cpp b/engines/pegasus/neighborhood/norad/delta/globegame.cpp
index 1df27415e6a..3faf6c8c041 100644
--- a/engines/pegasus/neighborhood/norad/delta/globegame.cpp
+++ b/engines/pegasus/neighborhood/norad/delta/globegame.cpp
@@ -235,7 +235,7 @@ static const int kGlobeCountdownOffset1 = 12;
static const int kGlobeCountdownOffset2 = 20;
GlobeCountdown::GlobeCountdown(const DisplayElementID id) : IdlerAnimation(id) {
- _digits.getImageFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kGlobeCountdownDigitsID);
+ _digits.getImageFromPICTResource(g_vm->_resFork, kGlobeCountdownDigitsID);
Common::Rect r;
_digits.getSurfaceBounds(r);
@@ -465,7 +465,7 @@ float radiansToDegrees(float angle) {
GlobeGame::GlobeGame(Neighborhood *handler) : GameInteraction(kNoradGlobeGameInteractionID, handler),
_robotMovie(kGlobeRobotID), _monitorMovie(kGlobeMonitorID), _globeMovie(kGlobeMovieID),
_upperNamesMovie(kGlobeUpperNamesID), _lowerNamesMovie(kGlobeLowerNamesID),
- _globeNotification(kNoradGlobeNotificationID, (PegasusEngine *)g_engine), _globeCircleLeft(kGlobeCircleLeftID),
+ _globeNotification(kNoradGlobeNotificationID, g_vm), _globeCircleLeft(kGlobeCircleLeftID),
_globeCircleRight(kGlobeCircleRightID), _globeCircleUp(kGlobeCircleUpID), _globeCircleDown(kGlobeCircleDownID),
_motionHighlightLeft(kMotionHiliteLeftID), _motionHighlightRight(kMotionHiliteRightID),
_motionHighlightUp(kMotionHiliteUpID), _motionHighlightDown(kMotionHiliteDownID),
@@ -481,9 +481,9 @@ void GlobeGame::setSoundFXLevel(const uint16 fxLevel) {
}
void GlobeGame::openInteraction() {
- if (((PegasusEngine *)g_engine)->isDVD()) {
+ if (g_vm->isDVD()) {
_robotMovie.initFromMovieFile("Images/Norad Delta/N79 Back Monitor1");
- _robotMovie.setVolume(((PegasusEngine *)g_engine)->getSoundFXLevel());
+ _robotMovie.setVolume(g_vm->getSoundFXLevel());
_robotMovie.moveElementTo(kNavAreaLeft, kNavAreaTop);
_robotMovie.setDisplayOrder(kGlobeMonitorLayer);
_robotMovie.startDisplaying();
@@ -496,7 +496,7 @@ void GlobeGame::openInteraction() {
}
_monitorMovie.initFromMovieFile("Images/Norad Delta/N79 Left Monitor");
- _monitorMovie.setVolume(((PegasusEngine *)g_engine)->getSoundFXLevel());
+ _monitorMovie.setVolume(g_vm->getSoundFXLevel());
_monitorMovie.moveElementTo(kGlobeMonitorLeft, kGlobeMonitorTop);
_monitorMovie.setDisplayOrder(kGlobeMonitorLayer);
_monitorMovie.startDisplaying();
@@ -525,62 +525,62 @@ void GlobeGame::openInteraction() {
_globeMovie.setTime(kGlobeMovieStartTime);
_globeMovie.redrawMovieWorld();
- _globeCircleLeft.initFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kGlobeCircleLeftPICTID, true);
+ _globeCircleLeft.initFromPICTResource(g_vm->_resFork, kGlobeCircleLeftPICTID, true);
_globeCircleLeft.moveElementTo(kGlobeCircleLeftLeft, kGlobeCircleLeftTop);
_globeCircleLeft.setDisplayOrder(kGlobeCircleLayer);
_globeCircleLeft.startDisplaying();
- _globeCircleRight.initFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kGlobeCircleRightPICTID, true);
+ _globeCircleRight.initFromPICTResource(g_vm->_resFork, kGlobeCircleRightPICTID, true);
_globeCircleRight.moveElementTo(kGlobeCircleRightLeft, kGlobeCircleRightTop);
_globeCircleRight.setDisplayOrder(kGlobeCircleLayer);
_globeCircleRight.startDisplaying();
- _globeCircleUp.initFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kGlobeCircleUpPICTID, true);
+ _globeCircleUp.initFromPICTResource(g_vm->_resFork, kGlobeCircleUpPICTID, true);
_globeCircleUp.moveElementTo(kGlobeCircleUpLeft, kGlobeCircleUpTop);
_globeCircleUp.setDisplayOrder(kGlobeCircleLayer);
_globeCircleUp.startDisplaying();
- _globeCircleDown.initFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kGlobeCircleDownPICTID, true);
+ _globeCircleDown.initFromPICTResource(g_vm->_resFork, kGlobeCircleDownPICTID, true);
_globeCircleDown.moveElementTo(kGlobeCircleDownLeft, kGlobeCircleDownTop);
_globeCircleDown.setDisplayOrder(kGlobeCircleLayer);
_globeCircleDown.startDisplaying();
- _motionHighlightLeft.initFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kMotionHiliteLeftPICTID, true);
+ _motionHighlightLeft.initFromPICTResource(g_vm->_resFork, kMotionHiliteLeftPICTID, true);
_motionHighlightLeft.moveElementTo(kGlobeLeftMotionHiliteLeft, kGlobeLeftMotionHiliteTop);
_motionHighlightLeft.setDisplayOrder(kGlobeHilitesLayer);
_motionHighlightLeft.startDisplaying();
- _motionHighlightRight.initFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kMotionHiliteRightPICTID, true);
+ _motionHighlightRight.initFromPICTResource(g_vm->_resFork, kMotionHiliteRightPICTID, true);
_motionHighlightRight.moveElementTo(kGlobeRightMotionHiliteLeft, kGlobeRightMotionHiliteTop);
_motionHighlightRight.setDisplayOrder(kGlobeCircleLayer);
_motionHighlightRight.startDisplaying();
- _motionHighlightUp.initFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kMotionHiliteUpPICTID, true);
+ _motionHighlightUp.initFromPICTResource(g_vm->_resFork, kMotionHiliteUpPICTID, true);
_motionHighlightUp.moveElementTo(kGlobeUpMotionHiliteLeft, kGlobeUpMotionHiliteTop);
_motionHighlightUp.setDisplayOrder(kGlobeHilitesLayer);
_motionHighlightUp.startDisplaying();
- _motionHighlightDown.initFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kMotionHiliteDownPICTID, true);
+ _motionHighlightDown.initFromPICTResource(g_vm->_resFork, kMotionHiliteDownPICTID, true);
_motionHighlightDown.moveElementTo(kGlobeDownMotionHiliteLeft, kGlobeDownMotionHiliteTop);
_motionHighlightDown.setDisplayOrder(kGlobeHilitesLayer);
_motionHighlightDown.startDisplaying();
- _targetHighlightUpperLeft.initFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kTargetUpperLeftPICTID, true);
+ _targetHighlightUpperLeft.initFromPICTResource(g_vm->_resFork, kTargetUpperLeftPICTID, true);
_targetHighlightUpperLeft.moveElementTo(kGlobeUpperLeftHiliteLeft, kGlobeUpperLeftHiliteTop);
_targetHighlightUpperLeft.setDisplayOrder(kGlobeHilitesLayer);
_targetHighlightUpperLeft.startDisplaying();
- _targetHighlightUpperRight.initFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kTargetUpperRightPICTID, true);
+ _targetHighlightUpperRight.initFromPICTResource(g_vm->_resFork, kTargetUpperRightPICTID, true);
_targetHighlightUpperRight.moveElementTo(kGlobeUpperRightHiliteLeft, kGlobeUpperRightHiliteTop);
_targetHighlightUpperRight.setDisplayOrder(kGlobeHilitesLayer);
_targetHighlightUpperRight.startDisplaying();
- _targetHighlightLowerLeft.initFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kTargetLowerLeftPICTID, true);
+ _targetHighlightLowerLeft.initFromPICTResource(g_vm->_resFork, kTargetLowerLeftPICTID, true);
_targetHighlightLowerLeft.moveElementTo(kGlobeLowerLeftHiliteLeft, kGlobeLowerLeftHiliteTop);
_targetHighlightLowerLeft.setDisplayOrder(kGlobeHilitesLayer);
_targetHighlightLowerLeft.startDisplaying();
- _targetHighlightLowerRight.initFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kTargetLowerRightPICTID, true);
+ _targetHighlightLowerRight.initFromPICTResource(g_vm->_resFork, kTargetLowerRightPICTID, true);
_targetHighlightLowerRight.moveElementTo(kGlobeLowerRightHiliteLeft, kGlobeLowerRightHiliteTop);
_targetHighlightLowerRight.setDisplayOrder(kGlobeHilitesLayer);
_targetHighlightLowerRight.startDisplaying();
@@ -605,14 +605,14 @@ void GlobeGame::openInteraction() {
}
void GlobeGame::initInteraction() {
- if (((PegasusEngine *)g_engine)->isDVD())
+ if (g_vm->isDVD())
_robotMovie.start();
_monitorMovie.start();
_monitorMovie.redrawMovieWorld();
}
void GlobeGame::closeInteraction() {
- if (((PegasusEngine *)g_engine)->isDVD()) {
+ if (g_vm->isDVD()) {
_robotMovie.stop();
_robotMovie.stopDisplaying();
_robotMovie.releaseMovie();
@@ -677,7 +677,7 @@ void GlobeGame::receiveNotification(Notification *notification, const Notificati
if (notification == _neighborhoodNotification) {
switch (_gameState) {
case kPlayingRobotIntro:
- if (!((PegasusEngine *)g_engine)->isDVD()) {
+ if (!g_vm->isDVD()) {
_monitorMovie.stop();
_monitorMovie.setSegment(0, _monitorMovie.getDuration());
_monitorMovie.setTime(kSplash2End * scale - 1);
@@ -798,7 +798,7 @@ void GlobeGame::receiveNotification(Notification *notification, const Notificati
switch (_currentSiloIndex) {
case 3:
- if (!((PegasusEngine *)g_engine)->isDVD()) {
+ if (!g_vm->isDVD()) {
_owner->requestSpotSound(kYouCannotPossiblyIn, kYouCannotPossiblyOut,
kFilterNoInput, kSpotSoundCompletedFlag);
} else {
@@ -807,7 +807,7 @@ void GlobeGame::receiveNotification(Notification *notification, const Notificati
_robotMovie.releaseMovie();
_robotMovie.initFromMovieFile("Images/Norad Delta/N79 Back Monitor2");
- _robotMovie.setVolume(((PegasusEngine *)g_engine)->getSoundFXLevel());
+ _robotMovie.setVolume(g_vm->getSoundFXLevel());
_robotMovie.moveElementTo(kNavAreaLeft, kNavAreaTop);
_robotMovie.startDisplaying();
_robotMovie.show();
@@ -817,7 +817,7 @@ void GlobeGame::receiveNotification(Notification *notification, const Notificati
}
break;
case 5:
- if (!((PegasusEngine *)g_engine)->isDVD()) {
+ if (!g_vm->isDVD()) {
_owner->requestSpotSound(kYouWillFailIn, kYouWillFailOut, kFilterNoInput,
kSpotSoundCompletedFlag);
} else {
@@ -826,7 +826,7 @@ void GlobeGame::receiveNotification(Notification *notification, const Notificati
_robotMovie.releaseMovie();
_robotMovie.initFromMovieFile("Images/Norad Delta/N79 Back Monitor3");
- _robotMovie.setVolume(((PegasusEngine *)g_engine)->getSoundFXLevel());
+ _robotMovie.setVolume(g_vm->getSoundFXLevel());
_robotMovie.moveElementTo(kNavAreaLeft, kNavAreaTop);
_robotMovie.startDisplaying();
_robotMovie.show();
@@ -836,7 +836,7 @@ void GlobeGame::receiveNotification(Notification *notification, const Notificati
}
break;
case 7:
- if (!((PegasusEngine *)g_engine)->isDVD()) {
+ if (!g_vm->isDVD()) {
_owner->requestSpotSound(kGiveUpHumanIn, kGiveUpHumanOut, kFilterNoInput,
kSpotSoundCompletedFlag);
} else {
@@ -845,7 +845,7 @@ void GlobeGame::receiveNotification(Notification *notification, const Notificati
_robotMovie.releaseMovie();
_robotMovie.initFromMovieFile("Images/Norad Delta/N79 Back Monitor4");
- _robotMovie.setVolume(((PegasusEngine *)g_engine)->getSoundFXLevel());
+ _robotMovie.setVolume(g_vm->getSoundFXLevel());
_robotMovie.moveElementTo(kNavAreaLeft, kNavAreaTop);
_robotMovie.startDisplaying();
_robotMovie.show();
@@ -855,7 +855,7 @@ void GlobeGame::receiveNotification(Notification *notification, const Notificati
}
break;
case 9:
- if (!((PegasusEngine *)g_engine)->isDVD()) {
+ if (!g_vm->isDVD()) {
_owner->requestSpotSound(kYouAreRunningIn, kYouAreRunningOut,
kFilterNoInput, kSpotSoundCompletedFlag);
} else {
@@ -864,7 +864,7 @@ void GlobeGame::receiveNotification(Notification *notification, const Notificati
_robotMovie.releaseMovie();
_robotMovie.initFromMovieFile("Images/Norad Delta/N79 Back Monitor5");
- _robotMovie.setVolume(((PegasusEngine *)g_engine)->getSoundFXLevel());
+ _robotMovie.setVolume(g_vm->getSoundFXLevel());
_robotMovie.moveElementTo(kNavAreaLeft, kNavAreaTop);
_robotMovie.startDisplaying();
_robotMovie.show();
@@ -911,7 +911,7 @@ void GlobeGame::receiveNotification(Notification *notification, const Notificati
_monitorMovie.setSegment(kSplash1End * scale, kSplash2End * scale);
_monitorMovie.setFlags(kLoopTimeBase);
_monitorMovie.start();
- if (!((PegasusEngine *)g_engine)->isDVD()) {
+ if (!g_vm->isDVD()) {
_owner->getExtraEntry(kN79BrightView, entry);
_owner->showViewFrame(entry.movieStart);
_owner->requestSpotSound(kIJustBrokeIn, kIJustBrokeOut, kFilterNoInput, 0);
@@ -920,7 +920,7 @@ void GlobeGame::receiveNotification(Notification *notification, const Notificati
}
break;
case kGlobeRobot1Finished:
- if (((PegasusEngine *)g_engine)->isDVD()) {
+ if (g_vm->isDVD()) {
_owner->getExtraEntry(kN79BrightView, entry);
_monitorMovie.stop();
_monitorMovie.setSegment(0, _monitorMovie.getDuration());
@@ -951,7 +951,7 @@ void GlobeGame::receiveNotification(Notification *notification, const Notificati
_monitorMovie.setSegment(0, _monitorMovie.getDuration());
if (g_arthurChip)
g_arthurChip->playArthurMovieForEvent("Images/AI/Globals/XGLOBA02", kArthurNoradFinishedGlobeGame);
- if (!((PegasusEngine *)g_engine)->isDVD()) {
+ if (!g_vm->isDVD()) {
_owner->requestDelay(1, 2, kFilterNoInput, 0);
_owner->requestSpotSound(kTheOnlyGoodHumanIn, kTheOnlyGoodHumanOut, kFilterNoInput, 0);
_owner->requestDelay(1, 2, kFilterNoInput, kDelayCompletedFlag);
@@ -961,7 +961,7 @@ void GlobeGame::receiveNotification(Notification *notification, const Notificati
_robotMovie.releaseMovie();
_robotMovie.initFromMovieFile("Images/Norad Delta/N79 Back Monitor6");
- _robotMovie.setVolume(((PegasusEngine *)g_engine)->getSoundFXLevel());
+ _robotMovie.setVolume(g_vm->getSoundFXLevel());
_robotMovie.moveElementTo(kNavAreaLeft, kNavAreaTop);
_robotMovie.setDisplayOrder(kGlobeCountdownLayer + 1);
_robotMovie.startDisplaying();
@@ -985,7 +985,7 @@ void GlobeGame::handleInput(const Input &input, const Hotspot *cursorSpot) {
input.getInputLocation(where);
Hotspot *spot = g_allHotspots.findHotspot(where);
- if (((PegasusEngine *)g_engine)->_cursor->isVisible() && spot != nullptr &&
+ if (g_vm->_cursor->isVisible() && spot != nullptr &&
spot->getObjectID() == kNorad79SiloAreaSpotID && findClickedSilo(input) != -1) {
_targetHighlightUpperLeft.show();
_targetHighlightUpperRight.show();
@@ -1036,33 +1036,33 @@ void GlobeGame::clickGlobe(const Input &input) {
Movie movie(kNoDisplayElement);
Input movieInput;
- if (((PegasusEngine *)g_engine)->isDVD() && JMPPPInput::isEasterEggModifierInput(input)) {
- ((PegasusEngine *)g_engine)->_cursor->hide();
+ if (g_vm->isDVD() && JMPPPInput::isEasterEggModifierInput(input)) {
+ g_vm->_cursor->hide();
movie.initFromMovieFile("Images/Norad Delta/N79 Back Monitor7");
- movie.setVolume(((PegasusEngine *)g_engine)->getSoundFXLevel());
+ movie.setVolume(g_vm->getSoundFXLevel());
movie.moveElementTo(kNavAreaLeft, kNavAreaTop);
movie.setDisplayOrder(kGlobeCountdownLayer + 1);
movie.startDisplaying();
movie.show();
movie.start();
- while (movie.isRunning() && !((PegasusEngine *)g_engine)->shouldQuit()) {
+ while (movie.isRunning() && !g_vm->shouldQuit()) {
InputDevice.getInput(movieInput, kFilterNoInput);
- ((PegasusEngine *)g_engine)->checkCallBacks();
- ((PegasusEngine *)g_engine)->refreshDisplay();
- ((PegasusEngine *)g_engine)->_system->delayMillis(10);
+ g_vm->checkCallBacks();
+ g_vm->refreshDisplay();
+ g_vm->_system->delayMillis(10);
}
- if (((PegasusEngine *)g_engine)->shouldQuit())
+ if (g_vm->shouldQuit())
return;
movie.hide();
movie.stopDisplaying();
movie.releaseMovie();
- ((PegasusEngine *)g_engine)->_cursor->hideUntilMoved();
+ g_vm->_cursor->hideUntilMoved();
} else {
int16 newSilo = findClickedSilo(input);
if (newSilo != -1) {
diff --git a/engines/pegasus/neighborhood/norad/norad.cpp b/engines/pegasus/neighborhood/norad/norad.cpp
index 25759c7604b..c042eb76ba4 100644
--- a/engines/pegasus/neighborhood/norad/norad.cpp
+++ b/engines/pegasus/neighborhood/norad/norad.cpp
@@ -267,7 +267,7 @@ void Norad::checkAirMask() {
void Norad::receiveNotification(Notification *notification, const NotificationFlags flags) {
if (notification == &_neighborhoodNotification && (flags & kAirTimerExpiredFlag) != 0)
- ((PegasusEngine *)g_engine)->die(kDeathGassedInNorad);
+ g_vm->die(kDeathGassedInNorad);
Neighborhood::receiveNotification(notification, flags);
diff --git a/engines/pegasus/neighborhood/norad/noradelevator.cpp b/engines/pegasus/neighborhood/norad/noradelevator.cpp
index 02922a43fc6..a248621a423 100644
--- a/engines/pegasus/neighborhood/norad/noradelevator.cpp
+++ b/engines/pegasus/neighborhood/norad/noradelevator.cpp
@@ -38,7 +38,7 @@ static const ResIDType kElevatorUpOnID = 203;
NoradElevator::NoradElevator(Neighborhood *handler, const RoomID upRoom, const RoomID downRoom,
const HotSpotID upHotspot, const HotSpotID downHotspot) : GameInteraction(kNoradElevatorInteractionID, handler),
- _elevatorControls(kNoradElevatorControlsID), _elevatorNotification(kNoradElevatorNotificationID, ((PegasusEngine *)g_engine)) {
+ _elevatorControls(kNoradElevatorControlsID), _elevatorNotification(kNoradElevatorNotificationID, g_vm) {
_timerExpired = false;
_upRoom = upRoom;
_downRoom = downRoom;
@@ -48,19 +48,19 @@ NoradElevator::NoradElevator(Neighborhood *handler, const RoomID upRoom, const R
void NoradElevator::openInteraction() {
SpriteFrame *frame = new SpriteFrame();
- frame->initFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kElevatorLabelID, true);
+ frame->initFromPICTResource(g_vm->_resFork, kElevatorLabelID, true);
_elevatorControls.addFrame(frame, 0, 0);
frame = new SpriteFrame();
- frame->initFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kElevatorButtonsID, true);
+ frame->initFromPICTResource(g_vm->_resFork, kElevatorButtonsID, true);
_elevatorControls.addFrame(frame, 0, 0);
frame = new SpriteFrame();
- frame->initFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kElevatorDownOnID, true);
+ frame->initFromPICTResource(g_vm->_resFork, kElevatorDownOnID, true);
_elevatorControls.addFrame(frame, 0, 0);
frame = new SpriteFrame();
- frame->initFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kElevatorUpOnID, true);
+ frame->initFromPICTResource(g_vm->_resFork, kElevatorUpOnID, true);
_elevatorControls.addFrame(frame, 0, 0);
_elevatorControls.setCurrentFrameIndex(0);
diff --git a/engines/pegasus/neighborhood/norad/pressuredoor.cpp b/engines/pegasus/neighborhood/norad/pressuredoor.cpp
index 952d90115da..362070de0e0 100644
--- a/engines/pegasus/neighborhood/norad/pressuredoor.cpp
+++ b/engines/pegasus/neighborhood/norad/pressuredoor.cpp
@@ -107,8 +107,8 @@ PressureDoor::PressureDoor(Neighborhood *handler, bool isUpperDoor, const HotSpo
const HotSpotID outSpotID, TimeValue pressureSoundIn, TimeValue pressureSoundOut, TimeValue equalizeSoundIn,
TimeValue equalizeSoundOut) : GameInteraction(kNoradPressureDoorInteractionID, handler),
_levelsMovie(kPressureDoorLevelsID), _typeMovie(kPressureDoorTypeID), _upButton(kPressureDoorUpButtonID),
- _downButton(kPressureDoorDownButtonID), _pressureNotification(kNoradPressureNotificationID, ((PegasusEngine *)g_engine)),
- _doorTracker(this), _utilityNotification(kNoradUtilityNotificationID, ((PegasusEngine *)g_engine)) {
+ _downButton(kPressureDoorDownButtonID), _pressureNotification(kNoradPressureNotificationID, g_vm),
+ _doorTracker(this), _utilityNotification(kNoradUtilityNotificationID, g_vm) {
_neighborhoodNotification = handler->getNeighborhoodNotification();
_upHotspotID = upSpotID;
_downHotspotID = downSpotID;
@@ -161,16 +161,16 @@ void PressureDoor::openInteraction() {
SpriteFrame *frame = new SpriteFrame();
if (_isUpperDoor)
- frame->initFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kLowerPressureUpOffPICTID);
+ frame->initFromPICTResource(g_vm->_resFork, kLowerPressureUpOffPICTID);
else
- frame->initFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kUpperPressureUpOffPICTID);
+ frame->initFromPICTResource(g_vm->_resFork, kUpperPressureUpOffPICTID);
_upButton.addFrame(frame, 0, 0);
frame = new SpriteFrame();
if (_isUpperDoor)
- frame->initFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kLowerPressureUpOnPICTID);
+ frame->initFromPICTResource(g_vm->_resFork, kLowerPressureUpOnPICTID);
else
- frame->initFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kUpperPressureUpOnPICTID);
+ frame->initFromPICTResource(g_vm->_resFork, kUpperPressureUpOnPICTID);
_upButton.addFrame(frame, 0, 0);
_upButton.setCurrentFrameIndex(0);
@@ -189,16 +189,16 @@ void PressureDoor::openInteraction() {
frame = new SpriteFrame();
if (_isUpperDoor)
- frame->initFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kLowerPressureDownOffPICTID);
+ frame->initFromPICTResource(g_vm->_resFork, kLowerPressureDownOffPICTID);
else
- frame->initFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kUpperPressureDownOffPICTID);
+ frame->initFromPICTResource(g_vm->_resFork, kUpperPressureDownOffPICTID);
_downButton.addFrame(frame, 0, 0);
frame = new SpriteFrame();
if (_isUpperDoor)
- frame->initFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kLowerPressureDownOnPICTID);
+ frame->initFromPICTResource(g_vm->_resFork, kLowerPressureDownOnPICTID);
else
- frame->initFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kUpperPressureDownOnPICTID);
+ frame->initFromPICTResource(g_vm->_resFork, kUpperPressureDownOnPICTID);
_downButton.addFrame(frame, 0, 0);
_downButton.setCurrentFrameIndex(0);
@@ -316,7 +316,7 @@ void PressureDoor::receiveNotification(Notification *notification, const Notific
break;
case kRobotComingThrough:
g_system->delayMillis(2 * 1000);
- ((PegasusEngine *)g_engine)->die(kDeathRobotThroughNoradDoor);
+ g_vm->die(kDeathRobotThroughNoradDoor);
break;
case kRobotDying:
_robotState = kRobotDead;
diff --git a/engines/pegasus/neighborhood/norad/subcontrolroom.cpp b/engines/pegasus/neighborhood/norad/subcontrolroom.cpp
index 148c9827611..eccff25e006 100644
--- a/engines/pegasus/neighborhood/norad/subcontrolroom.cpp
+++ b/engines/pegasus/neighborhood/norad/subcontrolroom.cpp
@@ -423,11 +423,11 @@ static const ResIDType kClawMonitorGreenBallBaseID = 600;
// Constructor
SubControlRoom::SubControlRoom(Neighborhood *handler) : GameInteraction(kNoradSubControlRoomInteractionID, handler),
- _subControlMovie(kSubControlMonitorID), _subControlNotification(kSubControlNotificationID, (PegasusEngine *)g_engine),
+ _subControlMovie(kSubControlMonitorID), _subControlNotification(kSubControlNotificationID, g_vm),
_clawMonitorMovie(kClawMonitorID), _pinchButton(kSubControlPinchID), _downButton(kSubControlDownID),
_rightButton(kSubControlRightID), _leftButton(kSubControlLeftID), _upButton(kSubControlUpID),
_ccwButton(kSubControlCCWID), _cwButton(kSubControlCWID), _greenBall(kClawMonitorGreenBallID),
- _greenBallNotification(kNoradGreenBallNotificationID, (PegasusEngine *)g_engine) {
+ _greenBallNotification(kNoradGreenBallNotificationID, g_vm) {
_neighborhoodNotification = handler->getNeighborhoodNotification();
_playingAgainstRobot = false;
_robotState = kNoRobot;
@@ -450,7 +450,7 @@ void SubControlRoom::openInteraction() {
_clawPosition = _clawStartPosition;
_clawNextPosition = _clawPosition;
_subControlMovie.initFromMovieFile("Images/Norad Alpha/N22 Left Monitor Movie");
- _subControlMovie.setVolume(((PegasusEngine *)g_engine)->getSoundFXLevel());
+ _subControlMovie.setVolume(g_vm->getSoundFXLevel());
_subControlMovie.moveElementTo(kNoradSubControlLeft, kNoradSubControlTop);
_subControlScale = _subControlMovie.getScale();
_subControlMovie.setDisplayOrder(kSubControlOrder);
@@ -487,15 +487,15 @@ void SubControlRoom::openInteraction() {
for (int i = 0; i < kNumClawButtons; i++) {
SpriteFrame *frame = new SpriteFrame();
- frame->initFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kSubControlButtonBaseID + i * 3, true);
+ frame->initFromPICTResource(g_vm->_resFork, kSubControlButtonBaseID + i * 3, true);
_buttons[i]->addFrame(frame, 0, 0);
frame = new SpriteFrame();
- frame->initFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kSubControlButtonBaseID + i * 3 + 1, true);
+ frame->initFromPICTResource(g_vm->_resFork, kSubControlButtonBaseID + i * 3 + 1, true);
_buttons[i]->addFrame(frame, 0, 0);
frame = new SpriteFrame();
- frame->initFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kSubControlButtonBaseID + i * 3 + 2, true);
+ frame->initFromPICTResource(g_vm->_resFork, kSubControlButtonBaseID + i * 3 + 2, true);
_buttons[i]->addFrame(frame, 0, 0);
_buttons[i]->setCurrentFrameIndex(0);
@@ -514,7 +514,7 @@ void SubControlRoom::openInteraction() {
for (int i = 0; i < kNumClawGreenBalls; i++) {
SpriteFrame *frame = new SpriteFrame();
- frame->initFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kClawMonitorGreenBallBaseID + i);
+ frame->initFromPICTResource(g_vm->_resFork, kClawMonitorGreenBallBaseID + i);
_greenBall.addFrame(frame, 0, 0);
}
@@ -671,7 +671,7 @@ void SubControlRoom::receiveNotification(Notification *notification, const Notif
break;
case kRobotWon:
g_system->delayMillis(2 * 1000); // 120 ticks
- ((PegasusEngine *)g_engine)->die(kDeathRobotSubControlRoom);
+ g_vm->die(kDeathRobotSubControlRoom);
break;
default:
break;
diff --git a/engines/pegasus/neighborhood/norad/subplatform.cpp b/engines/pegasus/neighborhood/norad/subplatform.cpp
index 27fa9856227..0ed9e14baa7 100644
--- a/engines/pegasus/neighborhood/norad/subplatform.cpp
+++ b/engines/pegasus/neighborhood/norad/subplatform.cpp
@@ -61,7 +61,7 @@ static const uint16 kSubPreppedBit = (1 << 0);
static const uint16 kWaitingForPlayerBit = (1 << 1);
SubPlatform::SubPlatform(Neighborhood *handler) : GameInteraction(kNoradSubPlatformInteractionID, handler),
- _platformMovie(kPlatformMonitorID), _platformNotification(kNoradSubPlatformNotificationID, (PegasusEngine *)g_engine) {
+ _platformMovie(kPlatformMonitorID), _platformNotification(kNoradSubPlatformNotificationID, g_vm) {
_neighborhoodNotification = handler->getNeighborhoodNotification();
}
@@ -74,7 +74,7 @@ void SubPlatform::openInteraction() {
_stateBits |= kWaitingForPlayerBit;
_platformMovie.initFromMovieFile("Images/Norad Alpha/Platform Monitor Movie");
- _platformMovie.setVolume(((PegasusEngine *)g_engine)->getSoundFXLevel());
+ _platformMovie.setVolume(g_vm->getSoundFXLevel());
_platformMovie.moveElementTo(kNoradPlatformLeft, kNoradPlatformTop);
_platformScale = _platformMovie.getScale();
_platformMovie.setDisplayOrder(kPlatformOrder);
@@ -167,9 +167,9 @@ void SubPlatform::receiveNotification(Notification *notification, const Notifica
default:
break;
}
- } else if (notification == _neighborhoodNotification && !((PegasusEngine *)g_engine)->isDVD()) {
+ } else if (notification == _neighborhoodNotification && !g_vm->isDVD()) {
allowInput(true);
- ((PegasusEngine *)g_engine)->jumpToNewEnvironment(kNoradSubChaseID, kNoRoomID, kNoDirection);
+ g_vm->jumpToNewEnvironment(kNoradSubChaseID, kNoRoomID, kNoDirection);
GameState.setScoringEnteredSub(true);
}
}
diff --git a/engines/pegasus/neighborhood/prehistoric/prehistoric.cpp b/engines/pegasus/neighborhood/prehistoric/prehistoric.cpp
index 2e6472bfaf1..dc0e9f37e68 100644
--- a/engines/pegasus/neighborhood/prehistoric/prehistoric.cpp
+++ b/engines/pegasus/neighborhood/prehistoric/prehistoric.cpp
@@ -115,7 +115,7 @@ public:
void FinishPrehistoricAction::performAIAction(AIRule *rule) {
AIPlayMessageAction::performAIAction(rule);
- ((PegasusEngine *)g_engine)->die(kPlayerWonGame);
+ g_vm->die(kPlayerWonGame);
}
void Prehistoric::setUpAIRules() {
diff --git a/engines/pegasus/neighborhood/tsa/fulltsa.cpp b/engines/pegasus/neighborhood/tsa/fulltsa.cpp
index dd4a569e6b3..2ebd9f2ff7f 100644
--- a/engines/pegasus/neighborhood/tsa/fulltsa.cpp
+++ b/engines/pegasus/neighborhood/tsa/fulltsa.cpp
@@ -619,7 +619,7 @@ enum {
void RipTimer::initImage() {
_middle = -1;
- _timerImage.getImageFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kLeftRipPICTID);
+ _timerImage.getImageFromPICTResource(g_vm->_resFork, kLeftRipPICTID);
Common::Rect r;
_timerImage.getSurfaceBounds(r);
@@ -664,7 +664,7 @@ void RipTimer::timeChanged(const TimeValue newTime) {
}
if (newTime == getStop())
- ((PegasusEngine *)g_engine)->die(kDeathUncreatedInTSA);
+ g_vm->die(kDeathUncreatedInTSA);
}
FullTSA::FullTSA(InputHandler *nextHandler, PegasusEngine *owner) : Neighborhood(nextHandler, owner, "Full TSA", kFullTSAID),
diff --git a/engines/pegasus/neighborhood/wsc/moleculebin.cpp b/engines/pegasus/neighborhood/wsc/moleculebin.cpp
index 2e5d6b4ef0d..9ad0211c2f7 100644
--- a/engines/pegasus/neighborhood/wsc/moleculebin.cpp
+++ b/engines/pegasus/neighborhood/wsc/moleculebin.cpp
@@ -115,7 +115,7 @@ void MoleculeBin::draw(const Common::Rect &) {
r2.moveTo((_selectedMolecule & 1) * (kMoleculeWidth + 2) + _bounds.left + 2,
(_selectedMolecule >> 1) * (kMoleculeHeight + 2) + _bounds.top + 2);
- Graphics::Surface *screen = ((PegasusEngine *)g_engine)->_gfx->getWorkArea();
+ Graphics::Surface *screen = g_vm->_gfx->getWorkArea();
screen->frameRect(r2, _highlightColor);
r2.grow(1);
diff --git a/engines/pegasus/neighborhood/wsc/wsc.cpp b/engines/pegasus/neighborhood/wsc/wsc.cpp
index 152c22f30db..ebe239806e0 100644
--- a/engines/pegasus/neighborhood/wsc/wsc.cpp
+++ b/engines/pegasus/neighborhood/wsc/wsc.cpp
@@ -569,8 +569,8 @@ protected:
};
void PryDoorMessage::performAIAction(AIRule *rule) {
- if (((PegasusEngine *)g_engine)->playerHasItemID(kShieldBiochip)
- && ((PegasusEngine *)g_engine)->getCurrentBiochip()->getObjectID() != kShieldBiochip)
+ if (g_vm->playerHasItemID(kShieldBiochip)
+ && g_vm->getCurrentBiochip()->getObjectID() != kShieldBiochip)
AIPlayMessageAction::performAIAction(rule);
}
diff --git a/engines/pegasus/pegasus.cpp b/engines/pegasus/pegasus.cpp
index 6998e6a88ab..e33436590ad 100644
--- a/engines/pegasus/pegasus.cpp
+++ b/engines/pegasus/pegasus.cpp
@@ -78,6 +78,8 @@
namespace Pegasus {
+PegasusEngine *g_vm;
+
PegasusEngine::PegasusEngine(OSystem *syst, const PegasusGameDescription *gamedesc) : Engine(syst), InputHandler(nullptr), _gameDescription(gamedesc),
_shellNotification(kJMPDCShellNotificationID, this), _returnHotspot(kInfoReturnSpotID), _itemDragger(this), _bigInfoMovie(kNoDisplayElement),
_smallInfoMovie(kNoDisplayElement) {
@@ -101,6 +103,8 @@ PegasusEngine::PegasusEngine(OSystem *syst, const PegasusGameDescription *gamede
_chattyArthur = true;
_aiSaveStream = nullptr;
_heardOverviewVoice = false;
+
+ g_vm = this;
}
PegasusEngine::~PegasusEngine() {
diff --git a/engines/pegasus/pegasus.h b/engines/pegasus/pegasus.h
index 54405dd6eb2..848c79358b8 100644
--- a/engines/pegasus/pegasus.h
+++ b/engines/pegasus/pegasus.h
@@ -344,6 +344,8 @@ private:
Movie _bigInfoMovie, _smallInfoMovie;
};
+extern PegasusEngine *g_vm;
+
} // End of namespace Pegasus
#endif
diff --git a/engines/pegasus/surface.cpp b/engines/pegasus/surface.cpp
index 28a070dbc67..f11f6072085 100644
--- a/engines/pegasus/surface.cpp
+++ b/engines/pegasus/surface.cpp
@@ -144,7 +144,7 @@ void Surface::copyToCurrentPortTransparent(const Common::Rect &rect) const {
}
void Surface::copyToCurrentPort(const Common::Rect &srcRect, const Common::Rect &dstRect) const {
- Graphics::Surface *screen = ((PegasusEngine *)g_engine)->_gfx->getCurSurface();
+ Graphics::Surface *screen = g_vm->_gfx->getCurSurface();
byte *src = (byte *)_surface->getBasePtr(srcRect.left, srcRect.top);
byte *dst = (byte *)screen->getBasePtr(dstRect.left, dstRect.top);
@@ -158,7 +158,7 @@ void Surface::copyToCurrentPort(const Common::Rect &srcRect, const Common::Rect
}
void Surface::copyToCurrentPortTransparent(const Common::Rect &srcRect, const Common::Rect &dstRect) const {
- Graphics::Surface *screen = ((PegasusEngine *)g_engine)->_gfx->getCurSurface();
+ Graphics::Surface *screen = g_vm->_gfx->getCurSurface();
byte *src = (byte *)_surface->getBasePtr(srcRect.left, srcRect.top);
byte *dst = (byte *)screen->getBasePtr(dstRect.left, dstRect.top);
@@ -186,7 +186,7 @@ void Surface::copyToCurrentPortTransparent(const Common::Rect &srcRect, const Co
}
void Surface::copyToCurrentPortMasked(const Common::Rect &srcRect, const Common::Rect &dstRect, const Surface *mask) const {
- Graphics::Surface *screen = ((PegasusEngine *)g_engine)->_gfx->getCurSurface();
+ Graphics::Surface *screen = g_vm->_gfx->getCurSurface();
byte *src = (byte *)_surface->getBasePtr(srcRect.left, srcRect.top);
byte *dst = (byte *)screen->getBasePtr(dstRect.left, dstRect.top);
@@ -220,7 +220,7 @@ void Surface::copyToCurrentPortTransparentGlow(const Common::Rect &srcRect, cons
// This is the same as copyToCurrentPortTransparent(), but turns the red value of each
// pixel all the way up.
- Graphics::Surface *screen = ((PegasusEngine *)g_engine)->_gfx->getCurSurface();
+ Graphics::Surface *screen = g_vm->_gfx->getCurSurface();
byte *src = (byte *)_surface->getBasePtr(srcRect.left, srcRect.top);
byte *dst = (byte *)screen->getBasePtr(dstRect.left, dstRect.top);
@@ -251,7 +251,7 @@ void Surface::scaleTransparentCopy(const Common::Rect &srcRect, const Common::Re
// I'm doing simple linear scaling here
// dstRect(x, y) = srcRect(x * srcW / dstW, y * srcH / dstH);
- Graphics::Surface *screen = ((PegasusEngine *)g_engine)->_gfx->getCurSurface();
+ Graphics::Surface *screen = g_vm->_gfx->getCurSurface();
int srcW = srcRect.width();
int srcH = srcRect.height();
@@ -281,7 +281,7 @@ void Surface::scaleTransparentCopyGlow(const Common::Rect &srcRect, const Common
// This is the same as scaleTransparentCopy(), but turns the red value of each
// pixel all the way up.
- Graphics::Surface *screen = ((PegasusEngine *)g_engine)->_gfx->getCurSurface();
+ Graphics::Surface *screen = g_vm->_gfx->getCurSurface();
int srcW = srcRect.width();
int srcH = srcRect.height();
diff --git a/engines/pegasus/timers.cpp b/engines/pegasus/timers.cpp
index 8dc61935372..9e393f6dddf 100644
--- a/engines/pegasus/timers.cpp
+++ b/engines/pegasus/timers.cpp
@@ -40,14 +40,14 @@ Idler::~Idler() {
void Idler::startIdling() {
if (!isIdling()) {
- ((PegasusEngine *)g_engine)->addIdler(this);
+ g_vm->addIdler(this);
_isIdling = true;
}
}
void Idler::stopIdling() {
if (isIdling()) {
- ((PegasusEngine *)g_engine)->removeIdler(this);
+ g_vm->removeIdler(this);
_isIdling = false;
}
}
@@ -68,11 +68,11 @@ TimeBase::TimeBase(const TimeScale preferredScale) {
_pausedRate = 0;
_pauseStart = 0;
- ((PegasusEngine *)g_engine)->addTimeBase(this);
+ g_vm->addTimeBase(this);
}
TimeBase::~TimeBase() {
- ((PegasusEngine *)g_engine)->removeTimeBase(this);
+ g_vm->removeTimeBase(this);
disposeAllCallBacks();
}
@@ -370,7 +370,7 @@ void NotificationCallBack::callBack() {
static const NotificationFlags kFuseExpiredFlag = 1;
-Fuse::Fuse() : _fuseNotification(0, (NotificationManager *)((PegasusEngine *)g_engine)) {
+Fuse::Fuse() : _fuseNotification(0, (NotificationManager *)g_vm) {
_fuseNotification.notifyMe(this, kFuseExpiredFlag, kFuseExpiredFlag);
_fuseCallBack.setNotification(&_fuseNotification);
_fuseCallBack.initCallBack(&_fuseTimer, kCallBackAtExtremes);
Commit: c585e07c3c1c5dba706b67f39782599719ed0889
https://github.com/scummvm/scummvm/commit/c585e07c3c1c5dba706b67f39782599719ed0889
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2022-09-28T11:30:01+02:00
Commit Message:
PEGASUS: Remove redundant assignments
Changed paths:
engines/pegasus/cursor.cpp
engines/pegasus/energymonitor.cpp
engines/pegasus/hotspot.h
engines/pegasus/input.cpp
engines/pegasus/interface.cpp
engines/pegasus/items/biochips/aichip.cpp
engines/pegasus/items/biochips/arthurchip.cpp
engines/pegasus/items/biochips/biochipitem.cpp
engines/pegasus/items/biochips/pegasuschip.cpp
engines/pegasus/items/inventory/inventoryitem.cpp
engines/pegasus/items/inventorypicture.cpp
engines/pegasus/items/item.cpp
engines/pegasus/items/itemlist.h
engines/pegasus/menu.cpp
engines/pegasus/neighborhood/mars/mars.cpp
engines/pegasus/neighborhood/mars/spacejunk.cpp
diff --git a/engines/pegasus/cursor.cpp b/engines/pegasus/cursor.cpp
index 5e4d9a757d9..25bf2583757 100644
--- a/engines/pegasus/cursor.cpp
+++ b/engines/pegasus/cursor.cpp
@@ -54,8 +54,7 @@ Cursor::~Cursor() {
}
void Cursor::addCursorFrames(uint16 id) {
- PegasusEngine *vm = g_vm;
- Common::SeekableReadStream *cursStream = vm->_resFork->getResource(MKTAG('C', 'u', 'r', 's'), id);
+ Common::SeekableReadStream *cursStream = g_vm->_resFork->getResource(MKTAG('C', 'u', 'r', 's'), id);
if (!cursStream)
error("Could not load cursor frames set %d", id);
@@ -135,11 +134,9 @@ void Cursor::loadCursorImage(CursorInfo &cursorInfo) {
if (cursorInfo.surface)
return;
- PegasusEngine *vm = g_vm;
-
- if (vm->isDVD()) {
+ if (g_vm->isDVD()) {
// The DVD version has some higher color PICT images for its cursors
- Common::SeekableReadStream *pictStream = vm->_resFork->getResource(MKTAG('P', 'I', 'C', 'T'), cursorInfo.tag + 1000);
+ Common::SeekableReadStream *pictStream = g_vm->_resFork->getResource(MKTAG('P', 'I', 'C', 'T'), cursorInfo.tag + 1000);
if (pictStream) {
Image::PICTDecoder pict;
@@ -155,7 +152,7 @@ void Cursor::loadCursorImage(CursorInfo &cursorInfo) {
cursorInfo.surface = new Graphics::Surface();
// The CD version uses (only) lower color cicn images for its cursors
- Common::SeekableReadStream *cicnStream = vm->_resFork->getResource(MKTAG('c', 'i', 'c', 'n'), cursorInfo.tag);
+ Common::SeekableReadStream *cicnStream = g_vm->_resFork->getResource(MKTAG('c', 'i', 'c', 'n'), cursorInfo.tag);
if (!cicnStream)
error("Failed to find color icon %d", cursorInfo.tag);
diff --git a/engines/pegasus/energymonitor.cpp b/engines/pegasus/energymonitor.cpp
index 00383afa6f5..59c597f6b45 100644
--- a/engines/pegasus/energymonitor.cpp
+++ b/engines/pegasus/energymonitor.cpp
@@ -74,8 +74,6 @@ enum {
EnergyMonitor *g_energyMonitor = nullptr;
EnergyMonitor::EnergyMonitor() : IdlerAnimation(kEnergyBarID), _energyLight(kWarningLightID) {
- PegasusEngine *vm = g_vm;
-
_stage = kStageNoStage;
_calibrating = false;
@@ -87,19 +85,19 @@ EnergyMonitor::EnergyMonitor() : IdlerAnimation(kEnergyBarID), _energyLight(kWar
startDisplaying();
SpriteFrame *frame = new SpriteFrame();
- frame->initFromPICTResource(vm->_resFork, kLightOffID);
+ frame->initFromPICTResource(g_vm->_resFork, kLightOffID);
_energyLight.addFrame(frame, 0, 0);
frame = new SpriteFrame();
- frame->initFromPICTResource(vm->_resFork, kLightYellowID);
+ frame->initFromPICTResource(g_vm->_resFork, kLightYellowID);
_energyLight.addFrame(frame, 0, 0);
frame = new SpriteFrame();
- frame->initFromPICTResource(vm->_resFork, kLightOrangeID);
+ frame->initFromPICTResource(g_vm->_resFork, kLightOrangeID);
_energyLight.addFrame(frame, 0, 0);
frame = new SpriteFrame();
- frame->initFromPICTResource(vm->_resFork, kLightRedID);
+ frame->initFromPICTResource(g_vm->_resFork, kLightRedID);
_energyLight.addFrame(frame, 0, 0);
_energyLight.setBounds(540, 35, 600, 59);
@@ -162,9 +160,8 @@ int32 EnergyMonitor::getCurrentEnergy() {
void EnergyMonitor::timeChanged(const TimeValue currentTime) {
if (currentTime == getStop()) {
- PegasusEngine *vm = g_vm;
- if (vm->getEnergyDeathReason() != -1)
- vm->die(vm->getEnergyDeathReason());
+ if (g_vm->getEnergyDeathReason() != -1)
+ g_vm->die(g_vm->getEnergyDeathReason());
} else {
uint32 currentEnergy = kMaxJMPEnergy - currentTime;
@@ -245,19 +242,17 @@ void EnergyMonitor::draw(const Common::Rect &r) {
}
void EnergyMonitor::calibrateEnergyBar() {
- PegasusEngine *vm = g_vm;
-
_calibrating = true;
- vm->setEnergyDeathReason(-1);
+ g_vm->setEnergyDeathReason(-1);
uint32 numFrames = _energyLight.getNumFrames();
for (uint32 i = 1; i < numFrames; i++) {
_energyLight.setCurrentFrameIndex(i);
_energyLight.show();
- vm->delayShell(1, 3);
+ g_vm->delayShell(1, 3);
_energyLight.hide();
- vm->delayShell(1, 3);
+ g_vm->delayShell(1, 3);
}
_energyLight.setCurrentFrameIndex(0);
@@ -271,12 +266,12 @@ void EnergyMonitor::calibrateEnergyBar() {
_energyLight.hide();
while (getCurrentEnergy() != (int32)kMaxJMPEnergy) {
InputDevice.pumpEvents();
- vm->checkCallBacks();
- vm->refreshDisplay();
+ g_vm->checkCallBacks();
+ g_vm->refreshDisplay();
g_system->delayMillis(10);
}
- vm->refreshDisplay();
+ g_vm->refreshDisplay();
setEnergyDrainRate(0);
hide();
@@ -284,11 +279,9 @@ void EnergyMonitor::calibrateEnergyBar() {
}
void EnergyMonitor::restoreLastEnergyValue() {
- PegasusEngine *vm = g_vm;
-
_dontFlash = true;
- setEnergyValue(vm->getSavedEnergyValue());
- vm->resetEnergyDeathReason();
+ setEnergyValue(g_vm->getSavedEnergyValue());
+ g_vm->resetEnergyDeathReason();
}
void EnergyMonitor::saveCurrentEnergyValue() {
diff --git a/engines/pegasus/hotspot.h b/engines/pegasus/hotspot.h
index 95515d33320..ad470a01f56 100644
--- a/engines/pegasus/hotspot.h
+++ b/engines/pegasus/hotspot.h
@@ -144,7 +144,7 @@ public:
typedef HotspotList::iterator HotspotIterator;
-#define g_allHotspots (((PegasusEngine *)g_engine)->getAllHotspots())
+#define g_allHotspots g_vm->getAllHotspots()
} // End of namespace Pegasus
diff --git a/engines/pegasus/input.cpp b/engines/pegasus/input.cpp
index b22cf96db72..8817d53425e 100644
--- a/engines/pegasus/input.cpp
+++ b/engines/pegasus/input.cpp
@@ -180,18 +180,16 @@ bool InputDeviceManager::notifyEvent(const Common::Event &event) {
}
void InputDeviceManager::pumpEvents() {
- PegasusEngine *vm = g_vm;
-
- bool saveAllowed = vm->swapSaveAllowed(false);
- bool openAllowed = vm->swapLoadAllowed(false);
+ bool saveAllowed = g_vm->swapSaveAllowed(false);
+ bool openAllowed = g_vm->swapLoadAllowed(false);
// Just poll for events. notifyEvent() will pick up on them.
Common::Event event;
while (g_system->getEventManager()->pollEvent(event))
;
- vm->swapSaveAllowed(saveAllowed);
- vm->swapLoadAllowed(openAllowed);
+ g_vm->swapSaveAllowed(saveAllowed);
+ g_vm->swapLoadAllowed(openAllowed);
}
int operator==(const Input &arg1, const Input &arg2) {
diff --git a/engines/pegasus/interface.cpp b/engines/pegasus/interface.cpp
index 625643f961b..edc8a0833e5 100644
--- a/engines/pegasus/interface.cpp
+++ b/engines/pegasus/interface.cpp
@@ -597,14 +597,12 @@ void Interface::calibrateCompass() {
g_compass->startFader(compassMove);
- PegasusEngine *vm = g_vm;
-
while (g_compass->isFading()) {
- vm->refreshDisplay();
+ g_vm->refreshDisplay();
g_system->delayMillis(10);
}
- vm->refreshDisplay();
+ g_vm->refreshDisplay();
g_compass->setFaderValue(currentValue);
}
@@ -613,106 +611,98 @@ void Interface::calibrateEnergyBar() {
}
void Interface::raiseInventoryDrawerSync() {
- PegasusEngine *vm = g_vm;
-
raiseInventoryDrawer(false);
while (_inventoryLid.isRunning()) {
InputDevice.pumpEvents();
- vm->checkCallBacks();
- vm->refreshDisplay();
+ g_vm->checkCallBacks();
+ g_vm->refreshDisplay();
g_system->delayMillis(10);
}
- vm->refreshDisplay();
+ g_vm->refreshDisplay();
inventoryLidOpen(false);
while (_inventoryPush.isFading()) {
InputDevice.pumpEvents();
- vm->checkCallBacks();
- vm->refreshDisplay();
+ g_vm->checkCallBacks();
+ g_vm->refreshDisplay();
g_system->delayMillis(10);
}
- vm->refreshDisplay();
+ g_vm->refreshDisplay();
inventoryDrawerUp();
}
void Interface::lowerInventoryDrawerSync() {
- PegasusEngine *vm = g_vm;
-
lowerInventoryDrawer(false);
while (_inventoryPush.isFading()) {
InputDevice.pumpEvents();
- vm->checkCallBacks();
- vm->refreshDisplay();
+ g_vm->checkCallBacks();
+ g_vm->refreshDisplay();
g_system->delayMillis(10);
}
- vm->refreshDisplay();
+ g_vm->refreshDisplay();
inventoryDrawerDown(false);
while (_inventoryLid.isRunning()) {
InputDevice.pumpEvents();
- vm->checkCallBacks();
- vm->refreshDisplay();
+ g_vm->checkCallBacks();
+ g_vm->refreshDisplay();
g_system->delayMillis(10);
}
- vm->refreshDisplay();
+ g_vm->refreshDisplay();
inventoryLidClosed();
}
void Interface::raiseBiochipDrawerSync() {
- PegasusEngine *vm = g_vm;
-
raiseBiochipDrawer(false);
while (_biochipLid.isRunning()) {
InputDevice.pumpEvents();
- vm->checkCallBacks();
- vm->refreshDisplay();
+ g_vm->checkCallBacks();
+ g_vm->refreshDisplay();
g_system->delayMillis(10);
}
- vm->refreshDisplay();
+ g_vm->refreshDisplay();
biochipLidOpen(false);
while (_biochipPush.isFading()) {
InputDevice.pumpEvents();
- vm->checkCallBacks();
- vm->refreshDisplay();
+ g_vm->checkCallBacks();
+ g_vm->refreshDisplay();
g_system->delayMillis(10);
}
- vm->refreshDisplay();
+ g_vm->refreshDisplay();
biochipDrawerUp();
}
void Interface::lowerBiochipDrawerSync() {
- PegasusEngine *vm = g_vm;
-
lowerBiochipDrawer(false);
while (_biochipPush.isFading()) {
InputDevice.pumpEvents();
- vm->checkCallBacks();
- vm->refreshDisplay();
+ g_vm->checkCallBacks();
+ g_vm->refreshDisplay();
g_system->delayMillis(10);
}
- vm->refreshDisplay();
+ g_vm->refreshDisplay();
biochipDrawerDown(false);
while (_biochipLid.isRunning()) {
InputDevice.pumpEvents();
- vm->checkCallBacks();
- vm->refreshDisplay();
+ g_vm->checkCallBacks();
+ g_vm->refreshDisplay();
g_system->delayMillis(10);
}
- vm->refreshDisplay();
+ g_vm->refreshDisplay();
biochipLidClosed();
}
diff --git a/engines/pegasus/items/biochips/aichip.cpp b/engines/pegasus/items/biochips/aichip.cpp
index 8c884e48893..d932d2f71d9 100644
--- a/engines/pegasus/items/biochips/aichip.cpp
+++ b/engines/pegasus/items/biochips/aichip.cpp
@@ -112,11 +112,9 @@ void AIChip::takeSharedArea() {
void AIChip::setUpAIChip() {
if (!_playingMovie) {
- PegasusEngine *vm = g_vm;
-
uint numSolves;
if (GameState.getWalkthroughMode()) {
- if (vm->canSolve())
+ if (g_vm->canSolve())
numSolves = 2;
else
numSolves = 1;
@@ -124,18 +122,16 @@ void AIChip::setUpAIChip() {
numSolves = 0;
}
- setItemState(s_highlightState[vm->getNumHints()][numSolves][0]);
+ setItemState(s_highlightState[g_vm->getNumHints()][numSolves][0]);
}
}
// Only does something when there are hints or solves available.
void AIChip::setUpAIChipRude() {
if (!_playingMovie) {
- PegasusEngine *vm = g_vm;
-
uint numSolves;
if (GameState.getWalkthroughMode()) {
- if (vm->canSolve())
+ if (g_vm->canSolve())
numSolves = 2;
else
numSolves = 1;
@@ -143,18 +139,17 @@ void AIChip::setUpAIChipRude() {
numSolves = 0;
}
- uint numHints = vm->getNumHints();
+ uint numHints = g_vm->getNumHints();
if (numSolves == 2 || numHints != 0)
setItemState(s_highlightState[numHints][numSolves][0]);
}
}
void AIChip::activateAIHotspots() {
- PegasusEngine *vm = g_vm;
_briefingSpot.setActive();
_scanSpot.setActive();
- switch (vm->getNumHints()) {
+ switch (g_vm->getNumHints()) {
case 3:
_hint3Spot.setActive();
// fall through
@@ -168,18 +163,16 @@ void AIChip::activateAIHotspots() {
break;
}
- if (GameState.getWalkthroughMode() && vm->canSolve())
+ if (GameState.getWalkthroughMode() && g_vm->canSolve())
_solveSpot.setActive();
}
void AIChip::showBriefingClicked() {
- PegasusEngine *vm = g_vm;
-
_playingMovie = true;
uint numSolves;
if (GameState.getWalkthroughMode()) {
- if (vm->canSolve())
+ if (g_vm->canSolve())
numSolves = 2;
else
numSolves = 1;
@@ -187,19 +180,17 @@ void AIChip::showBriefingClicked() {
numSolves = 0;
}
- ItemState newState = s_highlightState[vm->getNumHints()][numSolves][kAIBriefingSpotID - kAIHint1SpotID + 1];
+ ItemState newState = s_highlightState[g_vm->getNumHints()][numSolves][kAIBriefingSpotID - kAIHint1SpotID + 1];
if (newState != -1)
setItemState(newState);
}
void AIChip::showEnvScanClicked() {
- PegasusEngine *vm = g_vm;
-
_playingMovie = true;
uint numSolves;
if (GameState.getWalkthroughMode()) {
- if (vm->canSolve())
+ if (g_vm->canSolve())
numSolves = 2;
else
numSolves = 1;
@@ -207,7 +198,7 @@ void AIChip::showEnvScanClicked() {
numSolves = 0;
}
- ItemState newState = s_highlightState[vm->getNumHints()][numSolves][kAIScanSpotID - kAIHint1SpotID + 1];
+ ItemState newState = s_highlightState[g_vm->getNumHints()][numSolves][kAIScanSpotID - kAIHint1SpotID + 1];
if (newState != -1)
setItemState(newState);
@@ -219,25 +210,23 @@ void AIChip::clearClicked() {
}
void AIChip::clickInAIHotspot(HotSpotID id) {
- PegasusEngine *vm = g_vm;
-
Common::String movieName;
switch (id) {
case kAIBriefingSpotID:
- movieName = vm->getBriefingMovie();
+ movieName = g_vm->getBriefingMovie();
break;
case kAIScanSpotID:
- movieName = vm->getEnvScanMovie();
+ movieName = g_vm->getEnvScanMovie();
break;
case kAIHint1SpotID:
- movieName = vm->getHintMovie(1);
+ movieName = g_vm->getHintMovie(1);
break;
case kAIHint2SpotID:
- movieName = vm->getHintMovie(2);
+ movieName = g_vm->getHintMovie(2);
break;
case kAIHint3SpotID:
- movieName = vm->getHintMovie(3);
+ movieName = g_vm->getHintMovie(3);
break;
case kAISolveSpotID:
g_neighborhood->doSolve();
@@ -253,7 +242,7 @@ void AIChip::clickInAIHotspot(HotSpotID id) {
uint numSolves;
if (GameState.getWalkthroughMode()) {
- if (vm->canSolve())
+ if (g_vm->canSolve())
numSolves = 2;
else
numSolves = 1;
@@ -261,15 +250,15 @@ void AIChip::clickInAIHotspot(HotSpotID id) {
numSolves = 0;
}
- ItemState newState = s_highlightState[vm->getNumHints()][numSolves][id - kAIHint1SpotID + 1];
+ ItemState newState = s_highlightState[g_vm->getNumHints()][numSolves][id - kAIHint1SpotID + 1];
if (newState != -1)
setItemState(newState);
if (g_AIArea) {
- vm->prepareForAIHint(movieName);
+ g_vm->prepareForAIHint(movieName);
g_AIArea->playAIMovie(kRightAreaSignature, movieName, false, kHintInterruption);
- vm->cleanUpAfterAIHint(movieName);
+ g_vm->cleanUpAfterAIHint(movieName);
}
if (newState != -1)
diff --git a/engines/pegasus/items/biochips/arthurchip.cpp b/engines/pegasus/items/biochips/arthurchip.cpp
index 15b47bedc4e..9dc3ab5ac98 100644
--- a/engines/pegasus/items/biochips/arthurchip.cpp
+++ b/engines/pegasus/items/biochips/arthurchip.cpp
@@ -131,18 +131,17 @@ void ArthurChip::select() {
}
void ArthurChip::setUpArthurChip() {
- PegasusEngine *vm = g_vm;
ItemState state = getItemState();
- if (vm->isChattyArthur()) {
- if (g_AIArea && vm->isChattyAI()) {
+ if (g_vm->isChattyArthur()) {
+ if (g_AIArea && g_vm->isChattyAI()) {
if (state != kArthur002)
setItemState(kArthur000);
} else if (state != kArthur102) {
setItemState(kArthur100);
}
} else {
- if (g_AIArea && vm->isChattyAI()) {
+ if (g_AIArea && g_vm->isChattyAI()) {
if (state != kArthur012)
setItemState(kArthur010);
} else if (state != kArthur112) {
@@ -159,7 +158,6 @@ void ArthurChip::activateArthurHotspots() {
}
void ArthurChip::clickInArthurHotspot(HotSpotID id) {
- PegasusEngine *vm = g_vm;
ItemState state, newState;
if (id == kArthurHeadSpotID) {
@@ -230,10 +228,10 @@ void ArthurChip::clickInArthurHotspot(HotSpotID id) {
sizeof(kArthurWisdomMovies) / sizeof(const char *)) - 1)]);
break;
case kChattyArthurSpotID:
- vm->setChattyArthur(!vm->isChattyArthur());
+ g_vm->setChattyArthur(!g_vm->isChattyArthur());
break;
case kChattyAISpotID:
- vm->setChattyAI(!vm->isChattyAI());
+ g_vm->setChattyAI(!g_vm->isChattyAI());
break;
}
@@ -253,10 +251,8 @@ void ArthurChip::playArthurMovie(const Common::String &movieName) {
}
bool ArthurChip::playArthurMovieForEvent(const Common::String &movieName, ArthurEvent event) {
- PegasusEngine *vm = g_vm;
-
- if (vm->isDVD() && vm->playerHasItemID(kArthurBiochip) &&
- vm->isChattyArthur() && !Arthur._arthurFlags.getFlag(event)) {
+ if (g_vm->isDVD() && g_vm->playerHasItemID(kArthurBiochip) &&
+ g_vm->isChattyArthur() && !Arthur._arthurFlags.getFlag(event)) {
Arthur._arthurFlags.setFlag(event, true);
playArthurMovie(movieName);
return true;
diff --git a/engines/pegasus/items/biochips/biochipitem.cpp b/engines/pegasus/items/biochips/biochipitem.cpp
index 51b0d4870b5..d4116d1db34 100644
--- a/engines/pegasus/items/biochips/biochipitem.cpp
+++ b/engines/pegasus/items/biochips/biochipitem.cpp
@@ -34,9 +34,7 @@ namespace Pegasus {
BiochipItem::BiochipItem(const ItemID id, const NeighborhoodID neighborhood, const RoomID room, const DirectionConstant direction) :
Item(id, neighborhood, room, direction) {
- PegasusEngine *vm = g_vm;
-
- Common::SeekableReadStream *biochipInfo = vm->_resFork->getResource(MKTAG('B', 'i', 'o', 'I'), kItemBaseResID + id);
+ Common::SeekableReadStream *biochipInfo = g_vm->_resFork->getResource(MKTAG('B', 'i', 'o', 'I'), kItemBaseResID + id);
if (biochipInfo) {
_biochipInfoPanelTime = biochipInfo->readUint32BE();
delete biochipInfo;
@@ -44,7 +42,7 @@ BiochipItem::BiochipItem(const ItemID id, const NeighborhoodID neighborhood, con
_biochipInfoPanelTime = 0;
}
- Common::SeekableReadStream *rightInfo = vm->_resFork->getResource(MKTAG('R', 'g', 'h', 't'), kItemBaseResID + id);
+ Common::SeekableReadStream *rightInfo = g_vm->_resFork->getResource(MKTAG('R', 'g', 'h', 't'), kItemBaseResID + id);
if (!rightInfo)
error("Could not find right info for biochip %d", id);
diff --git a/engines/pegasus/items/biochips/pegasuschip.cpp b/engines/pegasus/items/biochips/pegasuschip.cpp
index 9ef51792a79..495978e03dd 100644
--- a/engines/pegasus/items/biochips/pegasuschip.cpp
+++ b/engines/pegasus/items/biochips/pegasuschip.cpp
@@ -139,8 +139,6 @@ void PegasusChip::activatePegasusHotspots() {
}
void PegasusChip::clickInPegasusHotspot() {
- PegasusEngine *vm = g_vm;
-
ItemState thisState = getItemState();
ItemState hiliteState;
@@ -187,7 +185,7 @@ void PegasusChip::clickInPegasusHotspot() {
uint32 time = g_system->getMillis();
while (g_system->getMillis() < time + 500) {
- vm->refreshDisplay();
+ g_vm->refreshDisplay();
g_system->delayMillis(10);
}
@@ -200,9 +198,9 @@ void PegasusChip::clickInPegasusHotspot() {
g_energyMonitor->stopEnergyDraining();
if (GameState.getTSAState() == kPlayerWentToPrehistoric || GameState.allTimeZonesFinished())
- vm->jumpToNewEnvironment(kFullTSAID, kTSA37, kNorth);
+ g_vm->jumpToNewEnvironment(kFullTSAID, kTSA37, kNorth);
else
- vm->jumpToNewEnvironment(kTinyTSAID, kTinyTSA37, kNorth);
+ g_vm->jumpToNewEnvironment(kTinyTSAID, kTinyTSA37, kNorth);
}
} // End of namespace Pegasus
diff --git a/engines/pegasus/items/inventory/inventoryitem.cpp b/engines/pegasus/items/inventory/inventoryitem.cpp
index 6a521ce27bb..834aa2f3347 100644
--- a/engines/pegasus/items/inventory/inventoryitem.cpp
+++ b/engines/pegasus/items/inventory/inventoryitem.cpp
@@ -33,9 +33,7 @@ namespace Pegasus {
InventoryItem::InventoryItem(const ItemID id, const NeighborhoodID neighborhood, const RoomID room, const DirectionConstant direction) :
Item(id, neighborhood, room, direction) {
- PegasusEngine *vm = g_vm;
-
- Common::SeekableReadStream *leftInfo = vm->_resFork->getResource(MKTAG('L', 'e', 'f', 't'), kItemBaseResID + id);
+ Common::SeekableReadStream *leftInfo = g_vm->_resFork->getResource(MKTAG('L', 'e', 'f', 't'), kItemBaseResID + id);
if (leftInfo) {
_leftAreaInfo = readItemState(leftInfo);
delete leftInfo;
@@ -44,7 +42,7 @@ InventoryItem::InventoryItem(const ItemID id, const NeighborhoodID neighborhood,
_leftAreaInfo.entries = nullptr;
}
- Common::SeekableReadStream *inventoryInfo = vm->_resFork->getResource(MKTAG('I', 'n', 'v', 'I'), kItemBaseResID + id);
+ Common::SeekableReadStream *inventoryInfo = g_vm->_resFork->getResource(MKTAG('I', 'n', 'v', 'I'), kItemBaseResID + id);
if (inventoryInfo) {
_inventoryInfo.panelStart = inventoryInfo->readUint32BE();
_inventoryInfo.panelStop = inventoryInfo->readUint32BE();
diff --git a/engines/pegasus/items/inventorypicture.cpp b/engines/pegasus/items/inventorypicture.cpp
index a08b0a7cf7c..aada8df87a3 100644
--- a/engines/pegasus/items/inventorypicture.cpp
+++ b/engines/pegasus/items/inventorypicture.cpp
@@ -322,8 +322,6 @@ void InventoryItemsPicture::setCommPicture() {
}
void InventoryItemsPicture::playEndMessage(DisplayElement *pushElement) {
- PegasusEngine *vm = g_vm;
-
Movie endMessage(0);
_shouldDrawHighlight = false;
@@ -336,8 +334,8 @@ void InventoryItemsPicture::playEndMessage(DisplayElement *pushElement) {
while (endMessage.isRunning()) {
InputDevice.pumpEvents();
- vm->checkCallBacks();
- vm->refreshDisplay();
+ g_vm->checkCallBacks();
+ g_vm->refreshDisplay();
g_system->delayMillis(10);
}
diff --git a/engines/pegasus/items/item.cpp b/engines/pegasus/items/item.cpp
index de2dbe96eb3..ea4b0957167 100644
--- a/engines/pegasus/items/item.cpp
+++ b/engines/pegasus/items/item.cpp
@@ -45,9 +45,7 @@ Item::Item(const ItemID id, const NeighborhoodID neighborhood, const RoomID room
_itemOwnerID = kNoActorID;
_itemState = 0;
- PegasusEngine *vm = g_vm;
-
- Common::SeekableReadStream *info = vm->_resFork->getResource(kItemInfoResType, kItemBaseResID + id);
+ Common::SeekableReadStream *info = g_vm->_resFork->getResource(kItemInfoResType, kItemBaseResID + id);
if (info) {
_itemInfo.infoLeftTime = info->readUint32BE();
_itemInfo.infoRightStart = info->readUint32BE();
@@ -55,7 +53,7 @@ Item::Item(const ItemID id, const NeighborhoodID neighborhood, const RoomID room
_itemInfo.dragSpriteNormalID = info->readUint16BE();
_itemInfo.dragSpriteUsedID = info->readUint16BE();
- if (vm->isDemo()) {
+ if (g_vm->isDemo()) {
// Adjust info right times to account for the stuff that was chopped out of the
// info right movies.
// Assumes time scale of 600.
@@ -100,7 +98,7 @@ Item::Item(const ItemID id, const NeighborhoodID neighborhood, const RoomID room
memset(&_itemInfo, 0, sizeof(_itemInfo));
}
- Common::SeekableReadStream *middleAreaInfo = vm->_resFork->getResource(kMiddleAreaInfoResType, kItemBaseResID + id);
+ Common::SeekableReadStream *middleAreaInfo = g_vm->_resFork->getResource(kMiddleAreaInfoResType, kItemBaseResID + id);
if (middleAreaInfo) {
_sharedAreaInfo = readItemState(middleAreaInfo);
delete middleAreaInfo;
@@ -109,7 +107,7 @@ Item::Item(const ItemID id, const NeighborhoodID neighborhood, const RoomID room
memset(&_sharedAreaInfo, 0, sizeof(_sharedAreaInfo));
}
- Common::SeekableReadStream *extraInfo = vm->_resFork->getResource(kItemExtraInfoResType, kItemBaseResID + id);
+ Common::SeekableReadStream *extraInfo = g_vm->_resFork->getResource(kItemExtraInfoResType, kItemBaseResID + id);
if (!extraInfo)
error("Extra info not found for item %d", id);
@@ -285,16 +283,15 @@ ItemStateInfo Item::readItemState(Common::SeekableReadStream *stream) {
}
Sprite *Item::getDragSprite(const DisplayElementID id) const {
- PegasusEngine *vm = g_vm;
Sprite *result = new Sprite(id);
SpriteFrame *frame = new SpriteFrame();
- frame->initFromPICTResource(vm->_resFork, _itemInfo.dragSpriteNormalID, true);
+ frame->initFromPICTResource(g_vm->_resFork, _itemInfo.dragSpriteNormalID, true);
result->addFrame(frame, 0, 0);
if (_itemInfo.dragSpriteNormalID != _itemInfo.dragSpriteUsedID) {
frame = new SpriteFrame();
- frame->initFromPICTResource(vm->_resFork, _itemInfo.dragSpriteUsedID, true);
+ frame->initFromPICTResource(g_vm->_resFork, _itemInfo.dragSpriteUsedID, true);
}
result->addFrame(frame, 0, 0);
diff --git a/engines/pegasus/items/itemlist.h b/engines/pegasus/items/itemlist.h
index 78ce14e638b..5cd5e93c6e9 100644
--- a/engines/pegasus/items/itemlist.h
+++ b/engines/pegasus/items/itemlist.h
@@ -52,7 +52,7 @@ public:
typedef ItemList::iterator ItemIterator;
-#define g_allItems (((PegasusEngine *)g_engine)->getAllItems())
+#define g_allItems g_vm->getAllItems()
} // End of namespace Pegasus
diff --git a/engines/pegasus/menu.cpp b/engines/pegasus/menu.cpp
index 26145725a8a..02c9a5264b3 100644
--- a/engines/pegasus/menu.cpp
+++ b/engines/pegasus/menu.cpp
@@ -256,8 +256,7 @@ void MainMenu::stopMainMenuLoop() {
}
void MainMenu::handleInput(const Input &input, const Hotspot *cursorSpot) {
- PegasusEngine *vm = g_vm;
- bool isDemo = vm->isDemo();
+ bool isDemo = g_vm->isDemo();
if (input.upButtonDown()) {
if (_menuSelection > (uint32)(isDemo ? kFirstSelectionDemo : kFirstSelection)) {
@@ -279,19 +278,19 @@ void MainMenu::handleInput(const Input &input, const Hotspot *cursorSpot) {
switch (_menuSelection) {
case kMainMenuCreditsDemo:
_creditsButton.show();
- vm->delayShell(kMenuButtonHiliteTime, kMenuButtonHiliteScale);
+ g_vm->delayShell(kMenuButtonHiliteTime, kMenuButtonHiliteScale);
_creditsButton.hide();
setLastCommand(kMenuCmdCredits);
break;
case kMainMenuStartDemo:
_startButton.show();
- vm->delayShell(kMenuButtonHiliteTime, kMenuButtonHiliteScale);
+ g_vm->delayShell(kMenuButtonHiliteTime, kMenuButtonHiliteScale);
_startButton.hide();
setLastCommand(kMenuCmdStartAdventure);
break;
case kMainMenuQuitDemo:
_quitButton.show();
- vm->delayShell(kMenuButtonHiliteTime, kMenuButtonHiliteScale);
+ g_vm->delayShell(kMenuButtonHiliteTime, kMenuButtonHiliteScale);
_quitButton.hide();
setLastCommand(kMenuCmdQuit);
break;
@@ -302,25 +301,25 @@ void MainMenu::handleInput(const Input &input, const Hotspot *cursorSpot) {
switch (_menuSelection) {
case kMainMenuOverview:
_overviewButton.show();
- vm->delayShell(kMenuButtonHiliteTime, kMenuButtonHiliteScale);
+ g_vm->delayShell(kMenuButtonHiliteTime, kMenuButtonHiliteScale);
_overviewButton.hide();
setLastCommand(kMenuCmdOverview);
break;
case kMainMenuRestore:
_restoreButton.show();
- vm->delayShell(kMenuButtonHiliteTime, kMenuButtonHiliteScale);
+ g_vm->delayShell(kMenuButtonHiliteTime, kMenuButtonHiliteScale);
_restoreButton.hide();
setLastCommand(kMenuCmdRestore);
break;
case kMainMenuCredits:
_creditsButton.show();
- vm->delayShell(kMenuButtonHiliteTime, kMenuButtonHiliteScale);
+ g_vm->delayShell(kMenuButtonHiliteTime, kMenuButtonHiliteScale);
_creditsButton.hide();
setLastCommand(kMenuCmdCredits);
break;
case kMainMenuStart:
_startButton.show();
- vm->delayShell(kMenuButtonHiliteTime, kMenuButtonHiliteScale);
+ g_vm->delayShell(kMenuButtonHiliteTime, kMenuButtonHiliteScale);
_startButton.hide();
if (_adventureMode)
setLastCommand(kMenuCmdStartAdventure);
@@ -333,7 +332,7 @@ void MainMenu::handleInput(const Input &input, const Hotspot *cursorSpot) {
break;
case kMainMenuQuit:
_quitButton.show();
- vm->delayShell(kMenuButtonHiliteTime, kMenuButtonHiliteScale);
+ g_vm->delayShell(kMenuButtonHiliteTime, kMenuButtonHiliteScale);
_quitButton.hide();
setLastCommand(kMenuCmdQuit);
break;
@@ -347,9 +346,7 @@ void MainMenu::handleInput(const Input &input, const Hotspot *cursorSpot) {
}
void MainMenu::updateDisplay() {
- PegasusEngine *vm = g_vm;
-
- if (vm->isDemo()) {
+ if (g_vm->isDemo()) {
switch (_menuSelection) {
case kMainMenuStartDemo:
_smallSelect.moveElementTo(kStartSelectLeftDemo, kStartSelectTopDemo);
@@ -413,7 +410,7 @@ void MainMenu::updateDisplay() {
break;
}
- vm->resetIntroTimer();
+ g_vm->resetIntroTimer();
}
}
@@ -691,8 +688,7 @@ enum {
// Never set the current input handler to the DeathMenu.
DeathMenu::DeathMenu(const DeathReason deathReason) : GameMenu(kDeathMenuID), _deathBackground(0), _continueButton(0),
_mainMenuButton(0), _quitButton(0), _restoreButton(0), _largeSelect(0), _smallSelect(0) {
- PegasusEngine *vm = g_vm;
- bool isDemo = vm->isDemo();
+ bool isDemo = g_vm->isDemo();
_playerWon = (deathReason == kPlayerWonGame);
@@ -741,9 +737,9 @@ DeathMenu::DeathMenu(const DeathReason deathReason) : GameMenu(kDeathMenuID), _d
_deathReason = deathReason;
if (!isDemo) {
- vm->_gfx->setCurSurface(_deathBackground.getSurface());
+ g_vm->_gfx->setCurSurface(_deathBackground.getSurface());
drawAllScores();
- vm->_gfx->setCurSurface(vm->_gfx->getWorkArea());
+ g_vm->_gfx->setCurSurface(g_vm->_gfx->getWorkArea());
}
_deathBackground.setDisplayOrder(0);
@@ -798,7 +794,7 @@ DeathMenu::DeathMenu(const DeathReason deathReason) : GameMenu(kDeathMenuID), _d
_largeSelect.setDisplayOrder(2);
_largeSelect.startDisplaying();
} else {
- if (vm->isDVD()) // Updated file for the DVD version
+ if (g_vm->isDVD()) // Updated file for the DVD version
_triumphSound.initFromAIFFFile("Sounds/Caldoria/Galactic Triumph.44K.aiff");
else
_triumphSound.initFromQuickTime("Sounds/Caldoria/Galactic Triumph");
@@ -810,36 +806,34 @@ DeathMenu::DeathMenu(const DeathReason deathReason) : GameMenu(kDeathMenuID), _d
}
void DeathMenu::handleInput(const Input &input, const Hotspot *cursorSpot) {
- PegasusEngine *vm = g_vm;
-
if (input.upButtonDown()) {
- if (_menuSelection > (vm->isDemo() ? kFirstDeathSelectionDemo : kFirstDeathSelection)) {
+ if (_menuSelection > (g_vm->isDemo() ? kFirstDeathSelectionDemo : kFirstDeathSelection)) {
_menuSelection--;
updateDisplay();
}
- } else if (input.downButtonDown() && (vm->isDemo() || !_playerWon)) {
- if (_menuSelection < (vm->isDemo() ? kLastDeathSelectionDemo : kLastDeathSelection)) {
+ } else if (input.downButtonDown() && (g_vm->isDemo() || !_playerWon)) {
+ if (_menuSelection < (g_vm->isDemo() ? kLastDeathSelectionDemo : kLastDeathSelection)) {
_menuSelection++;
updateDisplay();
}
} else if (JMPPPInput::isMenuButtonPressInput(input)) {
- if (vm->isDemo()) {
+ if (g_vm->isDemo()) {
switch (_menuSelection) {
case kDeathScreenContinueDemo:
_continueButton.show();
- vm->delayShell(kMenuButtonHiliteTime, kMenuButtonHiliteScale);
+ g_vm->delayShell(kMenuButtonHiliteTime, kMenuButtonHiliteScale);
_continueButton.hide();
setLastCommand(kMenuCmdDeathContinue);
break;
case kDeathScreenQuitDemo:
_quitButton.show();
- vm->delayShell(kMenuButtonHiliteTime, kMenuButtonHiliteScale);
+ g_vm->delayShell(kMenuButtonHiliteTime, kMenuButtonHiliteScale);
_quitButton.hide();
setLastCommand(kMenuCmdDeathQuitDemo);
break;
case kDeathScreenMainMenuDemo:
_mainMenuButton.show();
- vm->delayShell(kMenuButtonHiliteTime, kMenuButtonHiliteScale);
+ g_vm->delayShell(kMenuButtonHiliteTime, kMenuButtonHiliteScale);
_mainMenuButton.hide();
setLastCommand(kMenuCmdDeathMainMenuDemo);
break;
@@ -850,19 +844,19 @@ void DeathMenu::handleInput(const Input &input, const Hotspot *cursorSpot) {
switch (_menuSelection) {
case kDeathScreenContinue:
_continueButton.show();
- vm->delayShell(kMenuButtonHiliteTime, kMenuButtonHiliteScale);
+ g_vm->delayShell(kMenuButtonHiliteTime, kMenuButtonHiliteScale);
_continueButton.hide();
setLastCommand(kMenuCmdDeathContinue);
break;
case kDeathScreenRestore:
_restoreButton.show();
- vm->delayShell(kMenuButtonHiliteTime, kMenuButtonHiliteScale);
+ g_vm->delayShell(kMenuButtonHiliteTime, kMenuButtonHiliteScale);
_restoreButton.hide();
setLastCommand(kMenuCmdDeathRestore);
break;
case kDeathScreenMainMenu:
_mainMenuButton.show();
- vm->delayShell(kMenuButtonHiliteTime, kMenuButtonHiliteScale);
+ g_vm->delayShell(kMenuButtonHiliteTime, kMenuButtonHiliteScale);
_mainMenuButton.hide();
setLastCommand(kMenuCmdDeathMainMenu);
break;
@@ -1068,17 +1062,15 @@ static const CoordType kPauseScoreBottom = kPauseScoreTop + 12;
PauseMenu::PauseMenu() : GameMenu(kPauseMenuID), _pauseBackground(0), _saveButton(0), _restoreButton(0),
_walkthroughButton(0), _continueButton(0), _soundFXLevel(0), _ambienceLevel(0), _quitButton(0),
_largeSelect(0), _smallSelect(0) {
- PegasusEngine *vm = g_vm;
-
_pauseBackground.initFromPICTFile("Images/Pause Screen/PausScrn.pict", true);
- if (!vm->isDemo()) {
+ if (!g_vm->isDemo()) {
Surface numbers;
numbers.getImageFromPICTFile("Images/Pause Screen/Numbers.pict");
- vm->_gfx->setCurSurface(_pauseBackground.getSurface());
+ g_vm->_gfx->setCurSurface(_pauseBackground.getSurface());
drawScore(GameState.getTotalScore(), kMaxTotalScore,
Common::Rect(kPauseScoreLeft, kPauseScoreTop, kPauseScoreRight, kPauseScoreBottom), &numbers);
- vm->_gfx->setCurSurface(vm->_gfx->getWorkArea());
+ g_vm->_gfx->setCurSurface(g_vm->_gfx->getWorkArea());
}
_pauseBackground.setDisplayOrder(kPauseMenuOrder);
@@ -1086,7 +1078,7 @@ PauseMenu::PauseMenu() : GameMenu(kPauseMenuID), _pauseBackground(0), _saveButto
_pauseBackground.startDisplaying();
_pauseBackground.show();
- if (!vm->isDemo()) {
+ if (!g_vm->isDemo()) {
_saveButton.initFromPICTFile("Images/Pause Screen/SaveGame.pict");
_saveButton.setDisplayOrder(kSaveGameOrder);
_saveButton.moveElementTo(kSaveGameLeft, kSaveGameTop);
@@ -1115,13 +1107,13 @@ PauseMenu::PauseMenu() : GameMenu(kPauseMenuID), _pauseBackground(0), _saveButto
_soundFXLevel.setBounds(Common::Rect(kSoundFXLeft, kSoundFXTop, kSoundFXRight, kSoundFXBottom));
_soundFXLevel.startDisplaying();
_soundFXLevel.show();
- _soundFXLevel.setSoundLevel(vm->getSoundFXLevel());
+ _soundFXLevel.setSoundLevel(g_vm->getSoundFXLevel());
_ambienceLevel.setDisplayOrder(kAmbienceOrder);
_ambienceLevel.setBounds(Common::Rect(kAmbienceLeft, kAmbienceTop, kAmbienceRight, kAmbienceBottom));
_ambienceLevel.startDisplaying();
_ambienceLevel.show();
- _ambienceLevel.setSoundLevel(vm->getAmbienceLevel());
+ _ambienceLevel.setSoundLevel(g_vm->getAmbienceLevel());
_quitButton.initFromPICTFile("Images/Pause Screen/Quit2MM.pict");
_quitButton.setDisplayOrder(kQuitToMainMenuOrder);
@@ -1136,16 +1128,14 @@ PauseMenu::PauseMenu() : GameMenu(kPauseMenuID), _pauseBackground(0), _saveButto
_smallSelect.setDisplayOrder(kPauseSmallHiliteOrder);
_smallSelect.startDisplaying();
- _menuSelection = (vm->isDemo()) ? kPauseMenuContinue : kPauseMenuSave;
+ _menuSelection = (g_vm->isDemo()) ? kPauseMenuContinue : kPauseMenuSave;
updateDisplay();
}
void PauseMenu::handleInput(const Input &input, const Hotspot *cursorSpot) {
- PegasusEngine *vm = g_vm;
-
if (input.upButtonDown()) {
- if (vm->isDemo()) {
+ if (g_vm->isDemo()) {
if (_menuSelection > kPauseMenuContinue) {
switch (_menuSelection) {
case kPauseMenuSoundFX:
@@ -1169,7 +1159,7 @@ void PauseMenu::handleInput(const Input &input, const Hotspot *cursorSpot) {
}
}
} else if (input.downButtonDown()) {
- if (vm->isDemo()) {
+ if (g_vm->isDemo()) {
if (_menuSelection < kPauseMenuQuitToMainMenu) {
switch (_menuSelection) {
case kPauseMenuContinue:
@@ -1195,11 +1185,11 @@ void PauseMenu::handleInput(const Input &input, const Hotspot *cursorSpot) {
} else if (input.leftButtonDown()) {
if (_menuSelection == kPauseMenuSoundFX) {
_soundFXLevel.decrementLevel();
- vm->setSoundFXLevel(_soundFXLevel.getSoundLevel());
+ g_vm->setSoundFXLevel(_soundFXLevel.getSoundLevel());
} else if (_menuSelection == kPauseMenuAmbience) {
_ambienceLevel.decrementLevel();
- vm->setAmbienceLevel(_ambienceLevel.getSoundLevel());
- } else if (!vm->isDemo() && _menuSelection == kPauseMenuWalkthru) {
+ g_vm->setAmbienceLevel(_ambienceLevel.getSoundLevel());
+ } else if (!g_vm->isDemo() && _menuSelection == kPauseMenuWalkthru) {
GameState.setWalkthroughMode(!GameState.getWalkthroughMode());
if (GameState.getWalkthroughMode())
_walkthroughButton.show();
@@ -1209,11 +1199,11 @@ void PauseMenu::handleInput(const Input &input, const Hotspot *cursorSpot) {
} else if (input.rightButtonDown()) {
if (_menuSelection == kPauseMenuSoundFX) {
_soundFXLevel.incrementLevel();
- vm->setSoundFXLevel(_soundFXLevel.getSoundLevel());
+ g_vm->setSoundFXLevel(_soundFXLevel.getSoundLevel());
} else if (_menuSelection == kPauseMenuAmbience) {
_ambienceLevel.incrementLevel();
- vm->setAmbienceLevel(_ambienceLevel.getSoundLevel());
- } else if (!vm->isDemo() && _menuSelection == kPauseMenuWalkthru) {
+ g_vm->setAmbienceLevel(_ambienceLevel.getSoundLevel());
+ } else if (!g_vm->isDemo() && _menuSelection == kPauseMenuWalkthru) {
GameState.setWalkthroughMode(!GameState.getWalkthroughMode());
if (GameState.getWalkthroughMode())
_walkthroughButton.show();
@@ -1224,19 +1214,19 @@ void PauseMenu::handleInput(const Input &input, const Hotspot *cursorSpot) {
switch (_menuSelection) {
case kPauseMenuSave:
_saveButton.show();
- vm->delayShell(kMenuButtonHiliteTime, kMenuButtonHiliteScale);
+ g_vm->delayShell(kMenuButtonHiliteTime, kMenuButtonHiliteScale);
_saveButton.hide();
setLastCommand(kMenuCmdPauseSave);
break;
case kPauseMenuRestore:
_restoreButton.show();
- vm->delayShell(kMenuButtonHiliteTime, kMenuButtonHiliteScale);
+ g_vm->delayShell(kMenuButtonHiliteTime, kMenuButtonHiliteScale);
_restoreButton.hide();
setLastCommand(kMenuCmdPauseRestore);
break;
case kPauseMenuContinue:
_continueButton.show();
- vm->delayShell(kMenuButtonHiliteTime, kMenuButtonHiliteScale);
+ g_vm->delayShell(kMenuButtonHiliteTime, kMenuButtonHiliteScale);
_continueButton.hide();
setLastCommand(kMenuCmdPauseContinue);
break;
@@ -1249,7 +1239,7 @@ void PauseMenu::handleInput(const Input &input, const Hotspot *cursorSpot) {
break;
case kPauseMenuQuitToMainMenu:
_quitButton.show();
- vm->delayShell(kMenuButtonHiliteTime, kMenuButtonHiliteScale);
+ g_vm->delayShell(kMenuButtonHiliteTime, kMenuButtonHiliteScale);
_quitButton.hide();
setLastCommand(kMenuCmdPauseQuit);
break;
diff --git a/engines/pegasus/neighborhood/mars/mars.cpp b/engines/pegasus/neighborhood/mars/mars.cpp
index f4fd165b5e2..88330eefb41 100644
--- a/engines/pegasus/neighborhood/mars/mars.cpp
+++ b/engines/pegasus/neighborhood/mars/mars.cpp
@@ -190,9 +190,7 @@ ArthurOxygen50Action::ArthurOxygen50Action() : AIPlayMessageAction("Images/AI/Ma
}
void ArthurOxygen50Action::performAIAction(AIRule *rule) {
- PegasusEngine *vm = g_vm;
-
- if (GameState.isTakenItemID(kArthurBiochip) && g_arthurChip && vm->isChattyArthur())
+ if (GameState.isTakenItemID(kArthurBiochip) && g_arthurChip && g_vm->isChattyArthur())
g_arthurChip->playArthurMovieForEvent("Images/AI/Globals/XGLOBA84", kArthurMarsOxygen50Warning);
else
AIPlayMessageAction::performAIAction(rule);
@@ -209,10 +207,8 @@ ArthurOxygen25Action::ArthurOxygen25Action() : AIPlayMessageAction("Images/AI/Ma
}
void ArthurOxygen25Action::performAIAction(AIRule *rule) {
- PegasusEngine *vm = g_vm;
-
- if (GameState.isTakenItemID(kArthurBiochip) && g_arthurChip && vm->isChattyArthur()) {
- if (vm->getRandomBit())
+ if (GameState.isTakenItemID(kArthurBiochip) && g_arthurChip && g_vm->isChattyArthur()) {
+ if (g_vm->getRandomBit())
g_arthurChip->playArthurMovieForEvent("Images/AI/Globals/XGLOBA85", kArthurMarsOxygen25Warning);
else
g_arthurChip->playArthurMovieForEvent("Images/AI/Globals/XGLOBA87", kArthurMarsOxygen25Warning);
@@ -232,10 +228,8 @@ ArthurOxygen5Action::ArthurOxygen5Action() : AIPlayMessageAction("Images/AI/Mars
}
void ArthurOxygen5Action::performAIAction(AIRule *rule) {
- PegasusEngine *vm = g_vm;
-
- if (GameState.isTakenItemID(kArthurBiochip) && g_arthurChip && vm->isChattyArthur()) {
- if (vm->getRandomBit())
+ if (GameState.isTakenItemID(kArthurBiochip) && g_arthurChip && g_vm->isChattyArthur()) {
+ if (g_vm->getRandomBit())
g_arthurChip->playArthurMovieForEvent("Images/AI/Globals/XGLOBA86", kArthurMarsOxygen5Warning);
else
g_arthurChip->playArthurMovieForEvent("Images/AI/Globals/XGLOBA88", kArthurMarsOxygen5Warning);
diff --git a/engines/pegasus/neighborhood/mars/spacejunk.cpp b/engines/pegasus/neighborhood/mars/spacejunk.cpp
index d9daf2c1d1d..fdfa63ac76e 100644
--- a/engines/pegasus/neighborhood/mars/spacejunk.cpp
+++ b/engines/pegasus/neighborhood/mars/spacejunk.cpp
@@ -147,24 +147,22 @@ void SpaceJunk::rebound(const TimeValue reboundTime) {
_bounceStart.x = (bounds.left + bounds.right) >> 1;
_bounceStart.y = (bounds.top + bounds.bottom) >> 1;
- PegasusEngine *vm = g_vm;
-
- switch (vm->getRandomNumber(3)) {
+ switch (g_vm->getRandomNumber(3)) {
case 0:
- _bounceStop.x = kMaxBounceSize / 2 + 1 + vm->getRandomNumber(kBounceTargetHRange - 1);
+ _bounceStop.x = kMaxBounceSize / 2 + 1 + g_vm->getRandomNumber(kBounceTargetHRange - 1);
_bounceStop.y = kMaxBounceSize / 2 + 1;
break;
case 1:
- _bounceStop.x = kMaxBounceSize / 2 + 1 + vm->getRandomNumber(kBounceTargetHRange - 1);
+ _bounceStop.x = kMaxBounceSize / 2 + 1 + g_vm->getRandomNumber(kBounceTargetHRange - 1);
_bounceStop.y = 480 - kMaxBounceSize / 2 + 1;
break;
case 2:
_bounceStop.x = kMaxBounceSize / 2 + 1;
- _bounceStop.y = kMaxBounceSize / 2 + 1 + vm->getRandomNumber(kBounceTargetVRange - 1);
+ _bounceStop.y = kMaxBounceSize / 2 + 1 + g_vm->getRandomNumber(kBounceTargetVRange - 1);
break;
case 3:
_bounceStop.x = 640 - kMaxBounceSize / 2 + 1;
- _bounceStop.y = kMaxBounceSize / 2 + 1 + vm->getRandomNumber(kBounceTargetVRange - 1);
+ _bounceStop.y = kMaxBounceSize / 2 + 1 + g_vm->getRandomNumber(kBounceTargetVRange - 1);
break;
default:
break;
More information about the Scummvm-git-logs
mailing list