From 35e3ba4086524dc614fa7f3be27cafe800ec23b2 Mon Sep 17 00:00:00 2001 From: Paul Date: Thu, 5 Jul 2001 23:16:09 +0000 Subject: [PATCH] --- source/backend/party.cpp | 15 ++++++++----- source/backend/party.h | 2 ++ source/fma/fma.cpp | 47 ++++++++++++++++++++++++++-------------- source/fma/fma.h | 2 ++ 4 files changed, 45 insertions(+), 21 deletions(-) diff --git a/source/backend/party.cpp b/source/backend/party.cpp index 509493f3b..21c477e57 100644 --- a/source/backend/party.cpp +++ b/source/backend/party.cpp @@ -102,6 +102,8 @@ void CPartyScene::init() s_leftBobSin=s_leftBob=s_rightBobSin=s_rightBob=0; CSoundMediator::setSong(CSoundMediator::SONG_PARTY); + + m_animationFlag=true; } @@ -227,7 +229,7 @@ void CPartyScene::render() for(i=0;im_fh<=FRM_TABLESIDE3); -// if(gameSlot->isPartyItemHeld(pimage->m_itemId)&&!drawn[pimage->m_elementId]) + if(gameSlot->isPartyItemHeld(pimage->m_itemId)&&!drawn[pimage->m_elementId]) { int x,y; x=pimage->m_xOffsetBroken*256; @@ -255,10 +257,13 @@ void CPartyScene::render() ---------------------------------------------------------------------- */ void CPartyScene::think(int _frames) { - s_leftBobSin=(s_leftBobSin+(_frames*20))&4095; - s_rightBobSin=(s_rightBobSin+(_frames*16))&4095; - s_leftBob=(msin(s_leftBobSin)*2)>>12; - s_rightBob=(msin(s_rightBobSin)*2)>>12; + if(m_animationFlag) + { + s_leftBobSin=(s_leftBobSin+(_frames*20))&4095; + s_rightBobSin=(s_rightBobSin+(_frames*16))&4095; + s_leftBob=(msin(s_leftBobSin)*2)>>12; + s_rightBob=(msin(s_rightBobSin)*2)>>12; + } } diff --git a/source/backend/party.h b/source/backend/party.h index 0a0d3b576..c5a189df1 100644 --- a/source/backend/party.h +++ b/source/backend/party.h @@ -36,10 +36,12 @@ public: void shutdown(); void render(); void think(int _frames); + void setAnimation(int _flag) {m_animationFlag=_flag;} private: class SpriteBank *m_sprites; unsigned char *m_image; + int m_animationFlag; }; diff --git a/source/fma/fma.cpp b/source/fma/fma.cpp index 36ff2e878..19c07c789 100644 --- a/source/fma/fma.cpp +++ b/source/fma/fma.cpp @@ -210,6 +210,7 @@ typedef enum SC_SET_ACTOR_FACING, // actor,facing SC_SET_ACTOR_ANIM_STATE, // actor,state,loop SC_WALK_ACTOR_TO_POSITION, // actor,x,y,frames + SC_SET_GLOBAL_ANIMATION, // on/off SC_CREATE_FX, // FxNo, X,Y, FXType SC_KILL_FX, // FxNo @@ -1139,11 +1140,9 @@ static const int s_FMAPartyScript[]= SC_SET_ACTOR_VISIBILITY, FMA_ACTOR_SANDY,true, SC_WAIT_ON_TIMER, 60*2, - SC_WAIT_ON_CONVERSATION, SCRIPTS_FMA_PARTY_DAT, - + SC_SET_GLOBAL_ANIMATION, false, SC_WAIT_ON_TIMER, 60*10, - SC_STOP }; @@ -1228,6 +1227,8 @@ void CFmaScene::init() m_musicPlaying=false; m_tuneLoaded=false; + + m_globalAnimationFlag=true; } @@ -1405,21 +1406,24 @@ void CFmaScene::think(int _frames) } // Anim - actor->m_animFrame++; - int AnimBank=s_actorGraphicsData[i].m_anims[actor->m_animState].Bank; - int AnimNo=s_actorGraphicsData[i].m_anims[actor->m_animState].Anim; - int LastFrame=actor->m_gfx[AnimBank]->getFrameCount(AnimNo)-1; - if(actor->m_animFrame>=LastFrame) + if(m_globalAnimationFlag) { - if (actor->m_animLoop) - { // Loop anim - actor->m_animFrame=0; + actor->m_animFrame++; + int AnimBank=s_actorGraphicsData[i].m_anims[actor->m_animState].Bank; + int AnimNo=s_actorGraphicsData[i].m_anims[actor->m_animState].Anim; + int LastFrame=actor->m_gfx[AnimBank]->getFrameCount(AnimNo)-1; + if(actor->m_animFrame>=LastFrame) + { + if (actor->m_animLoop) + { // Loop anim + actor->m_animFrame=0; + } + else + { // hold on last frame + actor->m_animFrame=LastFrame; + } + } - else - { // hold on last frame - actor->m_animFrame=LastFrame; - } - } actor++; @@ -1701,6 +1705,16 @@ void CFmaScene::startNextScriptCommand() } break; + case SC_SET_GLOBAL_ANIMATION: // on/off + { + int flag; + m_pc++; + flag=*(m_pc++); + m_globalAnimationFlag=flag; + if(m_party)m_party->setAnimation(flag); + } + break; + case SC_CREATE_FX: { int FXNo; @@ -1818,6 +1832,7 @@ void CFmaScene::processCurrentScriptCommand() case SC_SET_ACTOR_FACING: // actor,facing case SC_SET_ACTOR_ANIM_STATE: // actor,state case SC_WALK_ACTOR_TO_POSITION: // actor,x,y,frames + case SC_SET_GLOBAL_ANIMATION: // on/off case SC_START: // case SC_STOP: // nextScene ASSERT(!"Shouldn't be here.."); diff --git a/source/fma/fma.h b/source/fma/fma.h index 082b64fcc..f48217822 100644 --- a/source/fma/fma.h +++ b/source/fma/fma.h @@ -94,6 +94,8 @@ private: int m_tuneLoaded; int m_musicPlaying; + int m_globalAnimationFlag; + int m_readyToShutdown; };