mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-14 21:59:17 +00:00
ASYLUM: Implement Scene::enterLoad() and Scene::changePlayer()
git-svn-id: http://asylumengine.googlecode.com/svn/trunk@642 0bfb4aae-4ea4-11de-8d8d-752d95cf3e3c
This commit is contained in:
parent
7a8741e08a
commit
7463acb772
@ -25,9 +25,10 @@
|
||||
|
||||
#include "asylum/asylum.h"
|
||||
|
||||
#include "asylum/resources/actor.h"
|
||||
#include "asylum/resources/encounters.h"
|
||||
#include "asylum/resources/script.h"
|
||||
#include "asylum/resources/special.h"
|
||||
#include "asylum/resources/encounters.h"
|
||||
#include "asylum/resources/worldstats.h"
|
||||
|
||||
#include "asylum/puzzles/vcr.h"
|
||||
@ -191,7 +192,7 @@ void AsylumEngine::startGame(ResourcePackId sceneId, StartGameType type) {
|
||||
|
||||
case kStartGameLoad:
|
||||
if (_savegame->load()) {
|
||||
setupLoadedGame();
|
||||
_scene->enterLoad();
|
||||
updateReverseStereo();
|
||||
switchEventHandler(_scene);
|
||||
}
|
||||
@ -338,10 +339,7 @@ void AsylumEngine::processDelayedEvents() {
|
||||
|
||||
// check for a delayed scene change
|
||||
ResourcePackId packId = _script->getDelayedSceneIndex();
|
||||
// XXX Flag 183 indicates whether the actionlist is currently
|
||||
// processing
|
||||
if (packId != kResourcePackInvalid && isGameFlagNotSet(kGameFlagScriptProcessing)) {
|
||||
|
||||
// Reset delayed scene
|
||||
_script->setDelayedSceneIndex(kResourcePackInvalid);
|
||||
|
||||
@ -473,10 +471,6 @@ Common::Point AsylumEngine::getSinCosValues(int32 index1, int32 index2) {
|
||||
return values;
|
||||
}
|
||||
|
||||
void AsylumEngine::setupLoadedGame() {
|
||||
warning("[AsylumEngine::initSinCosTables] Not implemented!");
|
||||
}
|
||||
|
||||
void AsylumEngine::updateReverseStereo() {
|
||||
if (_scene && _scene->worldstats())
|
||||
_scene->worldstats()->reverseStereo = Config.reverseStereo;
|
||||
|
@ -259,11 +259,6 @@ private:
|
||||
*/
|
||||
int32 computeSinCosOffset(int32 val);
|
||||
|
||||
/**
|
||||
* Sets up the loaded game.
|
||||
*/
|
||||
void setupLoadedGame();
|
||||
|
||||
friend class Console;
|
||||
};
|
||||
|
||||
|
@ -68,6 +68,7 @@ public:
|
||||
void setLastScreenUpdate(int32 tick) { _lastScreenUpdate = tick; }
|
||||
void setNumberFlag01(int32 number) { _numberFlag01 = number; }
|
||||
void setPriority(int32 priority) { _priority = priority; }
|
||||
void setReaction(int32 index, int32 val) { _reaction[index] = val; }
|
||||
void setResourceId(ResourceId id) { _resourceId = id; }
|
||||
void setSoundResourceId(ResourceId id) { _soundResourceId = id; }
|
||||
void setStatus(ActorStatus status) { _status = status; }
|
||||
@ -440,10 +441,10 @@ private:
|
||||
void setVolume();
|
||||
|
||||
/**
|
||||
* Updates the coordinates.
|
||||
* Updates the coordinates.
|
||||
*
|
||||
* @param vec1 The first vector.
|
||||
* @param vec2 The second vector.
|
||||
* @param vec1 The first vector.
|
||||
* @param vec2 The second vector.
|
||||
*/
|
||||
void updateCoordinates(Common::Point vec1, Common::Point vec2);
|
||||
|
||||
|
@ -117,13 +117,13 @@ public:
|
||||
_sceneYTop = 0;
|
||||
_sceneOffset = 0;
|
||||
_sceneOffsetAdd = 0;
|
||||
memset(&_cursorResources, kResourceNone, sizeof(_cursorResources));
|
||||
memset(&_sceneFonts, kResourceNone, sizeof(_sceneFonts));
|
||||
_currentPaletteId = kResourceNone;
|
||||
memset(&_cellShadeMasks, 0, sizeof(_cellShadeMasks));
|
||||
_smallCurUp = 0;
|
||||
_smallCurDown = 0;
|
||||
_encounterFrameBg = 0;
|
||||
memset(&cursorResources, kResourceNone, sizeof(cursorResources));
|
||||
memset(&sceneFonts, kResourceNone, sizeof(sceneFonts));
|
||||
//_currentPaletteId = kResourceNone;
|
||||
//memset(&cellShadeMasks, 0, sizeof(cellShadeMasks));
|
||||
smallCurUp = 0;
|
||||
smallCurDown = 0;
|
||||
encounterFrameBg = 0;
|
||||
_flagSkipDrawScene = false;
|
||||
_matteVar1 = 0;
|
||||
_actorUpdateEnabledCheck = false;
|
||||
@ -146,6 +146,17 @@ public:
|
||||
_nextScreenUpdate = 0;
|
||||
}
|
||||
|
||||
// Saved scene data
|
||||
ResourceId cursorResources[11];
|
||||
// 2 ResourceId unused
|
||||
ResourceId sceneFonts[3];
|
||||
//ResourceId _currentPaletteId;
|
||||
//int32 _cellShadeMasks[3];
|
||||
// unused
|
||||
int32 smallCurUp;
|
||||
int32 smallCurDown;
|
||||
int32 encounterFrameBg;
|
||||
|
||||
// Accessors
|
||||
int32 getActorUpdateEnabledCounter() { return _actorUpdateStatusEnabledCounter; }
|
||||
void setActorUpdateEnabledCounter(int32 val) { _actorUpdateStatusEnabledCounter = val; }
|
||||
@ -339,17 +350,6 @@ private:
|
||||
int32 _sceneOffset;
|
||||
Common::Rational _sceneOffsetAdd;
|
||||
|
||||
// Saved scene data
|
||||
ResourceId _cursorResources[13];
|
||||
ResourceId _sceneFonts[3];
|
||||
ResourceId _currentPaletteId;
|
||||
int32 _cellShadeMasks[3];
|
||||
// unused
|
||||
int32 _smallCurUp;
|
||||
int32 _smallCurDown;
|
||||
int32 _encounterFrameBg;
|
||||
|
||||
|
||||
bool _flagSkipDrawScene;
|
||||
int32 _matteVar1;
|
||||
bool _actorUpdateEnabledCheck;
|
||||
|
@ -98,6 +98,9 @@ enum GameFlag {
|
||||
kGameFlag556 = 556,
|
||||
kGameFlag560 = 560,
|
||||
kGameFlag570 = 570,
|
||||
kGameFlag635 = 635,
|
||||
kGameFlag636 = 636,
|
||||
kGameFlag637 = 637,
|
||||
kGameFlag776 = 776,
|
||||
kGameFlag815 = 815,
|
||||
kGameFlag816 = 816,
|
||||
|
@ -199,6 +199,50 @@ void Scene::enter(ResourcePackId packId) {
|
||||
}
|
||||
}
|
||||
|
||||
void Scene::enterLoad() {
|
||||
_vm->setGameFlag(kGameFlagScriptProcessing);
|
||||
getScreen()->clearGraphicsInQueue();
|
||||
|
||||
// Setup scene bounding rect
|
||||
_ws->boundingRect.left = 195;
|
||||
_ws->boundingRect.top = 115;
|
||||
_ws->boundingRect.right = 445 - getActor()->getBoundingRect()->right;
|
||||
_ws->boundingRect.bottom = 345 - getActor()->getBoundingRect()->bottom;
|
||||
|
||||
// Setup transparency table
|
||||
getScreen()->setupTransTables(3, _ws->cellShadeMask1, _ws->cellShadeMask2, _ws->cellShadeMask3);
|
||||
getScreen()->selectTransTable(1);
|
||||
getText()->loadFont(_ws->font1);
|
||||
|
||||
preload();
|
||||
|
||||
// Adjust object priority
|
||||
if (_ws->objects.size() > 0) {
|
||||
int32 priority = 4091;
|
||||
|
||||
for (uint32 i = 0; i < _ws->objects.size(); i++) {
|
||||
Object *object = _ws->objects[i];
|
||||
object->setPriority(priority);
|
||||
object->flags &= ~kObjectFlagC000;
|
||||
priority -= 4;
|
||||
}
|
||||
}
|
||||
|
||||
// Play intro music
|
||||
if (_ws->musicCurrentResourceIndex != kMusicStopped)
|
||||
getSound()->playMusic(MAKE_RESOURCE(kResourcePackMusic, _ws->musicCurrentResourceIndex));
|
||||
else
|
||||
getSound()->playMusic(kResourceNone, 0);
|
||||
|
||||
// Palette fade
|
||||
getScreen()->paletteFade(0, 75, 8);
|
||||
getScreen()->clear();
|
||||
|
||||
getSharedData()->setFlag(kFlagScene1, true);
|
||||
_vm->lastScreenUpdate = 1;
|
||||
getActor()->setLastScreenUpdate(_vm->screenUpdateCount);
|
||||
}
|
||||
|
||||
void Scene::load(ResourcePackId packId) {
|
||||
// Setup resource manager
|
||||
_packId = packId;
|
||||
@ -1985,7 +2029,123 @@ int32 Scene::findActionArea(ActionAreaType type, const Common::Point pt) {
|
||||
}
|
||||
|
||||
void Scene::changePlayer(ActorIndex index) {
|
||||
error("[Scene::changePlayer] not implemented");
|
||||
switch (index) {
|
||||
default:
|
||||
if (_ws->chapter == kChapter9) {
|
||||
changePlayerUpdate(index);
|
||||
|
||||
getActor(index)->show();
|
||||
}
|
||||
_playerIndex = index;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
if (_ws->chapter == kChapter9) {
|
||||
changePlayerUpdate(index);
|
||||
|
||||
getScreen()->setPalette(_ws->graphicResourceIds[0]);
|
||||
_ws->currentPaletteId = _ws->graphicResourceIds[0];
|
||||
getScreen()->setGammaLevel(_ws->graphicResourceIds[0], 0);
|
||||
_vm->setGameFlag(kGameFlag635);
|
||||
_vm->clearGameFlag(kGameFlag636);
|
||||
_vm->clearGameFlag(kGameFlag637);
|
||||
|
||||
getActor(index)->show();
|
||||
}
|
||||
|
||||
_playerIndex = index;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
if (_ws->chapter == kChapter9) {
|
||||
changePlayerUpdate(index);
|
||||
|
||||
getScreen()->setPalette(_ws->graphicResourceIds[1]);
|
||||
_ws->currentPaletteId = _ws->graphicResourceIds[1];
|
||||
getScreen()->setGammaLevel(_ws->graphicResourceIds[1], 0);
|
||||
_vm->setGameFlag(kGameFlag636);
|
||||
_vm->clearGameFlag(kGameFlag635);
|
||||
_vm->clearGameFlag(kGameFlag637);
|
||||
|
||||
getActor(index)->show();
|
||||
}
|
||||
|
||||
_playerIndex = index;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
if (_ws->chapter == kChapter9) {
|
||||
changePlayerUpdate(index);
|
||||
|
||||
getScreen()->setPalette(_ws->graphicResourceIds[2]);
|
||||
_ws->currentPaletteId = _ws->graphicResourceIds[2];
|
||||
getScreen()->setGammaLevel(_ws->graphicResourceIds[2], 0);
|
||||
_vm->setGameFlag(kGameFlag637);
|
||||
_vm->clearGameFlag(kGameFlag635);
|
||||
_vm->clearGameFlag(kGameFlag636);
|
||||
|
||||
getActor(index)->show();
|
||||
}
|
||||
|
||||
getActor(index)->show();
|
||||
_playerIndex = index;
|
||||
break;
|
||||
|
||||
case 666:
|
||||
memcpy(getSharedData()->cursorResources, _ws->cursorResources, 44);
|
||||
getScreen()->setupTransTables(3, _ws->graphicResourceIds[50], _ws->graphicResourceIds[49], _ws->graphicResourceIds[48]);
|
||||
getSharedData()->sceneFonts[0] = _ws->font1;
|
||||
getSharedData()->sceneFonts[1] = _ws->font2;
|
||||
getSharedData()->sceneFonts[2] = _ws->font3;
|
||||
getSharedData()->smallCurDown = _ws->smallCurDown;
|
||||
getSharedData()->smallCurUp = _ws->smallCurUp;
|
||||
getSharedData()->encounterFrameBg = _ws->encounterFrameBg;
|
||||
|
||||
// Setup new values
|
||||
for (uint32 i = 0; i < 11; i++)
|
||||
_ws->cursorResources[i] = _ws->graphicResourceIds[40 + i];
|
||||
|
||||
_ws->font1 = _ws->graphicResourceIds[35];
|
||||
_ws->font2 = _ws->graphicResourceIds[37];
|
||||
_ws->font3 = _ws->graphicResourceIds[36];
|
||||
|
||||
_ws->smallCurUp = _ws->graphicResourceIds[33];
|
||||
_ws->smallCurDown = _ws->graphicResourceIds[34];
|
||||
_ws->encounterFrameBg = _ws->graphicResourceIds[32];
|
||||
break;
|
||||
|
||||
case 667:
|
||||
getScreen()->setupTransTables(3, _ws->cellShadeMask1, _ws->cellShadeMask2, _ws->cellShadeMask3);
|
||||
memcpy(_ws->cursorResources, getSharedData()->cursorResources, 44);
|
||||
_ws->font1 = getSharedData()->sceneFonts[0];
|
||||
_ws->font2 = getSharedData()->sceneFonts[1];
|
||||
_ws->font3 = getSharedData()->sceneFonts[2];
|
||||
|
||||
_ws->smallCurDown = getSharedData()->smallCurDown;
|
||||
_ws->smallCurUp = getSharedData()->smallCurUp;
|
||||
_ws->encounterFrameBg = getSharedData()->encounterFrameBg;
|
||||
|
||||
// Reset cursor
|
||||
getCursor()->set(_ws->cursorResources[kCursorResourceMagnifyingGlass], 0, kCursorAnimationNone);
|
||||
break;
|
||||
|
||||
case 668:
|
||||
getActor(11)->setPosition(2300, 100, kDirectionN, 0);
|
||||
getSharedData()->setData(40, 0);
|
||||
getSharedData()->setFlag(kFlag1, false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void Scene::changePlayerUpdate(ActorIndex index) {
|
||||
Actor *actor = getActor(index);
|
||||
Actor *player = getActor();
|
||||
|
||||
actor->setPosition(player->getPoint1()->x + player->getPoint2()->x, player->getPoint1()->y + player->getPoint2()->y, player->getDirection(), 0);
|
||||
player->hide();
|
||||
|
||||
for (uint i = 0; i < 8; i++)
|
||||
actor->setReaction(i, player->getReaction(i));
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
@ -92,6 +92,11 @@ public:
|
||||
*/
|
||||
void enter(ResourcePackId packId);
|
||||
|
||||
/**
|
||||
* Enter the scene after a loaded game
|
||||
*/
|
||||
void enterLoad();
|
||||
|
||||
/**
|
||||
* Handle events
|
||||
*
|
||||
@ -134,6 +139,13 @@ public:
|
||||
*/
|
||||
void changePlayer(ActorIndex index);
|
||||
|
||||
/**
|
||||
* Update player position when changing current player
|
||||
*
|
||||
* @param index Zero-based index of the actor
|
||||
*/
|
||||
void changePlayerUpdate(ActorIndex index);
|
||||
|
||||
/**
|
||||
* Updates the scene coordinates.
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user