MADS: Add missing scene codes variant handling

This commit is contained in:
Paul Gilbert 2014-04-05 22:41:25 -04:00
parent 11403c5db6
commit ff7d2e2dbf
8 changed files with 30 additions and 23 deletions

View File

@ -90,10 +90,10 @@ Common::String NebularScene::formAnimName(char sepChar, int suffixNum) {
/*------------------------------------------------------------------------*/
void SceneInfoNebular::loadCodes(MSurface &depthSurface) {
void SceneInfoNebular::loadCodes(MSurface &depthSurface, int variant) {
File f(Resources::formatName(RESPREFIX_RM, _sceneId, ".DAT"));
MadsPack codesPack(&f);
Common::SeekableReadStream *stream = codesPack.getItemStream(0);
Common::SeekableReadStream *stream = codesPack.getItemStream(variant + 1);
loadCodes(depthSurface, stream);

View File

@ -131,7 +131,7 @@ public:
class SceneInfoNebular : public SceneInfo {
friend class SceneInfo;
protected:
virtual void loadCodes(MSurface &depthSurface);
virtual void loadCodes(MSurface &depthSurface, int variant);
virtual void loadCodes(MSurface &depthSurface, Common::SeekableReadStream *stream);

View File

@ -266,7 +266,7 @@ void Scene103::actions() {
} else if (_action.isAction(VERB_TAKE, 371) && _game._objects.isInRoom(OBJ_TIMER_MODULE)) {
switch (_vm->_game->_trigger) {
case 0:
_scene->changeDepthSurface(1);
_scene->changeVariant(1);
_globals._spriteIndexes[28] = _scene->_sequences.startReverseCycle(
_globals._spriteIndexes[13], false, 3, 2);
_scene->_sequences.setMsgLayout(_globals._spriteIndexes[28]);
@ -284,7 +284,7 @@ void Scene103::actions() {
case 2:
_vm->_sound->command(22);
_game._objects.addToInventory(OBJ_TIMER_MODULE);
_scene->changeDepthSurface(0);
_scene->changeVariant(0);
_scene->drawElements(kTransitionNone, false);
_scene->_hotspots.activate(371, false);
_vm->_game->_player._visible = true;
@ -298,7 +298,7 @@ void Scene103::actions() {
} else if (_action.isAction(VERB_TAKE, 289, 0) && _game._objects.isInRoom(OBJ_REBREATHER)) {
switch (_vm->_game->_trigger) {
case 0:
_scene->changeDepthSurface(1);
_scene->changeVariant(1);
_globals._spriteIndexes[27] = _scene->_sequences.startReverseCycle(
_globals._spriteIndexes[12], false, 3, 2);
_scene->_sequences.setMsgLayout(_globals._spriteIndexes[27]);

View File

@ -381,7 +381,7 @@ void Scene202::enter() {
}
if (_globals[kBone202Status])
_scene->changeDepthSurface(_globals[kBone202Status]);
_scene->changeVariant(_globals[kBone202Status]);
if (_scene->_priorSceneId == 201) {
_game._player._playerPos = Common::Point(190, 91);
@ -789,7 +789,7 @@ void Scene202::actions() {
_game._objects.addToInventory(OBJ_BONE);
_vm->_dialogs->showPicture(OBJ_BONE, 0x4EFA, 0);
}
_scene->changeDepthSurface(_globals[kBone202Status]);
_scene->changeVariant(_globals[kBone202Status]);
_game._player._stepEnabled = true;
_game._player._visible = true;
} else {

View File

@ -114,7 +114,7 @@ void Scene::loadScene(int sceneId, const Common::String &prefix, bool palFlag) {
_priorSceneId = _currentSceneId;
_currentSceneId = sceneId;
_v1 = 0;
_variant = 0;
if (palFlag)
_vm->_palette->resetGamePalette(18, 10);
@ -124,7 +124,7 @@ void Scene::loadScene(int sceneId, const Common::String &prefix, bool palFlag) {
// TODO: palletteUsage reset? setPalette(_nullPalette);
_sceneInfo = SceneInfo::init(_vm);
_sceneInfo->load(_currentSceneId, _v1, Common::String(), _vm->_game->_v2 ? 17 : 16,
_sceneInfo->load(_currentSceneId, _variant, Common::String(), _vm->_game->_v2 ? 17 : 16,
_depthSurface, _backgroundSurface);
// Initialise palette animation for the scene
@ -570,9 +570,9 @@ void Scene::free() {
_sceneInfo = nullptr;
}
void Scene::changeDepthSurface(int arg1) {
_v1 = arg1;
_sceneInfo->loadCodes(_depthSurface, nullptr);
void Scene::changeVariant(int variant) {
_variant = variant;
_sceneInfo->loadCodes(_depthSurface, variant);
_spriteSlots.fullRefresh();
}

View File

@ -98,7 +98,7 @@ public:
int _textSpacing;
Hotspots _hotspots;
DirtyAreas _dirtyAreas;
int _v1;
int _variant;
SceneInfo *_sceneInfo;
MSurface _backgroundSurface;
DepthSurface _depthSurface;
@ -206,7 +206,10 @@ public:
*/
void free();
void changeDepthSurface(int arg1);
/**
* Set the walk surface for a scene to a different variant
*/
void changeVariant(int variant);
void resetScene();

View File

@ -98,7 +98,7 @@ SceneInfo *SceneInfo::init(MADSEngine *vm) {
}
}
void SceneInfo::load(int sceneId, int v1, const Common::String &resName,
void SceneInfo::load(int sceneId, int variant, const Common::String &resName,
int flags, MSurface &depthSurface, MSurface &bgSurface) {
bool sceneFlag = sceneId >= 0;
@ -180,7 +180,7 @@ void SceneInfo::load(int sceneId, int v1, const Common::String &resName,
}
// Load the depth surface with the scene codes
Common::SeekableReadStream *depthStream = infoPack.getItemStream(1);
Common::SeekableReadStream *depthStream = infoPack.getItemStream(variant + 1);
loadCodes(depthSurface, depthStream);
delete depthStream;

View File

@ -137,11 +137,6 @@ protected:
* Constructor
*/
SceneInfo(MADSEngine *vm) : _vm(vm) {}
/**
* Loads the given surface with depth information of a given scene
*/
virtual void loadCodes(MSurface &depthSurface) = 0;
public:
int _sceneId;
int _artFileNum;
@ -173,11 +168,20 @@ public:
/**
loads the data
*/
void load(int sceneId, int flags, const Common::String &resName, int v3,
void load(int sceneId, int variant, const Common::String &resName, int flags,
MSurface &depthSurface, MSurface &bgSurface);
/**
* Loads the given surface with depth information of a given scene
* @param depthSurface Depth/walk surface
* @param variant Variant number to load
*/
virtual void loadCodes(MSurface &depthSurface, int variant) = 0;
/**
* Loads the given surface with depth information of a given scene
* @param depthSurface Depth/walk surface
* @param stream Stream to load the data from
*/
virtual void loadCodes(MSurface &depthSurface, Common::SeekableReadStream *stream) = 0;
};