This commit is contained in:
Paul 2001-01-22 20:57:39 +00:00
parent 69c516ecbf
commit 97a30e89cd
5 changed files with 67 additions and 72 deletions

View File

@ -41,6 +41,10 @@
#include "utils\utils.h"
#endif
#ifndef __GAME_CONVO_H__
#include "game\convo.h"
#endif
CNpc::NPC_DATA CNpc::m_data[NPC_UNIT_TYPE_MAX] =
{
@ -955,8 +959,6 @@ void CNpc::render()
void CNpc::processEvent( GAME_EVENT evt, CThing *sourceThing )
{
CConversation *currentConversation = GameScene.getConversation();
if ( m_data[this->m_type].canTalk )
{
DVECTOR sourcePos;
@ -974,9 +976,9 @@ void CNpc::processEvent( GAME_EVENT evt, CThing *sourceThing )
if ( xDiffSqr + yDiffSqr < 250 )
{
if( !currentConversation->isActive() )
if( !CConversation::isActive() )
{
currentConversation->trigger( SCRIPTS_SPEECHTEST_DAT );
CConversation::trigger( SCRIPTS_SPEECHTEST_DAT );
}
}
}

View File

@ -99,6 +99,10 @@ CConversation::CHAR_ICON_FRAMES CConversation::s_characterIconFrames[]=
class CGUIGroupFrame *CConversation::s_guiFrame=NULL;
class CGUISprite *CConversation::s_guiIcon=NULL;
class CGUITextBox *CConversation::s_guiText=NULL;
class FontBank *CConversation::s_fontBank=NULL;
class CScript *CConversation::s_currentScript=NULL;
int CConversation::s_currentState=STATE_INACTIVE;
int CConversation::s_currentCharacterId=-1;
int CConversation::s_currentTextId=-1;
@ -133,11 +137,11 @@ void CConversation::init()
s_guiText->setObjectXYWH(FRAME_HEIGHT,TEXT_BORDER,FRAME_WIDTH-FRAME_HEIGHT-TEXT_BORDER,FRAME_HEIGHT-(TEXT_BORDER*2));
s_guiText->setOt(OT_POS);
m_fontBank=new ("Conversation Font") FontBank();
m_fontBank->initialise(&standardFont);
m_fontBank->setOt(0);
s_fontBank=new ("Conversation Font") FontBank();
s_fontBank->initialise(&standardFont);
s_fontBank->setOt(0);
m_currentState=STATE_INACTIVE;
s_currentState=STATE_INACTIVE;
}
@ -163,19 +167,19 @@ void CConversation::think(int _frames)
{
if(isActive())
{
if(m_currentState==STATE_JUST_ACTIVATED)
if(s_currentState==STATE_JUST_ACTIVATED)
{
m_currentState=STATE_ACTIVE;
s_currentState=STATE_ACTIVE;
}
s_guiFrame->think(_frames);
thinkQuestion();
m_currentScript->run();
if(m_currentScript->isFinished())
s_currentScript->run();
if(s_currentScript->isFinished())
{
m_currentState=STATE_INACTIVE;
s_currentState=STATE_INACTIVE;
}
}
}
@ -189,7 +193,7 @@ void CConversation::think(int _frames)
---------------------------------------------------------------------- */
void CConversation::render()
{
if(m_currentState==STATE_ACTIVE)
if(s_currentState==STATE_ACTIVE)
{
renderQuestion();
s_guiFrame->render();
@ -219,10 +223,10 @@ void CConversation::trigger(FileEquate _feScript)
{
ASSERT(!isActive());
m_currentScript=new ("script") CScript();
m_currentScript->initialise(_feScript);
s_currentScript=new ("script") CScript();
s_currentScript->initialise(_feScript);
m_currentState=STATE_JUST_ACTIVATED;
s_currentState=STATE_JUST_ACTIVATED;
}
@ -234,7 +238,7 @@ void CConversation::trigger(FileEquate _feScript)
---------------------------------------------------------------------- */
int CConversation::isActive()
{
return m_currentState!=STATE_INACTIVE;
return s_currentState!=STATE_INACTIVE;
}
@ -324,15 +328,15 @@ void CConversation::renderQuestion()
int xbase,y;
xbase=(512-FRAME_WIDTH)/2;
y=256-FRAME_BOTTOM_OFFSET-(TEXT_BORDER/2)-(m_fontBank->getCharHeight()/2);
y=256-FRAME_BOTTOM_OFFSET-(TEXT_BORDER/2)-(s_fontBank->getCharHeight()/2);
switch(s_currentQuestion)
{
case QUESTION_OK:
{
m_fontBank->setColour(SELECT_TEXT_R,SELECT_TEXT_G,SELECT_TEXT_B);
m_fontBank->setJustification(FontBank::JUST_RIGHT);
m_fontBank->print(xbase+FRAME_WIDTH-TEXT_BORDER,y,STR__OK);
s_fontBank->setColour(SELECT_TEXT_R,SELECT_TEXT_G,SELECT_TEXT_B);
s_fontBank->setJustification(FontBank::JUST_RIGHT);
s_fontBank->print(xbase+FRAME_WIDTH-TEXT_BORDER,y,STR__OK);
}
break;
@ -340,25 +344,25 @@ void CConversation::renderQuestion()
{
if(s_currentSelectedAnswer==0)
{
m_fontBank->setColour(SELECT_TEXT_R,SELECT_TEXT_G,SELECT_TEXT_B);
s_fontBank->setColour(SELECT_TEXT_R,SELECT_TEXT_G,SELECT_TEXT_B);
}
else
{
m_fontBank->setColour(UNSELECT_TEXT_R,UNSELECT_TEXT_G,UNSELECT_TEXT_B);
s_fontBank->setColour(UNSELECT_TEXT_R,UNSELECT_TEXT_G,UNSELECT_TEXT_B);
}
m_fontBank->setJustification(FontBank::JUST_LEFT);
m_fontBank->print(xbase+FRAME_HEIGHT,y,STR__YES);
s_fontBank->setJustification(FontBank::JUST_LEFT);
s_fontBank->print(xbase+FRAME_HEIGHT,y,STR__YES);
if(s_currentSelectedAnswer==1)
{
m_fontBank->setColour(SELECT_TEXT_R,SELECT_TEXT_G,SELECT_TEXT_B);
s_fontBank->setColour(SELECT_TEXT_R,SELECT_TEXT_G,SELECT_TEXT_B);
}
else
{
m_fontBank->setColour(UNSELECT_TEXT_R,UNSELECT_TEXT_G,UNSELECT_TEXT_B);
s_fontBank->setColour(UNSELECT_TEXT_R,UNSELECT_TEXT_G,UNSELECT_TEXT_B);
}
m_fontBank->setJustification(FontBank::JUST_RIGHT);
m_fontBank->print(xbase+FRAME_WIDTH-TEXT_BORDER,y,STR__NO);
s_fontBank->setJustification(FontBank::JUST_RIGHT);
s_fontBank->print(xbase+FRAME_WIDTH-TEXT_BORDER,y,STR__NO);
}
break;

View File

@ -37,16 +37,16 @@
class CConversation
{
public:
void init();
void shutdown();
static void init();
static void shutdown();
void think(int _frames);
void render();
static void think(int _frames);
static void render();
void registerConversationScript(FileEquate _feScript);
static void registerConversationScript(FileEquate _feScript);
void trigger(FileEquate _feScript);
int isActive();
static void trigger(FileEquate _feScript);
static int isActive();
static void setCharacterAndText(int _characterId,int _textId);
static void setResponseOptions(int _responseOptions);
@ -114,28 +114,25 @@ private:
};
void thinkQuestion();
void renderQuestion();
static void thinkQuestion();
static void renderQuestion();
// PKG - These don't need to be static..
// Make the sprites/text readouts maybe?
static class CGUIGroupFrame *s_guiFrame;
static class CGUISprite *s_guiIcon;
static class CGUITextBox *s_guiText;
static class FontBank *s_fontBank;
class FontBank *m_fontBank;
static CHAR_ICON_FRAMES s_characterIconFrames[MAX_CHARS];
static CHAR_ICON_FRAMES s_characterIconFrames[MAX_CHARS];
static class CScript *s_currentScript;
static int s_currentState;
class CScript *m_currentScript;
int m_currentState;
static int s_currentCharacterId;
static int s_currentTextId;
static int s_currentQuestion;
static int s_currentAnswer;
static int s_currentSelectedAnswer;
static int s_currentCharacterId;
static int s_currentTextId;
static int s_currentQuestion;
static int s_currentAnswer;
static int s_currentSelectedAnswer;
};

View File

@ -14,6 +14,10 @@
#include "gfx\font.h"
#include "gfx\fdata.h"
#ifndef __GAME_CONVO_H__
#include "game\convo.h"
#endif
#ifndef __PLAYER_PLAYER_H__
#include "player\player.h"
#endif
@ -64,7 +68,7 @@ void CGameScene::init()
s_genericFont->initialise( &standardFont );
s_genericFont->setColour( 255, 255 , 0 );
VidSetClearScreen(1);
m_conversation.init();
CConversation::init();
Level.init();
C2dEnemy *enemy;
@ -98,7 +102,7 @@ void CGameScene::shutdown()
CThing::shutdownAndDeleteAllThings();
Level.shutdown();
m_conversation.shutdown();
CConversation::shutdown();
s_genericFont->dump(); delete s_genericFont;
}
@ -107,7 +111,7 @@ void CGameScene::render()
{
CamMtx.t[2]=ZPos; // Temp
m_conversation.render();
CConversation::render();
CThing::renderAllThings();
Level.render();
}
@ -116,14 +120,14 @@ void CGameScene::render()
void CGameScene::think(int _frames)
{
#ifdef __USER_paul__
if(!m_conversation.isActive()&&PadGetDown(0)&PAD_START)
if(!CConversation::isActive()&&PadGetDown(0)&PAD_START)
{
m_conversation.trigger(SCRIPTS_SPEECHTEST_DAT);
CConversation::trigger(SCRIPTS_SPEECHTEST_DAT);
}
#endif
m_conversation.think(_frames);
if(!m_conversation.isActive())
CConversation::think(_frames);
if(!CConversation::isActive())
{
CThing::thinkAllThings(_frames);
Level.setCameraCentre(m_player->getPos());
@ -150,9 +154,3 @@ void CGameScene::sendEvent( GAME_EVENT evt, CThing *sourceThing )
}
/*****************************************************************************/
CConversation * CGameScene::getConversation ()
{
return( &m_conversation );
}
/*****************************************************************************/

View File

@ -8,10 +8,6 @@
#include "system\gstate.h"
#include "level\level.h"
#ifndef __GAME_CONVO_H__
#include "game\convo.h"
#endif
#ifndef __GAME_EVENT_H__
#include "game\event.h"
#endif
@ -39,16 +35,14 @@ virtual ~CGameScene() {;}
static MATRIX *GetCamMtx() {return(&CamMtx);}
class CPlayer *getPlayer();
CConversation *getConversation();
void sendEvent( GAME_EVENT evt, CThing *sourceThing );
private:
CLevel Level;
class CPlayer *m_player;
CConversation m_conversation;
static FontBank *s_genericFont;
static MATRIX CamMtx;
static FontBank *s_genericFont;
static MATRIX CamMtx;
//static class SpriteBank *s_sprites; <-- Was causing compile error, sorry
};