resonance 1.0.1
Loading...
Searching...
No Matches
metmsgscreen.h
Go to the documentation of this file.
1#pragma once
2
3#include <vector>
4
6#include "os/hxstr.h"
7
8class Message;
9class MetButtonList;
10
11namespace Rnd {
12class Text;
13class View;
14} // namespace Rnd
15
42public:
51 MetMsgScreen(MetRenderer *pRenderer, int nPriority);
52
59 virtual ~MetMsgScreen();
60
70 static MetMsgScreen *New(MetRenderer *pRenderer, int nPriority);
71
91 static void Show(const HxStr &name,
92 const HxStr &title,
93 const HxStr &text,
94 int nButtons,
95 const std::vector<HxStr> &buttons,
96 MetScreen *pOwner);
97
113 static void ShowActive(const HxStr &name,
114 const HxStr &title,
115 const HxStr &text,
116 int nButtons,
117 const std::vector<HxStr> &buttons,
118 MetScreen *pOwner);
119
131 static void SetOwnerPad(int nPad);
132
142 void SetButtons(const std::vector<HxStr> &buttons);
143
155 void Refresh();
156
166 void SetName(const HxStr &name) {
167 mName = name;
168 }
169
179 void SetTitle(const HxStr &title) {
180 mTitle = title;
181 }
182
192 void SetText(const HxStr &text) {
193 mText = text;
194 }
195
205 virtual void DispatchPriv(Message *pMsg);
206
213 virtual void EnterAndShow();
214
225 virtual void BeginExit();
226
239 virtual void HandleCommand(const MetScreenCommand *pCommand);
240
248 virtual void PlaySlideSound(int nSelector);
249
256 virtual void PlayLeaveSound(int) {
257 }
258
265 virtual void PlayHighSound(int) {
266 }
267
275 virtual void PlayCycleLeftSound(int nSelector);
276
284 virtual void PlayCycleRightSound(int nSelector);
285
296 virtual void UpdateIdle(float flTime);
297
304 virtual void OnEnterFinished();
305
314 virtual void OnExitFinished();
315
326 virtual void ResolveContainerViews();
327
328private:
329 // NTSC-U/C: 0x002f0610, PAL: 0x00313fc0
330 // Inline, and DispatchPriv() expands it. The address is its uncalled out-of-line copy.
331 void ForwardToOwner(Message *pMsg) {
332 mOwner->Dispatch(pMsg);
333 }
334
335 MetButtonList *mOneButtonList; // +0x8c
336 MetButtonList *mTwoButtonList; // +0x90
337 // Whichever list Refresh() selected by mButtonCount, or null. +0x94
338 MetButtonList *mButtonList;
339 Rnd::View *mButtonView; // +0x98, `dlg_buts.view`
340 Rnd::Text *mMessageText; // +0x9c, `dlg_message.txt`
341 Rnd::Text *mTitleText; // +0xa0, `dlg_warning.txt`
342 // The button labels Refresh() writes. +0xa4
343 std::vector<HxStr> mButtons;
344 // The dialogue name reported back to the owner. +0xb0
345 HxStr mName;
346 // The screen the dialogue reports to. +0xb8
347 MetScreen *mOwner;
348 // The number of buttons, 0, 1, or 2, which picks the layout and the button list. +0xbc
349 int mButtonCount;
350 HxStr mText; // +0xc0
351 HxStr mTitle; // +0xc8
352 // The renderer time slot 26 exits at, or zero for none. +0xd0
353 float mExitTime;
354 // The button index selected when the dialogue was answered, or -1. +0xd4
355 int mChoice;
356 // Non-zero while the dialogue is showing, which is when Show() refreshes it in place. +0xd8
357 int mShowing;
358 // The controller SetOwnerPad() records, or -1 after Show(). +0xdc
359 int mOwnerPad;
360};
Heap-allocated NUL-terminated string.
Definition hxstr.h:41
Base of every event the game passes between a MsgSource and a MsgSink.
Definition message.h:41
Ring of front-end buttons with one of them selected.
Definition metbuttonlist.h:34
void SetName(const HxStr &name)
Assign the dialogue name.
Definition metmsgscreen.h:166
void Refresh()
Rebuild the dialogue for the current name, title, text, and button count.
static void Show(const HxStr &name, const HxStr &title, const HxStr &text, int nButtons, const std::vector< HxStr > &buttons, MetScreen *pOwner)
Fill the registered message screen and bring it up.
virtual void OnExitFinished()
Mark the dialogue as gone and report the choice to the owner.
virtual ~MetMsgScreen()
Delete the two-button list and then the one-button list.
virtual void PlayHighSound(int)
Silence the high sound.
Definition metmsgscreen.h:265
virtual void PlayCycleRightSound(int nSelector)
Play the cycle-right sound when the dialogue has two buttons and accepts nSelector.
virtual void ResolveContainerViews()
Build the button lists and resolve the dialogue's text objects and button view.
void SetText(const HxStr &text)
Assign the message text.
Definition metmsgscreen.h:192
virtual void UpdateIdle(float flTime)
Exit once a scheduled exit time has passed.
virtual void PlayCycleLeftSound(int nSelector)
Play the cycle-left sound when the dialogue has two buttons and accepts nSelector.
static void ShowActive(const HxStr &name, const HxStr &title, const HxStr &text, int nButtons, const std::vector< HxStr > &buttons, MetScreen *pOwner)
Fill the registered message screen and make it the active panel.
virtual void PlaySlideSound(int nSelector)
Play the slide sound when the dialogue has buttons and accepts nSelector.
static void SetOwnerPad(int nPad)
Limit the registered message screen to one controller.
MetMsgScreen(MetRenderer *pRenderer, int nPriority)
Construct the screen.
virtual void BeginExit()
Start the exit, or schedule it for a dialogue with no buttons.
virtual void DispatchPriv(Message *pMsg)
Discard the message's type and forward the message to the owner.
static MetMsgScreen * New(MetRenderer *pRenderer, int nPriority)
Build the screen on the heap.
virtual void PlayLeaveSound(int)
Silence the leave sound.
Definition metmsgscreen.h:256
virtual void HandleCommand(const MetScreenCommand *pCommand)
Act on one navigation command.
virtual void OnEnterFinished()
Mark the dialogue as showing and tell the owner.
void SetButtons(const std::vector< HxStr > &buttons)
Replace the button labels.
void SetTitle(const HxStr &title)
Assign the title line.
Definition metmsgscreen.h:179
virtual void EnterAndShow()
Clear the showing flag, refresh the dialogue, and show the screen.
Front-end renderer that owns the screen stack and drives every MetScreen.
Definition metrenderer.h:68
MetScreenMultiSoundBank(MetRenderer *pRenderer, int nPriority, const HxStr &name, const HxStr &directory, const HxStr &file)
Construct a screen that uses the multiplayer sound bank.
Base of every front-end screen.
Definition metscreen.h:212
MetScreen(MetRenderer *pRenderer, int nPriority, const HxStr &name, const HxStr &directory, const HxStr &file)
Construct a screen and start its container load.
Run of text drawn as a quad per glyph.
Definition text.h:57
Root of a loadable scene.
Definition view.h:47
The rendering engine.
Definition animhelper.h:3
One navigation command delivered to a screen.
Definition metscreen.h:46