diff options
Diffstat (limited to 'engines/saga')
-rw-r--r-- | engines/saga/actor.cpp | 18 | ||||
-rw-r--r-- | engines/saga/animation.cpp | 9 | ||||
-rw-r--r-- | engines/saga/events.cpp | 23 | ||||
-rw-r--r-- | engines/saga/interface.cpp | 54 | ||||
-rw-r--r-- | engines/saga/introproc_ihnm.cpp | 4 | ||||
-rw-r--r-- | engines/saga/puzzle.cpp | 3 | ||||
-rw-r--r-- | engines/saga/scene.cpp | 30 | ||||
-rw-r--r-- | engines/saga/sfuncs.cpp | 4 |
8 files changed, 37 insertions, 108 deletions
diff --git a/engines/saga/actor.cpp b/engines/saga/actor.cpp index 52c07faca3..5f099f88da 100644 --- a/engines/saga/actor.cpp +++ b/engines/saga/actor.cpp @@ -1046,10 +1046,7 @@ void Actor::drawActors() { CommonObjectDataPointer drawObject; int frameNumber = 0; SpriteList *spriteList = NULL; - - Surface *backBuffer; - - backBuffer = _vm->_gfx->getBackBuffer(); + Surface *backBuffer = _vm->_gfx->getBackBuffer(); createDrawOrderList(); @@ -1076,17 +1073,12 @@ void Actor::drawSpeech(void) { || (!_vm->_subtitlesEnabled && (_vm->getGameType() == GType_IHNM))) return; - int i; Point textPoint; ActorData *actor; int width, height; - int stringLength; - Surface *backBuffer; - char *outputString; - - backBuffer = _vm->_gfx->getBackBuffer(); - stringLength = strlen(_activeSpeech.strings[0]); - outputString = (char*)calloc(stringLength + 1, 1); + Surface *backBuffer = _vm->_gfx->getBackBuffer(); + int stringLength = strlen(_activeSpeech.strings[0]); + char *outputString = (char*)calloc(stringLength + 1, 1); if (_activeSpeech.speechFlags & kSpeakSlow) strncpy(outputString, _activeSpeech.strings[0], _activeSpeech.slowModeCharIndex + 1); @@ -1097,7 +1089,7 @@ void Actor::drawSpeech(void) { height = _vm->_font->getHeight(kKnownFontScript); width = _vm->_font->getStringWidth(kKnownFontScript, _activeSpeech.strings[0], 0, kFontNormal); - for (i = 0; i < _activeSpeech.actorsCount; i++) { + for (int i = 0; i < _activeSpeech.actorsCount; i++) { actor = getActor(_activeSpeech.actorIds[i]); calcScreenPosition(actor); diff --git a/engines/saga/animation.cpp b/engines/saga/animation.cpp index 9d66162aa6..e28d43fdcd 100644 --- a/engines/saga/animation.cpp +++ b/engines/saga/animation.cpp @@ -348,9 +348,8 @@ void Anim::showCutawayBg(int bg) { const byte *palPointer = _vm->getImagePal(resourceData, resourceDataLength); memcpy(pal, palPointer, sizeof(pal)); - Surface *bgSurface = _vm->_render->getBackGroundSurface(); const Rect rect(width, height); - bgSurface->blit(rect, buf); + _vm->_render->getBackGroundSurface()->blit(rect, buf); _vm->_frameCount++; if (_cutAwayFade) { @@ -474,8 +473,6 @@ int Anim::getCycles(uint16 animId) { void Anim::play(uint16 animId, int vectorTime, bool playing) { Event event; - Surface *backGroundSurface; - byte *displayBuffer; uint16 frame; @@ -508,9 +505,7 @@ void Anim::play(uint16 animId, int vectorTime, bool playing) { } anim = getAnimation(animId); - - backGroundSurface = _vm->_render->getBackGroundSurface(); - displayBuffer = (byte*)backGroundSurface->pixels; + displayBuffer = (byte*)_vm->_render->getBackGroundSurface()->pixels; if (playing) { anim->state = ANIM_PLAYING; diff --git a/engines/saga/events.cpp b/engines/saga/events.cpp index 368d15f791..a456e81f96 100644 --- a/engines/saga/events.cpp +++ b/engines/saga/events.cpp @@ -123,7 +123,6 @@ int Events::handleContinuous(Event *event) { double event_pc = 0.0; // Event completion percentage int event_done = 0; - Surface *backGroundSurface; BGInfo bgInfo; Rect rect; if (event->duration != 0) { @@ -166,12 +165,11 @@ int Events::handleContinuous(Event *event) { case kTransitionEvent: switch (event->op) { case kEventDissolve: - backGroundSurface = _vm->_render->getBackGroundSurface(); _vm->_scene->getBGInfo(bgInfo); rect.left = rect.top = 0; rect.right = bgInfo.bounds.width(); rect.bottom = bgInfo.bounds.height(); - backGroundSurface->transitionDissolve(bgInfo.buffer, rect, 0, event_pc); + _vm->_render->getBackGroundSurface()->transitionDissolve(bgInfo.buffer, rect, 0, event_pc); break; case kEventDissolveBGMask: // we dissolve it centered. @@ -180,14 +178,13 @@ int Events::handleContinuous(Event *event) { byte *maskBuffer; size_t len; - backGroundSurface = _vm->_render->getBackGroundSurface(); _vm->_scene->getBGMaskInfo(w, h, maskBuffer, len); rect.left = (_vm->getDisplayWidth() - w) / 2; rect.top = (_vm->getDisplayHeight() - h) / 2; rect.setWidth(w); rect.setHeight(h); - backGroundSurface->transitionDissolve( maskBuffer, rect, 1, event_pc); + _vm->_render->getBackGroundSurface()->transitionDissolve( maskBuffer, rect, 1, event_pc); break; default: break; @@ -272,7 +269,6 @@ int Events::handleImmediate(Event *event) { } int Events::handleOneShot(Event *event) { - Surface *backBuffer; ScriptThread *sthread; Rect rect; @@ -312,13 +308,10 @@ int Events::handleOneShot(Event *event) { break; case kBgEvent: { - Surface *backGroundSurface; + Surface *backGroundSurface = _vm->_render->getBackGroundSurface(); BGInfo bgInfo; if (!(_vm->_scene->getFlags() & kSceneFlagISO)) { - - backBuffer = _vm->_gfx->getBackBuffer(); - backGroundSurface = _vm->_render->getBackGroundSurface(); _vm->_scene->getBGInfo(bgInfo); backGroundSurface->blit(bgInfo.bounds, bgInfo.buffer); @@ -378,10 +371,9 @@ int Events::handleOneShot(Event *event) { const PalEntry *palette = (const PalEntry *)_vm->getImagePal(resourceData, resourceDataLength); - Surface *bgSurface = _vm->_render->getBackGroundSurface(); const Rect profileRect(width, height); - bgSurface->blit(profileRect, buf); + _vm->_render->getBackGroundSurface()->blit(profileRect, buf); _vm->_frameCount++; _vm->_gfx->setPalette(palette); @@ -421,14 +413,9 @@ int Events::handleOneShot(Event *event) { switch (event->op) { case kEventDraw: { - Surface *backGroundSurface; BGInfo bgInfo; - - backBuffer = _vm->_gfx->getBackBuffer(); - backGroundSurface = _vm->_render->getBackGroundSurface(); _vm->_scene->getBGInfo(bgInfo); - backGroundSurface->blit(bgInfo.bounds, bgInfo.buffer); - + _vm->_render->getBackGroundSurface()->blit(bgInfo.bounds, bgInfo.buffer); _vm->_scene->draw(); } break; diff --git a/engines/saga/interface.cpp b/engines/saga/interface.cpp index 4f4c90fc9c..ffa2be758d 100644 --- a/engines/saga/interface.cpp +++ b/engines/saga/interface.cpp @@ -787,15 +787,11 @@ void Interface::drawVerbPanel(Surface *backBuffer, PanelButton* panelButton) { } void Interface::draw() { - Surface *backBuffer; - int i; - + Surface *backBuffer = _vm->_gfx->getBackBuffer(); Point leftPortraitPoint; Point rightPortraitPoint; Rect rect; - backBuffer = _vm->_gfx->getBackBuffer(); - if (_vm->_scene->isInIntro() || _fadeMode == kFadeOut) return; @@ -806,7 +802,7 @@ void Interface::draw() { _mainPanel.getRect(rect); backBuffer->blit(rect, _mainPanel.image); - for (i = 0; i < kVerbTypeIdsMax; i++) { + for (int i = 0; i < kVerbTypeIdsMax; i++) { if (_verbTypeToPanelButton[i] != NULL) { drawVerbPanel(backBuffer, _verbTypeToPanelButton[i]); } @@ -934,10 +930,8 @@ void Interface::drawPanelText(Surface *ds, InterfacePanel *panel, PanelButton *p void Interface::drawOption() { const char *text; - Surface *backBuffer; - int i; int fontHeight; - uint j, idx; + uint idx; int fgColor; int bgColor; Rect rect; @@ -947,13 +941,12 @@ void Interface::drawOption() { Point point; Point sliderPoint; int spritenum = 0; - - backBuffer = _vm->_gfx->getBackBuffer(); + Surface *backBuffer = _vm->_gfx->getBackBuffer(); _optionPanel.getRect(rect); backBuffer->blit(rect, _optionPanel.image); - for (i = 0; i < _optionPanel.buttonsCount; i++) { + for (int i = 0; i < _optionPanel.buttonsCount; i++) { panelButton = &_optionPanel.buttons[i]; if (panelButton->type == kPanelButtonOption) { @@ -992,7 +985,7 @@ void Interface::drawOption() { rect.top++; rect2 = rect; fontHeight = _vm->_font->getHeight(kKnownFontSmall); - for (j = 0; j < _vm->getDisplayInfo().optionSaveFileVisible; j++) { + for (uint j = 0; j < _vm->getDisplayInfo().optionSaveFileVisible; j++) { if (_vm->getGameType() == GType_ITE) bgColor = kITEColorDarkGrey0C; else @@ -1020,13 +1013,11 @@ void Interface::drawOption() { } void Interface::drawQuit() { - Surface *backBuffer; + Surface *backBuffer = _vm->_gfx->getBackBuffer(); Rect rect; int i; PanelButton *panelButton; - backBuffer = _vm->_gfx->getBackBuffer(); - _quitPanel.getRect(rect); if (_vm->getGameType() == GType_ITE) drawButtonBox(backBuffer, rect, kButton, false); @@ -1087,13 +1078,11 @@ void Interface::setQuit(PanelButton *panelButton) { } void Interface::drawLoad() { - Surface *backBuffer; + Surface *backBuffer = _vm->_gfx->getBackBuffer(); Rect rect; int i; PanelButton *panelButton; - backBuffer = _vm->_gfx->getBackBuffer(); - _loadPanel.getRect(rect); if (_vm->getGameType() == GType_ITE) drawButtonBox(backBuffer, rect, kButton, false); @@ -1310,13 +1299,11 @@ void Interface::drawTextInput(Surface *ds, InterfacePanel *panel, PanelButton *p } void Interface::drawSave() { - Surface *backBuffer; + Surface *backBuffer = _vm->_gfx->getBackBuffer(); Rect rect; int i; PanelButton *panelButton; - backBuffer = _vm->_gfx->getBackBuffer(); - _savePanel.getRect(rect); if (_vm->getGameType() == GType_ITE) drawButtonBox(backBuffer, rect, kButton, false); @@ -1337,13 +1324,11 @@ void Interface::drawSave() { } void Interface::drawProtect() { - Surface *backBuffer; + Surface *backBuffer = _vm->_gfx->getBackBuffer(); Rect rect; int i; PanelButton *panelButton; - backBuffer = _vm->_gfx->getBackBuffer(); - _protectPanel.getRect(rect); drawButtonBox(backBuffer, rect, kButton, false); @@ -1878,7 +1863,7 @@ void Interface::update(const Point& mousePoint, int updateFlag) { } void Interface::drawStatusBar() { - Surface *backBuffer; + Surface *backBuffer = _vm->_gfx->getBackBuffer(); Rect rect; Point textPoint; int stringWidth; @@ -1895,8 +1880,6 @@ void Interface::drawStatusBar() { if (_fadeMode == kFadeOut) return; - backBuffer = _vm->_gfx->getBackBuffer(); - // Erase background of status bar rect.left = _vm->getDisplayInfo().statusXOffset; rect.top = _vm->getDisplayInfo().statusYOffset; @@ -2722,7 +2705,6 @@ void Interface::mapPanelShow() { int i; byte *resource; size_t resourceLength, imageLength; - Surface *backBuffer; Rect rect; byte *image; int imageWidth, imageHeight; @@ -2731,8 +2713,6 @@ void Interface::mapPanelShow() { _vm->_gfx->showCursor(false); - backBuffer = _vm->_gfx->getBackBuffer(); - rect.left = rect.top = 0; _vm->_resource->loadResource(_interfaceContext, @@ -2763,7 +2743,7 @@ void Interface::mapPanelShow() { rect.setWidth(imageWidth); rect.setHeight(imageHeight); - backBuffer->blit(rect, image); + _vm->_gfx->getBackBuffer()->blit(rect, image); // Evil Evil for (i = 0; i < 6 ; i++) { @@ -2806,16 +2786,13 @@ void Interface::mapPanelClean() { } void Interface::mapPanelDrawCrossHair() { - Surface *backBuffer; - - backBuffer = _vm->_gfx->getBackBuffer(); _mapPanelCrossHairState = !_mapPanelCrossHairState; Point mapPosition = _vm->_isoMap->getMapPosition(); Rect screen(_vm->getDisplayWidth(), _vm->_scene->getHeight()); if (screen.contains(mapPosition)) { - _vm->_sprite->draw(backBuffer, _vm->getDisplayClip(), _vm->_sprite->_mainSprites, + _vm->_sprite->draw(_vm->_gfx->getBackBuffer(), _vm->getDisplayClip(), _vm->_sprite->_mainSprites, _mapPanelCrossHairState? RID_ITE_SPR_CROSSHAIR : RID_ITE_SPR_CROSSHAIR + 1, mapPosition, 256); } @@ -2835,7 +2812,6 @@ void Interface::keyBoss() { int i; byte *resource; size_t resourceLength, imageLength; - Surface *backBuffer; Rect rect; byte *image; int imageWidth, imageHeight; @@ -2844,8 +2820,6 @@ void Interface::keyBoss() { _vm->_gfx->showCursor(false); - backBuffer = _vm->_gfx->getBackBuffer(); - rect.left = rect.top = 0; _vm->_resource->loadResource(_interfaceContext, RID_IHNM_BOSS_SCREEN, resource, resourceLength); @@ -2873,7 +2847,7 @@ void Interface::keyBoss() { cPal[i].blue = 128; } - backBuffer->blit(rect, image); + _vm->_gfx->getBackBuffer()->blit(rect, image); _vm->_gfx->setPalette(cPal); diff --git a/engines/saga/introproc_ihnm.cpp b/engines/saga/introproc_ihnm.cpp index 685cc5a961..3ce77d945f 100644 --- a/engines/saga/introproc_ihnm.cpp +++ b/engines/saga/introproc_ihnm.cpp @@ -169,7 +169,6 @@ bool Scene::checkKey() { bool Scene::playTitle(int title, int time, int mode) { bool interrupted = false; - Surface *backBufferSurface; int startTime = _vm->_system->getMillis(); int frameTime = 0; int curTime; @@ -179,8 +178,7 @@ bool Scene::playTitle(int title, int time, int mode) { bool playParameter = true; static PalEntry cur_pal[PAL_ENTRIES]; static PalEntry pal_cut[PAL_ENTRIES]; - - backBufferSurface = _vm->_render->getBackGroundSurface(); + Surface *backBufferSurface = _vm->_render->getBackGroundSurface(); // Load the cutaway diff --git a/engines/saga/puzzle.cpp b/engines/saga/puzzle.cpp index 2835775320..e37892693c 100644 --- a/engines/saga/puzzle.cpp +++ b/engines/saga/puzzle.cpp @@ -203,12 +203,11 @@ void Puzzle::showPieces(void) { void Puzzle::drawCurrentPiece() { ActorData *puzzle = _vm->_actor->getActor(_vm->_actor->actorIndexToId(ITE_ACTOR_PUZZLE)); - Surface *backBuffer = _vm->_gfx->getBackBuffer(); int frameNumber; SpriteList *spriteList; _vm->_actor->getSpriteParams(puzzle, frameNumber, spriteList); - _vm->_sprite->draw(backBuffer, _vm->_scene->getSceneClip(), *spriteList, _puzzlePiece, + _vm->_sprite->draw(_vm->_gfx->getBackBuffer(), _vm->_scene->getSceneClip(), *spriteList, _puzzlePiece, Point(_pieceInfo[_puzzlePiece].curX, _pieceInfo[_puzzlePiece].curY), 256); } diff --git a/engines/saga/scene.cpp b/engines/saga/scene.cpp index e6afb8241c..06c2bbe87d 100644 --- a/engines/saga/scene.cpp +++ b/engines/saga/scene.cpp @@ -1145,29 +1145,18 @@ void Scene::processSceneResources() { } void Scene::draw() { - Surface *backBuffer; - Surface *backGroundSurface; - Rect rect; - - backBuffer = _vm->_gfx->getBackBuffer(); - - backGroundSurface = _vm->_render->getBackGroundSurface(); - if (_sceneDescription.flags & kSceneFlagISO) { _vm->_isoMap->adjustScroll(false); - _vm->_isoMap->draw(backBuffer); + _vm->_isoMap->draw(_vm->_gfx->getBackBuffer()); } else { - backGroundSurface->getRect(rect); - if (_sceneClip.bottom < rect.bottom) { - rect.bottom = getHeight(); - } - backBuffer->blit(rect, (const byte *)backGroundSurface->pixels); + Rect rect; + _vm->_render->getBackGroundSurface()->getRect(rect); + rect.bottom = (_sceneClip.bottom < rect.bottom) ? getHeight() : rect.bottom; + _vm->_gfx->getBackBuffer()->blit(rect, (const byte *)_vm->_render->getBackGroundSurface()->pixels); } } void Scene::endScene() { - Surface *backBuffer; - Surface *backGroundSurface; Rect rect; size_t i; @@ -1187,16 +1176,14 @@ void Scene::endScene() { _vm->_script->_skipSpeeches = false; // Copy current screen to render buffer so inset rooms will get proper background - backGroundSurface = _vm->_render->getBackGroundSurface(); if (!(_sceneDescription.flags & kSceneFlagISO) && !_vm->_scene->isInIntro()) { BGInfo bgInfo; _vm->_scene->getBGInfo(bgInfo); - backGroundSurface->blit(bgInfo.bounds, bgInfo.buffer); + _vm->_render->getBackGroundSurface()->blit(bgInfo.bounds, bgInfo.buffer); } else { - backBuffer = _vm->_gfx->getBackBuffer(); - backBuffer->getRect(rect); - backGroundSurface->blit(rect, (const byte *)backBuffer->pixels); + _vm->_gfx->getBackBuffer()->getRect(rect); + _vm->_render->getBackGroundSurface()->blit(rect, (const byte *)_vm->_gfx->getBackBuffer()->pixels); } // Free scene background @@ -1235,7 +1222,6 @@ void Scene::endScene() { _textList.clear(); _sceneLoaded = false; - } void Scene::restoreScene() { diff --git a/engines/saga/sfuncs.cpp b/engines/saga/sfuncs.cpp index e19fd5ae02..c2d7096153 100644 --- a/engines/saga/sfuncs.cpp +++ b/engines/saga/sfuncs.cpp @@ -1452,11 +1452,9 @@ void Script::sfGetActorY(SCRIPTFUNC_PARAMS) { // Script function #62 (0x3E) void Script::sfEraseDelta(SCRIPTFUNC_PARAMS) { - Surface *backGroundSurface = _vm->_render->getBackGroundSurface(); BGInfo backGroundInfo; - _vm->_scene->getBGInfo(backGroundInfo); - backGroundSurface->blit(backGroundInfo.bounds, backGroundInfo.buffer); + _vm->_render->getBackGroundSurface()->blit(backGroundInfo.bounds, backGroundInfo.buffer); } // Script function #63 (0x3F) |