mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-10 21:03:31 +00:00
TRECISION: Simplify the code handling animation subareas
This commit is contained in:
parent
e961746575
commit
dc97c350d2
@ -123,7 +123,7 @@ void AnimTypeManager::executeAtFrameDoit(ATFHandle *h, int doit, uint16 objectId
|
||||
break;
|
||||
|
||||
case fANIMOFF1:
|
||||
anim->_flag |= SMKANIM_OFF1;
|
||||
anim->toggleAnimArea(1, false);
|
||||
if (_vm->_curRoom == kRoom11 ||
|
||||
_vm->_curRoom == kRoom1D ||
|
||||
_vm->_curRoom == kRoom14 ||
|
||||
@ -133,35 +133,35 @@ void AnimTypeManager::executeAtFrameDoit(ATFHandle *h, int doit, uint16 objectId
|
||||
_vm->_animMgr->smkToggleTrackAudio(0, 1, false);
|
||||
break;
|
||||
case fANIMOFF2:
|
||||
anim->_flag |= SMKANIM_OFF2;
|
||||
anim->toggleAnimArea(2, false);
|
||||
if (_vm->_curRoom == kRoom2E)
|
||||
_vm->_animMgr->smkToggleTrackAudio(0, 2, false);
|
||||
break;
|
||||
case fANIMOFF3:
|
||||
anim->_flag |= SMKANIM_OFF3;
|
||||
anim->toggleAnimArea(3, false);
|
||||
break;
|
||||
case fANIMOFF4:
|
||||
anim->_flag |= SMKANIM_OFF4;
|
||||
anim->toggleAnimArea(4, false);
|
||||
if (_vm->_curRoom == kRoom28)
|
||||
_vm->_animMgr->smkToggleTrackAudio(0, 1, false);
|
||||
break;
|
||||
|
||||
case fANIMON1:
|
||||
anim->_flag &= ~SMKANIM_OFF1;
|
||||
anim->toggleAnimArea(1, true);
|
||||
if (_vm->_curRoom == kRoom14 || _vm->_curRoom == kRoom1D || _vm->_curRoom == kRoom22 || _vm->_curRoom == kRoom48 || _vm->_curRoom == kRoom4P) {
|
||||
_vm->_animMgr->smkToggleTrackAudio(0, 1, true);
|
||||
}
|
||||
break;
|
||||
case fANIMON2:
|
||||
anim->_flag &= ~SMKANIM_OFF2;
|
||||
anim->toggleAnimArea(2, true);
|
||||
if (_vm->_curRoom == kRoom2E)
|
||||
_vm->_animMgr->smkToggleTrackAudio(0, 2, true);
|
||||
break;
|
||||
case fANIMON3:
|
||||
anim->_flag &= ~SMKANIM_OFF3;
|
||||
anim->toggleAnimArea(3, true);
|
||||
break;
|
||||
case fANIMON4:
|
||||
anim->_flag &= ~SMKANIM_OFF4;
|
||||
anim->toggleAnimArea(4, true);
|
||||
break;
|
||||
case fENDDEMO:
|
||||
_vm->demoOver();
|
||||
@ -329,17 +329,15 @@ void AnimTypeManager::end(int type) {
|
||||
|
||||
h->_lastFrame = h->_curFrame;
|
||||
|
||||
uint16 flag = _vm->_animMgr->_animTab[_vm->_room[_vm->_curRoom]._bkgAnim]._flag;
|
||||
|
||||
for (int32 i = 0; i < MAXATFRAME; ++i) {
|
||||
// if it's time to run this AtFrame
|
||||
if (anim->_atFrame[i]._numFrame == 0 && anim->_atFrame[i]._type) {
|
||||
const uint8 child = anim->_atFrame[i]._child;
|
||||
if ( child == 0 ||
|
||||
(child == 1 && !(flag & SMKANIM_OFF1)) ||
|
||||
(child == 2 && !(flag & SMKANIM_OFF2)) ||
|
||||
(child == 3 && !(flag & SMKANIM_OFF3)) ||
|
||||
(child == 4 && !(flag & SMKANIM_OFF4)))
|
||||
const uint8 area = anim->_atFrame[i]._area;
|
||||
if ( area == 0 ||
|
||||
(area == 1 && anim->isAnimAreaShown(1)) ||
|
||||
(area == 2 && anim->isAnimAreaShown(2)) ||
|
||||
(area == 3 && anim->isAnimAreaShown(3)) ||
|
||||
(area == 4 && anim->isAnimAreaShown(4)))
|
||||
processAtFrame(h, anim->_atFrame[i]._type, i);
|
||||
}
|
||||
}
|
||||
@ -366,12 +364,12 @@ void AnimTypeManager::handler(int type) {
|
||||
if (anim->_atFrame[i]._numFrame > h->_lastFrame &&
|
||||
anim->_atFrame[i]._numFrame <= h->_curFrame &&
|
||||
anim->_atFrame[i]._numFrame != 0) {
|
||||
const uint8 child = anim->_atFrame[i]._child;
|
||||
const uint8 child = anim->_atFrame[i]._area;
|
||||
if ( child == 0 ||
|
||||
(child == 1 && !(flag & SMKANIM_OFF1)) ||
|
||||
(child == 2 && !(flag & SMKANIM_OFF2)) ||
|
||||
(child == 3 && !(flag & SMKANIM_OFF3)) ||
|
||||
(child == 4 && !(flag & SMKANIM_OFF4)))
|
||||
(child == 1 && anim->isAnimAreaShown(1)) ||
|
||||
(child == 2 && anim->isAnimAreaShown(2)) ||
|
||||
(child == 3 && anim->isAnimAreaShown(3)) ||
|
||||
(child == 4 && anim->isAnimAreaShown(4)))
|
||||
processAtFrame(h, anim->_atFrame[i]._type, i);
|
||||
}
|
||||
}
|
||||
|
@ -2338,7 +2338,7 @@ Game Structure
|
||||
#define MAXTEXTSTACK 3
|
||||
|
||||
// define smacker animations
|
||||
#define MAXCHILD 4
|
||||
#define MAXAREA 4
|
||||
#define MAXATFRAME 16
|
||||
|
||||
/******************************************************************************
|
||||
|
@ -294,7 +294,7 @@ void DialogManager::afterChoice() {
|
||||
_vm->_obj[oCHOCOLATES4A]._examine = 1105;
|
||||
_vm->_obj[oCHOCOLATES4A]._action = 1106;
|
||||
_vm->_obj[oDOORC4A]._action = 1118;
|
||||
_vm->_animMgr->_animTab[aBKG4A]._flag |= SMKANIM_OFF1;
|
||||
_vm->_animMgr->_animTab[aBKG4A].toggleAnimArea(1, false);
|
||||
_vm->setObjectVisible(ocHELLEN4A, false);
|
||||
_vm->setObjectVisible(oHELLENA4A, true);
|
||||
break;
|
||||
|
@ -300,13 +300,13 @@ void LogicManager::startCharacterAnimations() {
|
||||
_vm->startCharacterAction(a186GUARDAPIAZZA, 0, 0, 0);
|
||||
} else if (_vm->_curRoom == kRoom1A && _vm->_oldRoom == kRoom18 && _vm->_room[kRoom1A].isDone()) {
|
||||
_vm->startCharacterAction(a1A5ENTRA, 0, 0, 0);
|
||||
_vm->_animMgr->_animTab[aBKG1A]._flag |= SMKANIM_OFF1;
|
||||
_vm->_animMgr->_animTab[aBKG1A].toggleAnimArea(1, false);
|
||||
} else if (_vm->_curRoom == kRoom1D && _vm->_oldRoom == kRoom1B) {
|
||||
const uint16 cellarAction = _vm->isObjectVisible(oDONNA1D) ? a1D1SCENDESCALE : a1D12SCENDESCALA;
|
||||
_vm->startCharacterAction(cellarAction, 0, 1, 0);
|
||||
_vm->_actor->_lim[0] = 60;
|
||||
_vm->_actor->_lim[2] = 240;
|
||||
} else if (_vm->_curRoom == kRoom1B && _vm->_oldRoom == kRoom18 && (_vm->_animMgr->_animTab[aBKG1B]._flag & SMKANIM_OFF1))
|
||||
} else if (_vm->_curRoom == kRoom1B && _vm->_oldRoom == kRoom18 && _vm->_animMgr->_animTab[aBKG1B].isAnimAreaShown(1))
|
||||
_vm->startCharacterAction(a1B12SCAPPATOPO, 0, 0, 0);
|
||||
else if (_vm->_curRoom == kRoom2B && _vm->_oldRoom == kRoom2A)
|
||||
_vm->startCharacterAction(a2B2ESCEPOZZO, 0, 2, 0);
|
||||
@ -381,49 +381,51 @@ bool LogicManager::startPlayDialog() {
|
||||
void LogicManager::endChangeRoom() {
|
||||
// Specific management of magnetic fields
|
||||
if (_vm->_curRoom == kRoom2E && _vm->isObjectVisible(oPULSANTEADS2D)) {
|
||||
_vm->_animMgr->_animTab[aBKG2E]._flag |= SMKANIM_OFF1;
|
||||
_vm->_animMgr->_animTab[aBKG2E].toggleAnimArea(1, false);
|
||||
_vm->setObjectVisible(oCAMPO2E, false);
|
||||
_vm->setObjectVisible(oCARTELLOA2E, false);
|
||||
_vm->setObjectVisible(oCARTELLOS2E, true);
|
||||
} else if (_vm->_curRoom == kRoom2E && _vm->isObjectVisible(oPULSANTEADA2D)) {
|
||||
_vm->_animMgr->_animTab[aBKG2E]._flag &= ~SMKANIM_OFF1;
|
||||
_vm->_animMgr->_animTab[aBKG2E].toggleAnimArea(1, true);
|
||||
_vm->setObjectVisible(oCAMPO2E, true);
|
||||
_vm->setObjectVisible(oCARTELLOA2E, true);
|
||||
_vm->setObjectVisible(oCARTELLOS2E, false);
|
||||
}
|
||||
|
||||
if (_vm->_curRoom == kRoom2C && _vm->isObjectVisible(oPULSANTEACS2D)) {
|
||||
_vm->_animMgr->_animTab[aBKG2C]._flag |= SMKANIM_OFF1;
|
||||
_vm->_animMgr->_animTab[aBKG2C].toggleAnimArea(1, false);
|
||||
_vm->setObjectVisible(oCAMPO2C, false);
|
||||
_vm->setObjectVisible(oCARTELLOA2C, false);
|
||||
_vm->setObjectVisible(oCARTELLOS2C, true);
|
||||
} else if (_vm->_curRoom == kRoom2C && _vm->isObjectVisible(oPULSANTEACA2D)) {
|
||||
_vm->_animMgr->_animTab[aBKG2C]._flag &= ~SMKANIM_OFF1;
|
||||
_vm->_animMgr->_animTab[aBKG2C].toggleAnimArea(1, true);
|
||||
_vm->setObjectVisible(oCAMPO2C, true);
|
||||
_vm->setObjectVisible(oCARTELLOS2C, false);
|
||||
_vm->setObjectVisible(oCARTELLOA2C, true);
|
||||
}
|
||||
|
||||
if (_vm->_curRoom == kRoom28 && _vm->isObjectVisible(oPULSANTEBBS2D)) {
|
||||
_vm->_animMgr->_animTab[aBKG28]._flag |= SMKANIM_OFF2;
|
||||
_vm->_animMgr->_animTab[aBKG28].toggleAnimArea(2, false);
|
||||
_vm->setObjectAnim(oCESPUGLIO28, a283);
|
||||
_vm->setObjectVisible(oSERPENTETM28, true);
|
||||
_vm->setObjectVisible(oSERPENTEAM28, true);
|
||||
} else if (_vm->_curRoom == kRoom28 && _vm->isObjectVisible(oPULSANTEBBA2D)) {
|
||||
_vm->_animMgr->_animTab[aBKG28]._flag &= ~SMKANIM_OFF2;
|
||||
_vm->_animMgr->_animTab[aBKG28].toggleAnimArea(2, true);
|
||||
_vm->setObjectAnim(oCESPUGLIO28, a282);
|
||||
_vm->setObjectVisible(oSERPENTETM28, false);
|
||||
_vm->setObjectVisible(oSERPENTEAM28, false);
|
||||
}
|
||||
|
||||
if (_vm->_curRoom == kRoom28 && _vm->isObjectVisible(oPULSANTEABS2D)) {
|
||||
_vm->_animMgr->_animTab[aBKG28]._flag |= (SMKANIM_OFF1 | SMKANIM_OFF3);
|
||||
_vm->_animMgr->_animTab[aBKG28].toggleAnimArea(1, false);
|
||||
_vm->_animMgr->_animTab[aBKG28].toggleAnimArea(3, false);
|
||||
_vm->setObjectVisible(oCAMPO28, false);
|
||||
_vm->setObjectVisible(oCARTELLOA28, false);
|
||||
_vm->setObjectVisible(oCARTELLOS28, true);
|
||||
_vm->read3D("282.3d");
|
||||
} else if (_vm->_curRoom == kRoom28 && _vm->isObjectVisible(oPULSANTEABA2D)) {
|
||||
_vm->_animMgr->_animTab[aBKG28]._flag &= ~(SMKANIM_OFF1 | SMKANIM_OFF3);
|
||||
_vm->_animMgr->_animTab[aBKG28].toggleAnimArea(1, true);
|
||||
_vm->_animMgr->_animTab[aBKG28].toggleAnimArea(3, true);
|
||||
_vm->setObjectVisible(oCAMPO28, true);
|
||||
_vm->setObjectVisible(oCARTELLOA28, true);
|
||||
_vm->setObjectVisible(oCARTELLOS28, false);
|
||||
@ -1182,7 +1184,7 @@ void LogicManager::useInventoryWithScreen() {
|
||||
_vm->read3D("1d2.3d"); // after skate
|
||||
_vm->setObjectVisible(oDONNA1D, false);
|
||||
_vm->_room[_vm->_curRoom].setExtra(true);
|
||||
_vm->_animMgr->_animTab[aBKG1D]._flag |= SMKANIM_OFF1;
|
||||
_vm->_animMgr->_animTab[aBKG1D].toggleAnimArea(1, false);
|
||||
printSentence = false;
|
||||
}
|
||||
break;
|
||||
@ -1360,7 +1362,7 @@ void LogicManager::useInventoryWithScreen() {
|
||||
_vm->_dialogMgr->playDialog(dF2E2);
|
||||
_vm->setObjectVisible(oDINOSAURO2E, false);
|
||||
_vm->setObjectAnim(oCATWALKA2E, a2E2PRIMAPALLONTANANDO);
|
||||
_vm->_animMgr->_animTab[aBKG2E]._flag |= SMKANIM_OFF2;
|
||||
_vm->_animMgr->_animTab[aBKG2E].toggleAnimArea(2, false);
|
||||
printSentence = false;
|
||||
}
|
||||
break;
|
||||
@ -1676,7 +1678,7 @@ void LogicManager::useInventoryWithScreen() {
|
||||
_vm->setObjectVisible(oSANGUE4P, true);
|
||||
_vm->_room[kRoom4P].setExtra(true);
|
||||
_vm->read3D("4p2.3d"); // after werewolf
|
||||
_vm->_animMgr->_animTab[aBKG4P]._flag |= SMKANIM_OFF1;
|
||||
_vm->_animMgr->_animTab[aBKG4P].toggleAnimArea(1, false);
|
||||
_vm->_dialogMgr->playDialog(dF4P2);
|
||||
printSentence = false;
|
||||
} else if (_vm->_useWith[WITH] == oLICANTROPO4P) {
|
||||
@ -1912,7 +1914,7 @@ bool LogicManager::useScreenWithScreen() {
|
||||
if (_vm->_useWith[WITH] == oTUBO21) {
|
||||
_vm->_dialogMgr->playDialog(dF211);
|
||||
_vm->_logicMgr->setupAltRoom(kRoom21, true);
|
||||
_vm->_animMgr->_animTab[aBKG21]._flag &= ~SMKANIM_OFF1;
|
||||
_vm->_animMgr->_animTab[aBKG21].toggleAnimArea(1, true);
|
||||
_vm->setObjectVisible(oRAMPINO21, false);
|
||||
_vm->setObjectVisible(oTUBO21, false);
|
||||
_vm->setObjectVisible(oCHAIN21, true);
|
||||
@ -2623,7 +2625,7 @@ bool LogicManager::mouseOperate(uint16 curObj) {
|
||||
_vm->setObjectVisible(oSERBATOIOA2G, true);
|
||||
_vm->setObjectVisible(oPANNELLOE2G, true);
|
||||
_vm->_obj[oPANELM2G].setFlagExtra(true);
|
||||
_vm->_animMgr->_animTab[aBKG2G]._flag |= SMKANIM_OFF1;
|
||||
_vm->_animMgr->_animTab[aBKG2G].toggleAnimArea(1, false);
|
||||
retVal = false;
|
||||
} else
|
||||
retVal = true;
|
||||
@ -2633,7 +2635,7 @@ bool LogicManager::mouseOperate(uint16 curObj) {
|
||||
case oWHEELS2C:
|
||||
if (!_vm->isObjectVisible(od2CTO2D)) {
|
||||
_vm->_animMgr->smkStop(kSmackerBackground);
|
||||
_vm->_animMgr->_animTab[aBKG2C]._flag |= SMKANIM_OFF1;
|
||||
_vm->_animMgr->_animTab[aBKG2C].toggleAnimArea(1, false);
|
||||
_vm->setObjectVisible(oBASEWHEELS2C, true);
|
||||
_vm->setObjectVisible(omWHEELS2C, true);
|
||||
_vm->setObjectVisible(oPULSANTE2C, true);
|
||||
@ -2662,7 +2664,7 @@ bool LogicManager::mouseOperate(uint16 curObj) {
|
||||
_vm->_dialogMgr->playDialog(dF2E1);
|
||||
_vm->setObjectVisible(oDINOSAURO2E, true);
|
||||
_vm->_obj[oCATWALKA2E].setFlagExtra(true);
|
||||
_vm->_animMgr->_animTab[aBKG2E]._flag &= ~SMKANIM_OFF2;
|
||||
_vm->_animMgr->_animTab[aBKG2E].toggleAnimArea(2, true);
|
||||
retVal = false;
|
||||
} else if (_vm->_obj[curObj]._anim) {
|
||||
_vm->_scheduler->doEvent(MC_CHARACTER, ME_CHARACTERACTION, MP_DEFAULT, _vm->_obj[curObj]._anim, 0, 0, curObj);
|
||||
@ -2735,7 +2737,7 @@ bool LogicManager::mouseOperate(uint16 curObj) {
|
||||
_vm->_obj[oASCENSORE35].setFlagRoomOut(true);
|
||||
_vm->setObjectAnim(oASCENSORE35, a3514ENTRAASCENSORE);
|
||||
|
||||
_vm->_animMgr->_animTab[aBKG35]._flag |= SMKANIM_OFF1;
|
||||
_vm->_animMgr->_animTab[aBKG35].toggleAnimArea(1, false);
|
||||
_vm->_dialogMgr->playDialog(dF351);
|
||||
_vm->_pathFind->setPosition(7);
|
||||
break;
|
||||
@ -2784,8 +2786,8 @@ bool LogicManager::mouseOperate(uint16 curObj) {
|
||||
_vm->setObjectAnim(oDOORMC36, a3610APREPORTA);
|
||||
_vm->setObjectAnim(oSCAFFALE36, a3615APRENDESCAFFALE);
|
||||
|
||||
_vm->_animMgr->_animTab[aBKG36]._flag |= SMKANIM_OFF2;
|
||||
_vm->_animMgr->_animTab[aBKG36]._flag |= SMKANIM_OFF3;
|
||||
_vm->_animMgr->_animTab[aBKG36].toggleAnimArea(2, false);
|
||||
_vm->_animMgr->_animTab[aBKG36].toggleAnimArea(3, false);
|
||||
_vm->setObjectVisible(oSCANNERLA36, false);
|
||||
_vm->setObjectVisible(oSCANNERLS36, true);
|
||||
_vm->setObjectVisible(oSCANNERMA36, false);
|
||||
@ -3625,7 +3627,7 @@ void LogicManager::handleClickSphinxPuzzle() {
|
||||
_vm->_scheduler->mouseExamine(_vm->_curObj);
|
||||
return;
|
||||
}
|
||||
_vm->_animMgr->_animTab[aBKG2C]._flag &= ~SMKANIM_OFF1;
|
||||
_vm->_animMgr->_animTab[aBKG2C].toggleAnimArea(1, true);
|
||||
_vm->setObjectVisible(oBASEWHEELS2C, false);
|
||||
_vm->setObjectVisible(omWHEELS2C, false);
|
||||
_vm->setObjectVisible(oPULSANTE2C, false);
|
||||
@ -3904,7 +3906,7 @@ void LogicManager::doSystemChangeRoom(uint16 room) {
|
||||
}
|
||||
|
||||
if (_vm->_curRoom == kRoom12 && _vm->_oldRoom == kRoom11)
|
||||
_vm->_animMgr->_animTab[aBKG11]._flag |= SMKANIM_OFF1;
|
||||
_vm->_animMgr->_animTab[aBKG11].toggleAnimArea(1, false);
|
||||
else if (_vm->_oldRoom == kRoom2BL || _vm->_oldRoom == kRoom36F)
|
||||
_vm->_oldRoom = _vm->_curRoom;
|
||||
else if (_vm->_curRoom == kRoomControlPanel)
|
||||
|
@ -543,7 +543,7 @@ void TrecisionEngine::doMouseTake(uint16 curObj) {
|
||||
break;
|
||||
|
||||
if (frame->_type == ATFNONE) {
|
||||
frame->_child = 0;
|
||||
frame->_area = 0;
|
||||
frame->_numFrame = 1;
|
||||
frame->_type = ATFCLR;
|
||||
frame->_index = curObj;
|
||||
|
@ -121,17 +121,43 @@ private:
|
||||
|
||||
struct SAtFrame {
|
||||
uint8 _type; //ATFTEXT, ATFSND, ATFEVENT
|
||||
uint8 _child; // 0 1 2 3 4
|
||||
uint8 _area; // 0 1 2 3 4
|
||||
uint16 _numFrame;
|
||||
uint16 _index;
|
||||
};
|
||||
|
||||
// Shifted left by 1 - 4, depending on the subarea
|
||||
#define SMKANIM_OFF_BASE 16
|
||||
|
||||
struct SAnim {
|
||||
char _name[14];
|
||||
uint16 _flag; // 1- background 2- icon 3- action 4- active - 4bits per child
|
||||
Common::Rect _lim[MAXCHILD];
|
||||
Common::Rect _lim[MAXAREA];
|
||||
uint8 _nbox;
|
||||
SAtFrame _atFrame[MAXATFRAME];
|
||||
|
||||
/**
|
||||
* Toggle the animation of a subarea
|
||||
* @param area: 1 - 4
|
||||
* @param show: show or hide the animation area
|
||||
*/
|
||||
void toggleAnimArea(uint8 area, bool show) {
|
||||
assert(area >= 1 && area <= 4);
|
||||
if (show)
|
||||
_flag &= ~(SMKANIM_OFF_BASE << area);
|
||||
else
|
||||
_flag |= (SMKANIM_OFF_BASE << area);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if an animation subarea is shown
|
||||
* @param area: 1 - 4
|
||||
* @return true if the subarea is shown
|
||||
*/
|
||||
bool isAnimAreaShown(uint8 area) {
|
||||
assert(area >= 1 && area <= 4);
|
||||
return !(_flag & (SMKANIM_OFF_BASE << area));
|
||||
}
|
||||
};
|
||||
|
||||
struct SSortTable {
|
||||
|
@ -322,32 +322,34 @@ void AnimManager::startSmkAnim(uint16 animation) {
|
||||
}
|
||||
|
||||
void AnimManager::toggleMuteBgAnim(uint16 animation) {
|
||||
uint16 animFlag = _animTab[animation]._flag;
|
||||
const bool area1Shown = _animTab[animation].isAnimAreaShown(1);
|
||||
const bool area2Shown = _animTab[animation].isAnimAreaShown(2);
|
||||
const bool area4Shown = _animTab[animation].isAnimAreaShown(4);
|
||||
NightlongSmackerDecoder *decoder = _smkAnims[kSmackerBackground];
|
||||
if (decoder == nullptr)
|
||||
return;
|
||||
|
||||
// Turns off when not needed
|
||||
if (animation == aBKG11 && (animFlag & SMKANIM_OFF1))
|
||||
if (animation == aBKG11 && !area1Shown)
|
||||
decoder->muteTrack(1, true);
|
||||
else if (animation == aBKG14 && (animFlag & SMKANIM_OFF1))
|
||||
else if (animation == aBKG14 && !area1Shown)
|
||||
decoder->muteTrack(1, true);
|
||||
else if (animation == aBKG1C && _vm->_obj[oFAX17].isFlagExtra()) {
|
||||
_animTab[animation]._flag |= SMKANIM_OFF1;
|
||||
_animTab[animation].toggleAnimArea(1, false);
|
||||
decoder->muteTrack(1, true);
|
||||
} else if (animation == aBKG1D && (animFlag & SMKANIM_OFF1))
|
||||
} else if (animation == aBKG1D && !area1Shown)
|
||||
decoder->muteTrack(1, true);
|
||||
else if (animation == aBKG22 && (animFlag & SMKANIM_OFF1))
|
||||
else if (animation == aBKG22 && !area1Shown)
|
||||
decoder->muteTrack(1, true);
|
||||
else if (animation == aBKG48 && (animFlag & SMKANIM_OFF1))
|
||||
else if (animation == aBKG48 && !area1Shown)
|
||||
decoder->muteTrack(1, true);
|
||||
else if (animation == aBKG4P && (animFlag & SMKANIM_OFF1))
|
||||
else if (animation == aBKG4P && !area1Shown)
|
||||
decoder->muteTrack(1, true);
|
||||
else if (animation == aBKG28 && (animFlag & SMKANIM_OFF4))
|
||||
else if (animation == aBKG28 && area4Shown)
|
||||
decoder->muteTrack(1, true);
|
||||
else if (animation == aBKG37 && !_vm->_room[_vm->_curRoom].hasExtra())
|
||||
decoder->muteTrack(1, true);
|
||||
else if (animation == aBKG2E && (animFlag & SMKANIM_OFF2))
|
||||
else if (animation == aBKG2E && area2Shown)
|
||||
decoder->muteTrack(2, true);
|
||||
else if (animation == aBKG2G && _vm->_dialogMgr->isDialogFinished(556))
|
||||
decoder->muteTrack(2, true);
|
||||
@ -441,8 +443,8 @@ void AnimManager::refreshSmkAnim(uint16 animation) {
|
||||
handleEndOfVideo(animation, kSmackerAction);
|
||||
}
|
||||
|
||||
for (int32 i = 0; i < MAXCHILD; i++) {
|
||||
if (!(_animTab[animation]._flag & (SMKANIM_OFF1 << i)) && _animTab[animation]._lim[i].bottom != 0) {
|
||||
for (int32 i = 0; i < MAXAREA; i++) {
|
||||
if (_animTab[animation].isAnimAreaShown(i + 1) && _animTab[animation]._lim[i].bottom != 0) {
|
||||
_vm->_graphicsMgr->addDirtyRect(_animTab[animation]._lim[i], true);
|
||||
}
|
||||
}
|
||||
@ -475,10 +477,9 @@ static bool rectsIntersect(Common::Rect r1, Common::Rect r2) {
|
||||
bool AnimManager::shouldShowAnim(int animation, Common::Rect curRect) {
|
||||
bool hideAnim = false;
|
||||
|
||||
for (int32 i = 0; i < MAXCHILD; i++) {
|
||||
for (int32 i = 0; i < MAXAREA; i++) {
|
||||
const bool intersect = rectsIntersect(_animTab[animation]._lim[i], curRect);
|
||||
const bool animAreaEnabled = !(_animTab[animation]._flag & (SMKANIM_OFF1 << i));
|
||||
hideAnim = intersect && !animAreaEnabled;
|
||||
hideAnim = intersect && !_animTab[animation].isAnimAreaShown(i + 1);
|
||||
if (hideAnim)
|
||||
break;
|
||||
}
|
||||
@ -572,7 +573,7 @@ void AnimManager::syncGameStream(Common::Serializer &ser) {
|
||||
SAnim *cur = &_animTab[i];
|
||||
ser.syncBytes((byte *)cur->_name, 14);
|
||||
ser.syncAsUint16LE(cur->_flag);
|
||||
for (uint8 j = 0; j < MAXCHILD; ++j) {
|
||||
for (uint8 j = 0; j < MAXAREA; ++j) {
|
||||
ser.syncAsUint16LE(cur->_lim[j].left);
|
||||
ser.syncAsUint16LE(cur->_lim[j].top);
|
||||
ser.syncAsUint16LE(cur->_lim[j].right);
|
||||
@ -582,7 +583,7 @@ void AnimManager::syncGameStream(Common::Serializer &ser) {
|
||||
ser.skip(1, SAVE_VERSION_ORIGINAL_MIN, SAVE_VERSION_ORIGINAL_MAX);
|
||||
for (uint8 j = 0; j < MAXATFRAME; ++j) {
|
||||
ser.syncAsByte(cur->_atFrame[j]._type);
|
||||
ser.syncAsByte(cur->_atFrame[j]._child);
|
||||
ser.syncAsByte(cur->_atFrame[j]._area);
|
||||
ser.syncAsUint16LE(cur->_atFrame[j]._numFrame);
|
||||
ser.syncAsUint16LE(cur->_atFrame[j]._index);
|
||||
}
|
||||
@ -595,7 +596,7 @@ void AnimManager::loadAnimTab(Common::SeekableReadStreamEndian *stream) {
|
||||
|
||||
_animTab[i]._flag = stream->readUint16();
|
||||
|
||||
for (uint8 j = 0; j < MAXCHILD; ++j) {
|
||||
for (uint8 j = 0; j < MAXAREA; ++j) {
|
||||
_animTab[i]._lim[j].left = stream->readUint16();
|
||||
_animTab[i]._lim[j].top = stream->readUint16();
|
||||
_animTab[i]._lim[j].right = stream->readUint16();
|
||||
@ -607,7 +608,7 @@ void AnimManager::loadAnimTab(Common::SeekableReadStreamEndian *stream) {
|
||||
|
||||
for (uint8 j = 0; j < MAXATFRAME; ++j) {
|
||||
_animTab[i]._atFrame[j]._type = stream->readByte();
|
||||
_animTab[i]._atFrame[j]._child = stream->readByte();
|
||||
_animTab[i]._atFrame[j]._area = stream->readByte();
|
||||
_animTab[i]._atFrame[j]._numFrame = stream->readUint16();
|
||||
_animTab[i]._atFrame[j]._index = stream->readUint16();
|
||||
}
|
||||
|
@ -40,10 +40,6 @@ namespace Trecision {
|
||||
#define SMKANIM_LOOP 4
|
||||
#define SMKANIM_OLD 8
|
||||
#define SMKANIM_ON 16
|
||||
#define SMKANIM_OFF1 32
|
||||
#define SMKANIM_OFF2 64
|
||||
#define SMKANIM_OFF3 128
|
||||
#define SMKANIM_OFF4 256
|
||||
|
||||
enum SmackerType {
|
||||
kSmackerBackground = 0, // Scene background animations
|
||||
|
Loading…
x
Reference in New Issue
Block a user