This commit is contained in:
Paul 2001-07-05 23:16:09 +00:00
parent 3bd5406960
commit 35e3ba4086
4 changed files with 45 additions and 21 deletions

View file

@ -102,6 +102,8 @@ void CPartyScene::init()
s_leftBobSin=s_leftBob=s_rightBobSin=s_rightBob=0; s_leftBobSin=s_leftBob=s_rightBobSin=s_rightBob=0;
CSoundMediator::setSong(CSoundMediator::SONG_PARTY); CSoundMediator::setSong(CSoundMediator::SONG_PARTY);
m_animationFlag=true;
} }
@ -227,7 +229,7 @@ void CPartyScene::render()
for(i=0;i<numimages;i++) for(i=0;i<numimages;i++)
{ {
ASSERT(pimage->m_fh<=FRM_TABLESIDE3); ASSERT(pimage->m_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; int x,y;
x=pimage->m_xOffsetBroken*256; x=pimage->m_xOffsetBroken*256;
@ -255,10 +257,13 @@ void CPartyScene::render()
---------------------------------------------------------------------- */ ---------------------------------------------------------------------- */
void CPartyScene::think(int _frames) void CPartyScene::think(int _frames)
{ {
s_leftBobSin=(s_leftBobSin+(_frames*20))&4095; if(m_animationFlag)
s_rightBobSin=(s_rightBobSin+(_frames*16))&4095; {
s_leftBob=(msin(s_leftBobSin)*2)>>12; s_leftBobSin=(s_leftBobSin+(_frames*20))&4095;
s_rightBob=(msin(s_rightBobSin)*2)>>12; s_rightBobSin=(s_rightBobSin+(_frames*16))&4095;
s_leftBob=(msin(s_leftBobSin)*2)>>12;
s_rightBob=(msin(s_rightBobSin)*2)>>12;
}
} }

View file

@ -36,10 +36,12 @@ public:
void shutdown(); void shutdown();
void render(); void render();
void think(int _frames); void think(int _frames);
void setAnimation(int _flag) {m_animationFlag=_flag;}
private: private:
class SpriteBank *m_sprites; class SpriteBank *m_sprites;
unsigned char *m_image; unsigned char *m_image;
int m_animationFlag;
}; };

View file

@ -210,6 +210,7 @@ typedef enum
SC_SET_ACTOR_FACING, // actor,facing SC_SET_ACTOR_FACING, // actor,facing
SC_SET_ACTOR_ANIM_STATE, // actor,state,loop SC_SET_ACTOR_ANIM_STATE, // actor,state,loop
SC_WALK_ACTOR_TO_POSITION, // actor,x,y,frames SC_WALK_ACTOR_TO_POSITION, // actor,x,y,frames
SC_SET_GLOBAL_ANIMATION, // on/off
SC_CREATE_FX, // FxNo, X,Y, FXType SC_CREATE_FX, // FxNo, X,Y, FXType
SC_KILL_FX, // FxNo SC_KILL_FX, // FxNo
@ -1139,11 +1140,9 @@ static const int s_FMAPartyScript[]=
SC_SET_ACTOR_VISIBILITY, FMA_ACTOR_SANDY,true, SC_SET_ACTOR_VISIBILITY, FMA_ACTOR_SANDY,true,
SC_WAIT_ON_TIMER, 60*2, SC_WAIT_ON_TIMER, 60*2,
SC_WAIT_ON_CONVERSATION, SCRIPTS_FMA_PARTY_DAT, SC_WAIT_ON_CONVERSATION, SCRIPTS_FMA_PARTY_DAT,
SC_SET_GLOBAL_ANIMATION, false,
SC_WAIT_ON_TIMER, 60*10, SC_WAIT_ON_TIMER, 60*10,
SC_STOP SC_STOP
}; };
@ -1228,6 +1227,8 @@ void CFmaScene::init()
m_musicPlaying=false; m_musicPlaying=false;
m_tuneLoaded=false; m_tuneLoaded=false;
m_globalAnimationFlag=true;
} }
@ -1405,21 +1406,24 @@ void CFmaScene::think(int _frames)
} }
// Anim // Anim
actor->m_animFrame++; if(m_globalAnimationFlag)
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) actor->m_animFrame++;
{ // Loop anim int AnimBank=s_actorGraphicsData[i].m_anims[actor->m_animState].Bank;
actor->m_animFrame=0; 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++; actor++;
@ -1701,6 +1705,16 @@ void CFmaScene::startNextScriptCommand()
} }
break; 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: case SC_CREATE_FX:
{ {
int FXNo; int FXNo;
@ -1818,6 +1832,7 @@ void CFmaScene::processCurrentScriptCommand()
case SC_SET_ACTOR_FACING: // actor,facing case SC_SET_ACTOR_FACING: // actor,facing
case SC_SET_ACTOR_ANIM_STATE: // actor,state case SC_SET_ACTOR_ANIM_STATE: // actor,state
case SC_WALK_ACTOR_TO_POSITION: // actor,x,y,frames case SC_WALK_ACTOR_TO_POSITION: // actor,x,y,frames
case SC_SET_GLOBAL_ANIMATION: // on/off
case SC_START: // case SC_START: //
case SC_STOP: // nextScene case SC_STOP: // nextScene
ASSERT(!"Shouldn't be here.."); ASSERT(!"Shouldn't be here..");

View file

@ -94,6 +94,8 @@ private:
int m_tuneLoaded; int m_tuneLoaded;
int m_musicPlaying; int m_musicPlaying;
int m_globalAnimationFlag;
int m_readyToShutdown; int m_readyToShutdown;
}; };