Skip to content

Commit

Permalink
HOPKINS: Get rid of NO_SEQ in AnimationManager
Browse files Browse the repository at this point in the history
  • Loading branch information
Strangerke committed Mar 23, 2013
1 parent df751fc commit c49cbf3
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 45 deletions.
38 changes: 16 additions & 22 deletions engines/hopkins/anim.cpp
Expand Up @@ -38,7 +38,6 @@ namespace Hopkins {
AnimationManager::AnimationManager(HopkinsEngine *vm) {
_vm = vm;
_clearAnimationFl = false;
NO_SEQ = false;
NO_COUL = false;
}

Expand All @@ -49,7 +48,7 @@ AnimationManager::AnimationManager(HopkinsEngine *vm) {
* @param rate2 Delay amount between animation frames
* @param rate3 Delay amount after animation finishes
*/
void AnimationManager::playAnim(const Common::String &filename, uint32 rate1, uint32 rate2, uint32 rate3) {
void AnimationManager::playAnim(const Common::String &filename, uint32 rate1, uint32 rate2, uint32 rate3, bool skipSeqFl) {
byte *screenCopy = NULL;
Common::File f;

Expand Down Expand Up @@ -89,7 +88,7 @@ void AnimationManager::playAnim(const Common::String &filename, uint32 rate1, ui
screenCopy = _vm->_globals->allocMemory(307200);
memcpy(screenCopy, screenP, 307200);
}
if (NO_SEQ) {
if (skipSeqFl) {
if (hasScreenCopy)
memcpy(screenCopy, _vm->_graphicsManager->_vesaBuffer, 307200);
_vm->_graphicsManager->setPaletteVGA256(_vm->_graphicsManager->_palette);
Expand Down Expand Up @@ -275,23 +274,18 @@ void AnimationManager::playAnim2(const Common::String &filename, uint32 rate1, u
screenCopy = _vm->_globals->allocMemory(307200);
memcpy(screenCopy, screenP, 307200);
}
if (NO_SEQ) {
if (hasScreenCopy)
memcpy(screenCopy, _vm->_graphicsManager->_vesaBuffer, 307200);
_vm->_graphicsManager->setPaletteVGA256(_vm->_graphicsManager->_palette);
} else {
_vm->_graphicsManager->setPaletteVGA256(_vm->_graphicsManager->_palette);
_vm->_graphicsManager->lockScreen();
if (hasScreenCopy)
_vm->_graphicsManager->m_scroll16A(screenCopy, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0);
else
_vm->_graphicsManager->m_scroll16(screenP, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0);

_vm->_graphicsManager->unlockScreen();
_vm->_graphicsManager->setPaletteVGA256(_vm->_graphicsManager->_palette);
_vm->_graphicsManager->lockScreen();
if (hasScreenCopy)
_vm->_graphicsManager->m_scroll16A(screenCopy, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0);
else
_vm->_graphicsManager->m_scroll16(screenP, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0);

_vm->_graphicsManager->unlockScreen();
_vm->_graphicsManager->addRefreshRect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
_vm->_graphicsManager->updateScreen();

_vm->_graphicsManager->addRefreshRect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
_vm->_graphicsManager->updateScreen();
}
_vm->_eventsManager->_rateCounter = 0;
_vm->_eventsManager->_escKeyFl = false;
_vm->_soundManager->loadAnimSound();
Expand Down Expand Up @@ -611,7 +605,7 @@ void AnimationManager::searchAnim(const byte *data, int animIndex, int bufSize)
/**
* Play sequence
*/
void AnimationManager::playSequence(const Common::String &file, uint32 rate1, uint32 rate2, uint32 rate3, bool skipEscFl) {
void AnimationManager::playSequence(const Common::String &file, uint32 rate1, uint32 rate2, uint32 rate3, bool skipEscFl, bool skipSeqFl) {
if (_vm->shouldQuit())
return;

Expand Down Expand Up @@ -645,7 +639,7 @@ void AnimationManager::playSequence(const Common::String &file, uint32 rate1, ui
screenCopy = _vm->_globals->allocMemory(307200);
memcpy(screenCopy, screenP, 307200);
}
if (NO_SEQ) {
if (skipSeqFl) {
if (hasScreenCopy)
memcpy(screenCopy, _vm->_graphicsManager->_vesaBuffer, 307200);
if (!_vm->getIsDemo()) {
Expand Down Expand Up @@ -783,7 +777,7 @@ void AnimationManager::playSequence(const Common::String &file, uint32 rate1, ui
/**
* Play Sequence type 2
*/
void AnimationManager::playSequence2(const Common::String &file, uint32 rate1, uint32 rate2, uint32 rate3) {
void AnimationManager::playSequence2(const Common::String &file, uint32 rate1, uint32 rate2, uint32 rate3, bool skipSeqFl) {
byte *screenCopy = NULL;
byte *screenP;
int frameNumber;
Expand Down Expand Up @@ -812,7 +806,7 @@ void AnimationManager::playSequence2(const Common::String &file, uint32 rate1, u
screenCopy = _vm->_globals->allocMemory(307200);
memcpy((void *)screenCopy, screenP, 307200);
}
if (NO_SEQ) {
if (skipSeqFl) {
if (multiScreenFl) {
assert(screenCopy != NULL);
memcpy((void *)screenCopy, _vm->_graphicsManager->_vesaBuffer, 307200);
Expand Down
7 changes: 3 additions & 4 deletions engines/hopkins/anim.h
Expand Up @@ -41,17 +41,16 @@ class AnimationManager {

public:
bool _clearAnimationFl;
bool NO_SEQ;
bool NO_COUL;

AnimationManager(HopkinsEngine *vm);

void loadAnim(const Common::String &animName);
void clearAnim();
void playAnim(const Common::String &filename, uint32 rate1, uint32 rate2, uint32 rate3);
void playAnim(const Common::String &filename, uint32 rate1, uint32 rate2, uint32 rate3, bool skipSeqFl = false);
void playAnim2(const Common::String &filename, uint32 rate1, uint32 rate2, uint32 rate3);
void playSequence(const Common::String &file, uint32 rate1, uint32 rate2, uint32 rate3, bool skipEscFl = false);
void playSequence2(const Common::String &file, uint32 rate1, uint32 rate2, uint32 rate3);
void playSequence(const Common::String &file, uint32 rate1, uint32 rate2, uint32 rate3, bool skipEscFl = false, bool skipSeqFl = false);
void playSequence2(const Common::String &file, uint32 rate1, uint32 rate2, uint32 rate3, bool skipSeqFl = false);
};

} // End of namespace Hopkins
Expand Down
1 change: 0 additions & 1 deletion engines/hopkins/hopkins.cpp
Expand Up @@ -2029,7 +2029,6 @@ void HopkinsEngine::playUnderwaterBaseCutscene() {
_graphicsManager->clearScreen();
_graphicsManager->unlockScreen();
_graphicsManager->clearPalette();
_animationManager->NO_SEQ = false;
_soundManager->playSound(26);
_globals->iRegul = 1;
_globals->_disableInventFl = true;
Expand Down
4 changes: 1 addition & 3 deletions engines/hopkins/objects.cpp
Expand Up @@ -2587,10 +2587,8 @@ void ObjectsManager::handleSpecialGames() {
_vm->_graphicsManager->NB_SCREEN(true);
_vm->_soundManager->_specialSoundNum = 198;
PERSO_ON = true;
_vm->_animationManager->NO_SEQ = true;
_vm->_animationManager->_clearAnimationFl = false;
_vm->_animationManager->playAnim("otage.ANM", 1, 24, 500);
_vm->_animationManager->NO_SEQ = false;
_vm->_animationManager->playAnim("otage.ANM", 1, 24, 500, true);
_vm->_soundManager->_specialSoundNum = 0;
_vm->_graphicsManager->NB_SCREEN(false);

Expand Down
20 changes: 5 additions & 15 deletions engines/hopkins/script.cpp
Expand Up @@ -1933,17 +1933,15 @@ int ScriptManager::handleOpcode(byte *dataP) {
}

case 210:
_vm->_animationManager->NO_SEQ = true;
_vm->_soundManager->_specialSoundNum = 210;
_vm->_animationManager->playSequence2("SECRET1.SEQ", 1, 12, 1);
_vm->_animationManager->playSequence2("SECRET1.SEQ", 1, 12, 1, true);
_vm->_soundManager->_specialSoundNum = 0;
_vm->_graphicsManager->fastDisplay(_vm->_globals->SPRITE_ECRAN, 192, 152, 0);
_vm->_objectsManager->setBobAnimation(9);
_vm->_objectsManager->OBSSEUL = true;
_vm->_objectsManager->loadLinkFile("IM73a");
_vm->_objectsManager->OBSSEUL = false;
_vm->_globals->enableHiding();
_vm->_animationManager->NO_SEQ = false;
_vm->_globals->setHidingUseCount(0);
_vm->_globals->setHidingUseCount(1);
_vm->_graphicsManager->SETCOLOR4(252, 100, 100, 100);
Expand All @@ -1955,11 +1953,9 @@ int ScriptManager::handleOpcode(byte *dataP) {
case 211:
_vm->_objectsManager->removeSprite(0);
_vm->_globals->disableHiding();
_vm->_animationManager->NO_SEQ = true;
_vm->_soundManager->_specialSoundNum = 211;
_vm->_animationManager->playSequence("SECRET2.SEQ", 1, 12, 100);
_vm->_animationManager->playSequence("SECRET2.SEQ", 1, 12, 100, false, true);
_vm->_soundManager->_specialSoundNum = 0;
_vm->_animationManager->NO_SEQ = false;
_vm->_graphicsManager->_noFadingFl = true;
_vm->_graphicsManager->fadeOutLong();

Expand Down Expand Up @@ -2272,9 +2268,7 @@ int ScriptManager::handleOpcode(byte *dataP) {
// Resurrect Samantha's clone
case 242: {
_vm->_soundManager->playSoundFile("SOUND87.WAV");
_vm->_animationManager->NO_SEQ = true;
_vm->_animationManager->playSequence("RESUF.SEQ", 1, 24, 1);
_vm->_animationManager->NO_SEQ = false;
_vm->_animationManager->playSequence("RESUF.SEQ", 1, 24, 1, false, true);

CharacterLocation *samantha = &_vm->_globals->_saveData->_samantha;
samantha->_pos.x = 404;
Expand All @@ -2297,9 +2291,7 @@ int ScriptManager::handleOpcode(byte *dataP) {
case 243:
_vm->_soundManager->playSoundFile("SOUND88.WAV");
if (_vm->_globals->_saveData->_data[svField341] == 2) {
_vm->_animationManager->NO_SEQ = true;
_vm->_animationManager->playSequence("RESU.SEQ", 2, 24, 2);
_vm->_animationManager->NO_SEQ = false;
_vm->_animationManager->playSequence("RESU.SEQ", 2, 24, 2, false, true);
} else {
_vm->_objectsManager->OPTI_ONE(7, 0, 14, 0);
}
Expand All @@ -2319,9 +2311,7 @@ int ScriptManager::handleOpcode(byte *dataP) {
_vm->_objectsManager->OPTI_ONE(6, 0, 15, 0);
_vm->_objectsManager->PERSO_ON = true;
_vm->_graphicsManager->NB_SCREEN(true);
_vm->_animationManager->NO_SEQ = true;
_vm->_animationManager->playSequence2("TUNNEL.SEQ", 1, 18, 20);
_vm->_animationManager->NO_SEQ = false;
_vm->_animationManager->playSequence2("TUNNEL.SEQ", 1, 18, 20, true);
_vm->_graphicsManager->_noFadingFl = true;
_vm->_graphicsManager->fadeOutLong();
_vm->_objectsManager->PERSO_ON = false;
Expand Down

0 comments on commit c49cbf3

Please sign in to comment.