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;
CSoundMediator::setSong(CSoundMediator::SONG_PARTY);
m_animationFlag=true;
}
@ -227,7 +229,7 @@ void CPartyScene::render()
for(i=0;i<numimages;i++)
{
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;
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;
}
}

View File

@ -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;
};

View File

@ -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..");

View File

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