mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-31 07:53:36 +00:00
MADS: Fixes for sprite list initialisation
This commit is contained in:
parent
c2587af8f2
commit
5536b8a933
@ -271,6 +271,7 @@ void Animation::load(MSurface &depthSurface, InterfaceSurface &interfaceSurface,
|
||||
_spriteSets[i] = nullptr;
|
||||
} else {
|
||||
_spriteSets[i] = new SpriteAsset(_vm, _header._spriteSetNames[i], flags);
|
||||
_spriteListIndexes[i] = _vm->_game->_scene._sprites.add(_spriteSets[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -121,7 +121,7 @@ void Game::gameLoop() {
|
||||
initSection(_sectionNumber);
|
||||
_sectionHandler->postLoadSection();
|
||||
|
||||
_scene._spriteSlots.clear(true);
|
||||
_scene._spriteSlots.reset();
|
||||
|
||||
if (_sectionNumber == _currentSectionNumber) {
|
||||
sectionLoop();
|
||||
@ -164,7 +164,7 @@ void Game::sectionLoop() {
|
||||
if (_player._spritesLoaded)
|
||||
_scene._spriteSlots.releasePlayerSprites();
|
||||
_vm->_palette->resetGamePalette(18, 10);
|
||||
_scene._spriteSlots.clear(true);
|
||||
_scene._spriteSlots.reset();
|
||||
} else {
|
||||
_vm->_palette->initGamePalette();
|
||||
}
|
||||
|
@ -126,7 +126,7 @@ void Scene::loadScene(int sceneId, const Common::String &prefix, bool palFlag) {
|
||||
if (palFlag)
|
||||
_vm->_palette->resetGamePalette(18, 10);
|
||||
|
||||
_spriteSlots.clear(false);
|
||||
_spriteSlots.reset(false);
|
||||
_sequences.clear();
|
||||
_kernelMessages.clear();
|
||||
|
||||
@ -166,7 +166,7 @@ void Scene::loadScene(int sceneId, const Common::String &prefix, bool palFlag) {
|
||||
_bandsRange = _sceneInfo->_yBandsEnd - _sceneInfo->_yBandsStart;
|
||||
_scaleRange = _sceneInfo->_maxScale - _sceneInfo->_minScale;
|
||||
|
||||
_spriteSlots.clear(false);
|
||||
_spriteSlots.reset(false);
|
||||
_interfaceY = MADS_SCENE_HEIGHT;
|
||||
_spritesCount = _sprites.size();
|
||||
|
||||
|
@ -50,10 +50,12 @@ namespace MADS {
|
||||
|
||||
/*------------------------------------------------------------------------*/
|
||||
|
||||
#define TIMER_LIST_SIZE 30
|
||||
#define SEQUENCE_LIST_SIZE 30
|
||||
|
||||
SequenceList::SequenceList(MADSEngine *vm) : _vm(vm) {
|
||||
for (int i = 0; i < TIMER_LIST_SIZE; ++i) {
|
||||
// IMPORTANT: Preallocate timer slots. Note that sprite slots refer to entries
|
||||
// in this list by index, so we can't just add or delete entries later
|
||||
for (int i = 0; i < SEQUENCE_LIST_SIZE; ++i) {
|
||||
SequenceEntry rec;
|
||||
rec._active = false;
|
||||
rec._dynamicHotspotIndex = -1;
|
||||
@ -239,7 +241,7 @@ bool SequenceList::loadSprites(int seqIndex) {
|
||||
if (seqEntry._frameIndex > seqEntry._numSprites) {
|
||||
result = true;
|
||||
if (seqEntry._animType == ANIMTYPE_CYCLED) {
|
||||
// Reset back to the starting frame (cyclic)
|
||||
// back to the starting frame (cyclic)
|
||||
seqEntry._frameIndex = seqEntry._frameStart;
|
||||
}
|
||||
else {
|
||||
|
@ -168,7 +168,7 @@ SpriteSlots::SpriteSlots(MADSEngine *vm) : _vm(vm) {
|
||||
SpriteSlot::_vm = vm;
|
||||
}
|
||||
|
||||
void SpriteSlots::clear(bool flag) {
|
||||
void SpriteSlots::reset(bool flag) {
|
||||
_vm->_game->_scene._textDisplay.clear();
|
||||
|
||||
if (flag)
|
||||
|
@ -153,7 +153,7 @@ public:
|
||||
* Clears any pending slot data and schedules a full screen refresh.
|
||||
* @param flag Also reset sprite list
|
||||
*/
|
||||
void clear(bool flag);
|
||||
void reset(bool flag = true);
|
||||
|
||||
/**
|
||||
* Delete any sprites used by the player
|
||||
|
Loading…
x
Reference in New Issue
Block a user