wavelength 1.0.0
Loading...
Searching...
No Matches
ChatPanel Class Reference

Panel that shows the chat of an online lobby or launchpad and sends the lines the player types. More...

#include <chatpanel.h>

Inheritance diagram for ChatPanel:
Collaboration diagram for ChatPanel:

Public Types

enum  ChatType { kChatLobby = 1 , kChatLaunchpad = 2 }
 The chat channels of the chat_type setting. More...
Public Types inherited from UIPanel
enum  State { kStateShown = 0 , kStateHidden = 1 , kStateEntering = 2 , kStateExiting = 3 }
 Where the panel is in its entry and exit, the values of mState. More...

Public Member Functions

 ~ChatPanel () override=default
 Destroy the object.
 ChatPanel (DataArray *pData, const char *pszDir)
 Construct the panel from its script description and register it for the chat of its channel.
bool DispatchPriv (Message *pMsg) override
 Route the chat, the controller, and a completed entry to their handlers.
void Unload () override
 Release the cloned rows once the last reference to the panel's file is released.
void Enter (bool bForce, float fTime) override
 Fit the entry after the player's name, show the lines, and send a line typed on the front-end keyboard.
void Exit (bool bForce, float fTime) override
 Clear the rows and stop the entry.
void FinishLoad () override
 Find the first row and clone the others.
virtual void ShowLine (const char *pszSender, const char *pszText, int nPlayer)
 Show a line at the current row and advance the row past it.
int ReceiveKeyboardText (const char *pszText) override
 Retain the text typed on the front-end keyboard for Enter() to send.
bool HandleTextEntryComplete (UITextEntryCompleteMsg *pMsg)
 Send the text typed into the chat entry, and clear the entry once the line is sent.
bool HandleChat (ChatMsg *pMsg)
 Append a line of chat, dropping the oldest line beyond the row count.
bool HandleJoypad (JoypadInputMsg *pMsg)
 Open the front-end keyboard for the chat when circle goes down.
void Refresh ()
 Show the newest lines that fit in the rows, oldest first.
RndText * CloneText (int nRow, RndText *pTemplate)
 Clone a text of the first row for a further row, under the prefix t_<row>_.
void ClearMessages ()
 Forget every line shown.
Public Member Functions inherited from FreqPanel
 FreqPanel (DataArray *pData, const char *pszDir)
 Construct a panel from its script description.
 ~FreqPanel () override
 Destroy the panel.
void Unload () override
 Drop a reference to the panel's file, forgetting the meshes and the animation on the last reference.
void Enter (bool bForce, float fTime) override
 Start the entry animation and the entry of the panel material animation.
void Exit (bool bForce, float fTime) override
 Start the exit animation and the exit of the panel material animation.
void DrawGizmo () override
 Stretch the gizmo pyramid from the background mesh to the gizmo and draw it.
void Poll (float fTime) override
 Advance the panel to a time and move the panel animation to the panel's frame.
void Draw () override
 Move the panel material animations to the front-end time and draw the panel.
void SetShowing (bool bShowing) override
 Show or hide the panel's view and the gizmo pyramid.
void SetFocus (UIComponent *pComponent, int nButton) override
 Move the focus to a component and play the sound of the directional button that moved it.
void FinishLoad () override
 Find the meshes and animations of the panel once its file has loaded.
void ShowGizmoMesh (bool bShowing)
 Show or hide the gizmo pyramid.
void UpdateBgBox ()
 Measure the background mesh into mBgBox.
Public Member Functions inherited from UIPanel
 UIPanel (DataArray *pData, const char *pszDir)
 Construct a hidden panel from its script description.
 ~UIPanel () override
 Destroy the panel, its components, and the objects its file loaded.
bool Dispatch (Message *pMsg) override
 Offer a message to the current screen, the panel, the navigator, and the component with the focus.
bool DispatchPriv (Message *pMsg) override
 Handle a message sent to the panel.
virtual void Load ()
 Take a reference to the panel's file, queueing the file on the first reference.
virtual void Focus ()
 React to the screen giving the panel the focus by letting the navigator move the focus.
virtual void Unfocus ()
 React to the screen taking the focus away.
bool IsLoaded ()
 Report whether the panel's file has loaded, finishing the load when it has.
void AddComponent (UIComponent *pComponent)
 Register a component under its name.
void SetTextsShowing (bool bShowing)
 Show or hide every text object of the panel's file.
float ComputeFrame (float fTime)
 Report the frame of the entry and exit animation at a time.
UIComponent * FindComponent (const char *pszName, bool bFail)
 Find a component by name.
void LocalizeTexts (const char *pszFile, std::list< RndObject * > &objects)
 Collect and localise the text objects of the panel's file.
const char * GetName () const
UIComponent * GetFocus () const
int GetState () const
float GetTransitionStart () const
const std::map< const char *, std::unique_ptr< UIComponent >, StrLess > & GetComponents () const
Public Member Functions inherited from MsgSink
void * operator new (size_t nSize)
 Allocate a sink from the pool heaps under the tag "MsgSink".
void operator delete (void *pBlock)
 Return a sink to the pool heaps.
virtual ~MsgSink ()
void * operator new (size_t size)
 Allocate from the main heap under the name MsgSink.
void operator delete (void *mem)
 Return memory to its heap.
virtual ~MsgSink ()
 Destroy the sink.
Public Member Functions inherited from KeyboardUser
virtual ~KeyboardUser ()
 Destroy the mix-in.

Static Public Member Functions

static UIPanel * New (DataArray *pData, const char *pszDir)
 Create a panel from its script description.
Static Public Member Functions inherited from FreqPanel
static UIPanel * New (DataArray *pData, const char *pszDir)
 Create a panel from its script description.
static void Init (DataArray *pConfig)
 Read the freq_panel section of the metagame configuration.
Static Public Member Functions inherited from UIPanel
static void Init (DataArray *pConfig)
 Read the default frames of the entry and exit animation.
static UIPanel * New (DataArray *pData, const char *pszDir)
 Create a panel from its script description.

Additional Inherited Members

Public Attributes inherited from FreqPanel
Box mBgBox
Static Public Attributes inherited from FreqPanel
static constexpr int kNumGizmoOffsets = 3
 The number of gizmo offsets the configuration provides.
static Vector3 sGizmoOrigPos
 The position of the gizmo, the panel_gizmo_orig_pos setting.
static Vector3 sGizmoOffsets [kNumGizmoOffsets]
 The points of the gizmo the pyramids reach, the panel_gizmo_offset_1 to _3 settings.
Protected Attributes inherited from UIPanel
float mFrame
float mIdleFrame
const char * mName
String mFile
int mState
RndView * mView
const char * mFocusName
float mLoopStart
RndAnimatable * mLoopAnim
RndAnimatable * mEnterExitAnim
float mTransitionStart
float mShownFrame
float mHiddenFrame
float mEnterMs
float mExitMs
int mEnterReversed
int mExitReversed
float mEnterStartFrame
float mExitStartFrame
int mLoadRefs
int mLoaded
DataArray * mData
std::list< RndText * > mTexts
std::map< const char *, std::unique_ptr< UIComponent >, StrLess > mComponents
std::unique_ptr< UINavigator > mNavigator
UIComponent * mFocus
RndLoader * mLoader
std::unique_ptr< RndLoader > mOwnedLoader
 The loader the panel created, or null when it has none or uses a shared one.

Detailed Description

Panel that shows the chat of an online lobby or launchpad and sends the lines the player types.

The RTTI records the class as deriving from FreqPanel and KeyboardUser, with KeyboardUser at +0xe0. The vtables are at 0x003cff40 and 0x003cff20. The destructor at 0x00361238 (PAL 0x003cf750) is compiler-generated.

The description provides chat_type, num_chat_lines, and spacing. The panel's file provides the first row, the texts <panel>_username01.txt and <panel>_message01.txt, and FinishLoad() clones one more row for each further line, spacing units lower each time. A line whose text wraps takes the rows below it.

Member Enumeration Documentation

◆ ChatType

The chat channels of the chat_type setting.

Enumerator
kChatLobby 

lobby, the chat of the online lobby.

kChatLaunchpad 

launchpad, the chat of a launchpad.

Constructor & Destructor Documentation

◆ ~ChatPanel()

ChatPanel::~ChatPanel ( )
overridedefault

Destroy the object.

Ghidra address:
NTSC-U/C: 0x00361238
Ghidra address:
PAL: 0x003cf750

◆ ChatPanel()

ChatPanel::ChatPanel ( DataArray * pData,
const char * pszDir )

Construct the panel from its script description and register it for the chat of its channel.

A chat_type other than lobby or launchpad leaves mChatType unset.

Parameters
pDataThe script description.
pszDirThe directory of the description file.
Ghidra address:
NTSC-U/C: 0x001a2a78
Ghidra address:
PAL: 0x001aa758

Member Function Documentation

◆ New()

UIPanel * ChatPanel::New ( DataArray * pData,
const char * pszDir )
inlinestatic

Create a panel from its script description.

Metagame::RegisterScreenClasses() registers the routine for the entry type chat_panel.

Parameters
pDataThe script description.
pszDirThe directory of the description file.
Returns
The new panel.
Ghidra address:
NTSC-U/C: 0x003614e8
Ghidra address:
PAL: 0x003cfa00

◆ DispatchPriv()

bool ChatPanel::DispatchPriv ( Message * pMsg)
overridevirtual

Route the chat, the controller, and a completed entry to their handlers.

Parameters
pMsgThe message.
Returns
Whether the message was handled.
Ghidra address:
NTSC-U/C: 0x001a3b50
Ghidra address:
PAL: 0x001ab830

Implements MsgSink.

◆ Unload()

void ChatPanel::Unload ( )
overridevirtual

Release the cloned rows once the last reference to the panel's file is released.

Ghidra address:
NTSC-U/C: 0x001a2c40
Ghidra address:
PAL: 0x001aa920

Reimplemented from UIPanel.

◆ Enter()

void ChatPanel::Enter ( bool bForce,
float fTime )
overridevirtual

Fit the entry after the player's name, show the lines, and send a line typed on the front-end keyboard.

A line that cannot be sent goes back into the entry.

Parameters
bForceWhether to enter even when the panel already shows.
fTimeThe time of the entry.
Ghidra address:
NTSC-U/C: 0x001a3848
Ghidra address:
PAL: 0x001ab528

Reimplemented from UIPanel.

◆ Exit()

void ChatPanel::Exit ( bool bForce,
float fTime )
overridevirtual

Clear the rows and stop the entry.

Parameters
bForceWhether to exit even when the panel is already hidden.
fTimeThe time of the exit.
Ghidra address:
NTSC-U/C: 0x001a3a10
Ghidra address:
PAL: 0x001ab6f0

Reimplemented from UIPanel.

◆ FinishLoad()

void ChatPanel::FinishLoad ( )
overridevirtual

Find the first row and clone the others.

Ghidra address:
NTSC-U/C: 0x001a2ec0
Ghidra address:
PAL: 0x001aaba0

Reimplemented from UIPanel.

◆ ShowLine()

virtual void ChatPanel::ShowLine ( const char * pszSender,
const char * pszText,
int nPlayer )
virtual

Show a line at the current row and advance the row past it.

In a launchpad, the name takes the colour of the sender. The text wraps to the width that the name leaves.

Parameters
pszSenderThe sender's name, or an empty text for none.
pszTextThe text.
nPlayerThe sender's identifier in the session.
Ghidra address:
NTSC-U/C: 0x001a4378
Ghidra address:
PAL: 0x001ac068

◆ ReceiveKeyboardText()

int ChatPanel::ReceiveKeyboardText ( const char * pszText)
overridevirtual

Retain the text typed on the front-end keyboard for Enter() to send.

Parameters
pszTextThe text.
Returns
1, for the keyboard to return to the screen that opened it.
Ghidra address:
NTSC-U/C: 0x001a3b30
Ghidra address:
PAL: 0x001ab810

Implements KeyboardUser.

◆ HandleTextEntryComplete()

bool ChatPanel::HandleTextEntryComplete ( UITextEntryCompleteMsg * pMsg)

Send the text typed into the chat entry, and clear the entry once the line is sent.

Parameters
pMsgThe message.
Returns
False.
Ghidra address:
NTSC-U/C: 0x001a42e8
Ghidra address:
PAL: 0x001abfd8

◆ HandleChat()

bool ChatPanel::HandleChat ( ChatMsg * pMsg)

Append a line of chat, dropping the oldest line beyond the row count.

Parameters
pMsgThe line.
Returns
False.
Ghidra address:
NTSC-U/C: 0x001a3c00
Ghidra address:
PAL: 0x001ab8e0

◆ HandleJoypad()

bool ChatPanel::HandleJoypad ( JoypadInputMsg * pMsg)

Open the front-end keyboard for the chat when circle goes down.

The keyboard returns to the screen of the lobby or the launchpad.

Parameters
pMsgThe message.
Returns
False.
Ghidra address:
NTSC-U/C: 0x001a4160
Ghidra address:
PAL: 0x001abe40

◆ Refresh()

void ChatPanel::Refresh ( )

Show the newest lines that fit in the rows, oldest first.

Ghidra address:
NTSC-U/C: 0x001a3df0
Ghidra address:
PAL: 0x001abad0

◆ CloneText()

RndText * ChatPanel::CloneText ( int nRow,
RndText * pTemplate )

Clone a text of the first row for a further row, under the prefix t_<row>_.

The name is inferred.

Parameters
nRowThe row, from 1.
pTemplateThe text of the first row.
Returns
The clone, or null.
Ghidra address:
NTSC-U/C: 0x001a2db0
Ghidra address:
PAL: 0x001aaa90

◆ ClearMessages()

void ChatPanel::ClearMessages ( )
inline

Forget every line shown.


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