ScummVM API documentation
Titanic::TTnpcScript Class Reference
Inheritance diagram for Titanic::TTnpcScript:
Titanic::TTnpcScriptBase Titanic::TTscriptBase Titanic::BarbotScript Titanic::BellbotScript Titanic::DeskbotScript Titanic::DoorbotScript Titanic::LiftbotScript Titanic::MaitreDScript Titanic::ParrotScript Titanic::SuccUBusScript

Public Member Functions

 TTnpcScript (int charId, const char *charClass, int v2, const char *charName, int v3, int val2, int v4, int v5, int v6, int v7)
 
void addResponse (int id) override
 
int chooseResponse (const TTroomScript *roomScript, const TTsentence *sentence, uint tag) override
 
int process (const TTroomScript *roomScript, const TTsentence *sentence) override
 
int proc8 () const override
 
ScriptChangedResult scriptChanged (uint id) override
 
ScriptChangedResult scriptChanged (const TTroomScript *roomScript, uint id) override
 
int proc11 () const override
 
int proc12 () const override
 
virtual void selectResponse (int id)
 
virtual bool handleWord (uint id) const
 
virtual int handleQuote (const TTroomScript *roomScript, const TTsentence *sentence, uint tag1, uint tag2, uint remainder)
 
virtual bool isQuoteDialled () const
 
virtual uint getRangeValue (uint id)
 
virtual void resetRange (int id)
 
virtual int updateState (uint oldId, uint newId, int index)
 
virtual int preResponse (uint id)
 
virtual uint getDialsBitset () const
 
virtual const TTscriptMappinggetMapping (int index)
 
virtual int doSentenceEntry (int val1, const int *srcIdP, const TTroomScript *roomScript, const TTsentence *sentence)
 
virtual void postResponse (int v1, const TTsentenceEntry *entry, const TTroomScript *roomScript, const TTsentence *sentence)
 
virtual void save (SimpleFile *file)
 
virtual void load (SimpleFile *file)
 
virtual void saveBody (SimpleFile *file)
 
virtual void loadBody (SimpleFile *file)
 
virtual int getRangesCount () const
 
virtual void setDialRegion (int dialNum, int region)
 
virtual void setDial (int dialNum, int value)
 
virtual int getDialRegion (int dialNum) const
 
virtual int getDialLevel (uint dialNum, bool randomizeFlag=true)
 
virtual bool randomResponse (uint index)
 
virtual uint translateId (uint id) const
 
void preLoad ()
 
ScriptChangedResult notifyScript (TTroomScript *roomScript, int id)
 
- Public Member Functions inherited from Titanic::TTnpcScriptBase
 TTnpcScriptBase (int charId, const char *charClass, int v2, const char *charName, int v3, int val2, int v4, int v5, int v6, int v7)
 
int charId () const
 
- Public Member Functions inherited from Titanic::TTscriptBase
 TTscriptBase (int scriptId, const char *charClass, int v2, const char *charName, int v3, int v4, int v5, int v6, int v7)
 
virtual void addResponse (const TTstring &str)
 
virtual void applyResponse ()
 
bool isValid ()
 
int getId () const
 
int getStatus () const
 
const TTstring getText ()
 
int scriptPreprocess (TTsentence *sentence)
 

Static Public Member Functions

static void init ()
 
static void deinit ()
 

Protected Member Functions

void loadResponses (const char *name, int valuesPerResponse=1)
 
void loadRanges (const char *name)
 
void resetFlags ()
 
void setupDials (int dial1, int dial2, int dial3)
 
int getValue (int testNum) const
 
uint getRandomNumber (int max) const
 
uint getRandomBit () const
 
uint getDialogueId (uint tagId)
 
void addRange (uint id, const Common::Array< uint > &values, bool isRandom, bool isSequential)
 
TTscriptRangefindRange (uint id)
 
int processEntries (const TTsentenceEntries *entries, uint entryCount, const TTroomScript *roomScript, const TTsentence *sentence)
 
int processEntries (const TTroomScript *roomScript, const TTsentence *sentence)
 
bool defaultProcess (const TTroomScript *roomScript, const TTsentence *sentence)
 
void checkItems (const TTroomScript *roomScript, const TTsentence *sentence)
 
bool addRandomResponse (bool flag)
 
void updateCurrentDial (bool changeDial)
 
bool fn10 (bool flag)
 
bool getStateValue () const
 
void getAssignedRoom (int *roomNum, int *floorNum, int *elevatorNum) const
 
void setResponseFromArray (int index, int id)
 
- Protected Member Functions inherited from Titanic::TTscriptBase
void deleteResponses ()
 
void appendResponse (int index, int *maxP, int id)
 
void appendResponse (int index, int *maxP, const TTstring &str)
 
void appendResponse2 (int index, int *maxP, const TTstring &str)
 
void setState (int state)
 
int getState () const
 

Static Protected Member Functions

static int getRoom54 (int roomId)
 
static CPetControlgetPetControl (CGameManager *gameManager)
 
static bool sentence2C (const TTsentence *sentence)
 

Protected Attributes

Common::Array< TTnpcScriptResponse_responses
 
int _valuesPerResponse
 
Common::Array< TTscriptRange_ranges
 
TTscriptMappings _mappings
 
TTsentenceEntries _entries
 
TTtagMappings _tagMappings
 
TTwordEntries _words
 
TThandleQuoteEntries _quotes
 
int _entryCount
 
int _field68
 
int _field6C
 
int _rangeResetCtr
 
int _currentDialNum
 
int _dialDelta
 
int _field7C
 
const char * _itemStringP
 
int _dialValues [10]
 
TTnpcData _data
 
bool _field2CC
 
- Protected Attributes inherited from Titanic::TTnpcScriptBase
int _field54
 
int _val2
 
- Protected Attributes inherited from Titanic::TTscriptBase
TTnode_nodesP
 
TThist_hist1P
 
TTstring _charName
 
TTstring _charClass
 
int _field20
 
int _field24
 
int _field28
 
int _field2C
 
int _field30
 
int _state
 
TThist_hist2P
 
int _field3C
 
TTresponse_respTailP
 
TTresponse_respHeadP
 
TTresponse_oldResponseP
 
int _status
 

Static Protected Attributes

static TTsentenceEntries_defaultEntries
 

Additional Inherited Members

- Public Attributes inherited from Titanic::TTnpcScriptBase
int _charId
 
- Public Attributes inherited from Titanic::TTscriptBase
int _id
 

Member Function Documentation

◆ loadResponses()

void Titanic::TTnpcScript::loadResponses ( const char *  name,
int  valuesPerResponse = 1 
)
protected

Loads response data for the NPC from the given resource

◆ loadRanges()

void Titanic::TTnpcScript::loadRanges ( const char *  name)
protected

Load ranges data for the NPC from the given resource

◆ resetFlags()

void Titanic::TTnpcScript::resetFlags ( )
protected

Reset script flags

◆ setupDials()

void Titanic::TTnpcScript::setupDials ( int  dial1,
int  dial2,
int  dial3 
)
protected

Setup dials

◆ getValue()

int Titanic::TTnpcScript::getValue ( int  testNum) const
protected

Perform test on various state values

◆ getRandomNumber()

uint Titanic::TTnpcScript::getRandomNumber ( int  max) const
protected

Gets a random number between 1 and a given max

◆ getRandomBit()

uint Titanic::TTnpcScript::getRandomBit ( ) const
inlineprotected

Gets a random number of 0 or 1

◆ getDialogueId()

uint Titanic::TTnpcScript::getDialogueId ( uint  tagId)
protected

Returns a dialogue Id by script tag value Id

◆ getPetControl()

static CPetControl* Titanic::TTnpcScript::getPetControl ( CGameManager gameManager)
staticprotected

Returns a pointer to the PET control

◆ addRange()

void Titanic::TTnpcScript::addRange ( uint  id,
const Common::Array< uint > &  values,
bool  isRandom,
bool  isSequential 
)
protected

Adds a new item to the list of number ranges

◆ findRange()

TTscriptRange* Titanic::TTnpcScript::findRange ( uint  id)
protected

Finds an entry in the list of prevoiusly registered number ranges

◆ processEntries() [1/2]

int Titanic::TTnpcScript::processEntries ( const TTsentenceEntries entries,
uint  entryCount,
const TTroomScript roomScript,
const TTsentence sentence 
)
protected

Scans through a list of sentence entries for a matching standardized response

◆ processEntries() [2/2]

int Titanic::TTnpcScript::processEntries ( const TTroomScript roomScript,
const TTsentence sentence 
)
inlineprotected

Scans through a list of sentence entries for a matching standardized response

◆ addRandomResponse()

bool Titanic::TTnpcScript::addRandomResponse ( bool  flag)
protected

Adds a random conversation response

◆ updateCurrentDial()

void Titanic::TTnpcScript::updateCurrentDial ( bool  changeDial)
protected

Updates the current dial with the given delta

◆ getStateValue()

bool Titanic::TTnpcScript::getStateValue ( ) const
protected

Gets the True Talk state value

◆ getAssignedRoom()

void Titanic::TTnpcScript::getAssignedRoom ( int *  roomNum,
int *  floorNum,
int *  elevatorNum 
) const
protected

Gets the assigned room's room, floor, and elevator number

◆ setResponseFromArray()

void Titanic::TTnpcScript::setResponseFromArray ( int  index,
int  id 
)
protected

Uses a porition of the state _array to set up a new response

◆ chooseResponse()

int Titanic::TTnpcScript::chooseResponse ( const TTroomScript roomScript,
const TTsentence sentence,
uint  tag 
)
overridevirtual

Chooses and adds a conversation response based on a specified tag Id. This default implementation does a lookup into a list of known tags, and chooses a random dialogue Id from the available ones for that tag

Implements Titanic::TTnpcScriptBase.

◆ process()

int Titanic::TTnpcScript::process ( const TTroomScript roomScript,
const TTsentence sentence 
)
overridevirtual

Does NPC specific processing of the parsed sentence

Implements Titanic::TTnpcScriptBase.

◆ scriptChanged() [1/2]

ScriptChangedResult Titanic::TTnpcScript::scriptChanged ( uint  id)
inlineoverridevirtual

Called when the script/id changes

Implements Titanic::TTnpcScriptBase.

◆ scriptChanged() [2/2]

ScriptChangedResult Titanic::TTnpcScript::scriptChanged ( const TTroomScript roomScript,
uint  id 
)
inlineoverridevirtual

Called when the script/id changes

Implements Titanic::TTnpcScriptBase.

◆ selectResponse()

virtual void Titanic::TTnpcScript::selectResponse ( int  id)
virtual

Translate a passed Id to a dialogue Id if necessary, and adds it to the response

◆ handleWord()

virtual bool Titanic::TTnpcScript::handleWord ( uint  id) const
virtual

Handles scanning the word list for a given Id, and if found adds it to the sentence concept list

◆ isQuoteDialled()

virtual bool Titanic::TTnpcScript::isQuoteDialled ( ) const
inlinevirtual

Returns true if the NPC's dial region affects quote responses

Reimplemented in Titanic::DoorbotScript, and Titanic::BarbotScript.

◆ getRangeValue()

virtual uint Titanic::TTnpcScript::getRangeValue ( uint  id)
virtual

Given an Id for a previously registered set of random number values, picks one of the array values and returns it.. depending on flags, either a random value, or each value in turn

◆ resetRange()

virtual void Titanic::TTnpcScript::resetRange ( int  id)
virtual

Resets the prior used index for the specified range

◆ updateState()

virtual int Titanic::TTnpcScript::updateState ( uint  oldId,
uint  newId,
int  index 
)
virtual

Handles updating NPC state based on specified dialogue Ids and dial positions

Reimplemented in Titanic::DeskbotScript, Titanic::BellbotScript, Titanic::MaitreDScript, Titanic::DoorbotScript, Titanic::BarbotScript, Titanic::LiftbotScript, and Titanic::SuccUBusScript.

◆ preResponse()

virtual int Titanic::TTnpcScript::preResponse ( uint  id)
virtual

◆ getDialsBitset()

virtual uint Titanic::TTnpcScript::getDialsBitset ( ) const
inlinevirtual

Returns a bitset of the dials being off or not

Reimplemented in Titanic::DeskbotScript, Titanic::DoorbotScript, Titanic::BarbotScript, and Titanic::LiftbotScript.

◆ postResponse()

virtual void Titanic::TTnpcScript::postResponse ( int  v1,
const TTsentenceEntry entry,
const TTroomScript roomScript,
const TTsentence sentence 
)
inlinevirtual

Handles any post-response NPC processing

◆ getRangesCount()

virtual int Titanic::TTnpcScript::getRangesCount ( ) const
virtual

Returns the number of range records that are non-random

◆ setDialRegion()

virtual void Titanic::TTnpcScript::setDialRegion ( int  dialNum,
int  region 
)
virtual

Sets a given dial to be pointing in a specified region (0 to 2)

Reimplemented in Titanic::DoorbotScript, Titanic::BarbotScript, and Titanic::LiftbotScript.

◆ setDial()

virtual void Titanic::TTnpcScript::setDial ( int  dialNum,
int  value 
)
virtual

Sets the value for an NPC's dial

◆ getDialRegion()

virtual int Titanic::TTnpcScript::getDialRegion ( int  dialNum) const
virtual

Returns a dial's region number

◆ getDialLevel()

virtual int Titanic::TTnpcScript::getDialLevel ( uint  dialNum,
bool  randomizeFlag = true 
)
virtual

Gets the value for a dial

Parameters
dialNumDial number
randomizeFlagIf set, introduces a slight random variance so that the displayed dial will oscillate randomly around it's real level

◆ randomResponse()

virtual bool Titanic::TTnpcScript::randomResponse ( uint  index)
virtual

Handles a randomzied response

Reimplemented in Titanic::DeskbotScript, Titanic::BellbotScript, and Titanic::DoorbotScript.

◆ notifyScript()

ScriptChangedResult Titanic::TTnpcScript::notifyScript ( TTroomScript roomScript,
int  id 
)
inline

Called with the script and id changes


The documentation for this class was generated from the following file: