SBSPSS/source/friend/fsquid.cpp

91 lines
1.8 KiB
C++
Raw Normal View History

2001-05-01 20:30:55 +02:00
/*=========================================================================
fsquid.cpp
Author: CRB
Created:
Project: Spongebob
Purpose:
Copyright (c) 2000 Climax Development Ltd
===========================================================================*/
#ifndef __FRIEND_FSQUID_H__
#include "friend\fsquid.h"
#endif
#ifndef __UTILS_HEADER__
#include "utils\utils.h"
#endif
2001-05-03 00:49:59 +02:00
#ifndef __GAME_CONVO_H__
#include "game\convo.h"
#endif
2001-05-01 20:30:55 +02:00
#ifndef __ANIM_SQUIDWARD_HEADER__
#include <ACTOR_SQUIDWARD_Anim.h>
#endif
2001-05-03 00:49:59 +02:00
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcSquidwardFriend::postInit()
{
m_conversation = SCRIPTS_CH1L1_01_DAT;
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2001-05-01 20:30:55 +02:00
void CNpcSquidwardFriend::think( int _frames )
{
CNpcThing::think(_frames);
if ( m_animPlaying )
{
s32 frameCount;
frameCount = m_actorGfx->getFrameCount( m_animNo );
s32 frameShift = ( _frames << 8 ) >> 1;
if ( ( frameCount << 8 ) - m_frame > frameShift )
{
m_frame += frameShift;
}
else
{
m_frame = ( frameCount - 1 ) << 8;
m_animPlaying = false;
}
}
else
{
if ( m_animNo != m_data[m_type].idleAnim )
{
m_animNo = m_data[m_type].idleAnim;
}
else
{
m_animNo = getRnd() % NUM_ANIM_SQUIDWARD;
}
m_animPlaying = true;
m_frame = 0;
}
2001-05-03 00:49:59 +02:00
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcSquidwardFriend::startConderversation()
{
2001-05-03 15:11:45 +02:00
if( !CConversation::isActive() )
2001-05-03 00:49:59 +02:00
{
2001-05-03 15:11:45 +02:00
CConversation::trigger( m_conversation );
2001-05-03 00:49:59 +02:00
2001-05-03 15:11:45 +02:00
if ( m_conversation == SCRIPTS_CH1L1_01_DAT )
{
m_conversation = SCRIPTS_CH1L1_02_DAT;
2001-05-03 00:49:59 +02:00
}
}
2001-05-01 20:30:55 +02:00
}