1#include <game/bases/d_lytbase.hpp>
2#include <game/bases/d_game_com.hpp>
3#include <game/bases/d_lyttextBox.hpp>
4#include <game/mLib/m_mtx.hpp>
5#include <game/mLib/m_video.hpp>
7#define TEXTBOX_STRING_BUFFER_SIZE 0x1FF
31 const wchar_t *buf = box->GetStringBuffer();
32 box->AllocStringBuffer(TEXTBOX_STRING_BUFFER_SIZE);
34 box->SetString(buf, 0);
38 nw4r::lyt::PaneList::Iterator it = pane->GetChildList().GetBeginIter();
39 it != pane->GetChildList().GetEndIter();
47 char resourcePath[100];
49 char nonLocalizedPath[100] =
"Layout/";
50 strncat(nonLocalizedPath, name, ARRAY_MAX_STRLEN(nonLocalizedPath));
51 dGameCom::AreaLanguageFolder(nonLocalizedPath, resourcePath);
53 memset(resourcePath, 0, ARRAY_SIZE(resourcePath));
54 strncat(resourcePath,
"Layout/", ARRAY_MAX_STRLEN(resourcePath));
55 strncat(resourcePath, name, ARRAY_MAX_STRLEN(resourcePath));
70 char resourcePath[100];
71 memset(resourcePath, 0, ARRAY_SIZE(resourcePath));
72 strncat(resourcePath,
"EU/", ARRAY_MAX_STRLEN(resourcePath));
73 strncat(resourcePath,
"Layout/", ARRAY_MAX_STRLEN(resourcePath));
74 strncat(resourcePath, name, ARRAY_MAX_STRLEN(resourcePath));
84 char resourcePath[100];
85 memset(resourcePath, 0, ARRAY_SIZE(resourcePath));
86 strncat(resourcePath,
"EU/NedEU/Layout/", ARRAY_MAX_STRLEN(resourcePath));
87 strncat(resourcePath, name, ARRAY_MAX_STRLEN(resourcePath));
97 for (
int i = 0; i < count; i++) {
103 for (
int i = 0; i < count; i++) {
109 for (
int i = 0; i < count; i++) {
115 for (
int i = 0; i < count; i++) {
121 MsgRes_c *bmg = dMessage_c::getMesRes();
122 for (
int i = 0; i < count; i++) {
124 box->
setMessage(bmg, messageGroup, messageIDs[i], 0);
132 for (
int i = 0; i < count; i++) {
141 for (
int i = 0; i < count; i++) {
147 float dummy_float = 0.5f;
150 animeGroup.mpFrameCtrl->setFrame(0.0f);
151 animeGroup.updateFrame();
161 mpAnimGroup[animeIdx].mpFrameCtrl->setFlags(
false,
false);
166 mpAnimGroup[animeIdx].mpFrameCtrl->setFlags(
true,
false);
172 mpAnimGroup[animeIdx].mpFrameCtrl->setFlags(
false,
false);
177 mpAnimGroup[animeIdx].mpFrameCtrl->setFlags(
false,
true);
223 nw4r::ut::Rect view =
mDrawInfo.GetViewRect();
229 float actualScaleY = scale.y;
230 if (actualScaleY <= 1e-6f) {
231 actualScaleY = 1e-6f;
233 float height = view.GetHeight() / actualScaleY;
235 float actualScaleX = scale.x;
236 if (actualScaleX <= 1e-6f) {
237 actualScaleX = 1e-6f;
239 float width = view.GetWidth() / actualScaleX;
248 mMtx_c paneMtx = pane->GetGlobalMtx();
250 paneSize.x = pane->GetSize().width;
251 paneSize.y = pane->GetSize().height;
253 float ratioX = mVideo::m_video->getWidth() / width;
254 float ratioY = mVideo::m_video->getHeight() / height;
256 float trueSizeX = paneMtx.m[1][1] * (paneSize.x * ratioX);
257 float trueSizeY = paneMtx.m[1][1] * (paneSize.y * ratioY);
259 float translateX = paneMtx.m[0][3] / actualScaleX;
260 float translateY = paneMtx.m[1][3] * -1.0f;
262 translateX *= ratioX;
263 translateY *= ratioY;
265 u32 scX, scY, scW, scH;
266 GXGetScissor(&scX, &scY, &scW, &scH);
267 scissorPos.x = scX + scW * 0.5f + (translateX - trueSizeX * 0.5f);
268 scissorPos.y = scY + scH * 0.5f + (translateY - trueSizeY * 0.5f);
269 scissorSize.x = trueSizeX + 0.5f;
270 scissorSize.y = trueSizeY + 0.5f;
271 scissorMask.setSize(scissorSize);
272 scissorMask.setPos(scissorPos);
273 scissorMask.mEnabled =
true;
LytTextBox_c * findTextBox(const char *name)
Finds a text box by name.
bool isAnime(int animeIdx)
Returns whether the specified animation is currently playing.
bool ReadResource3(const char *name, int allocDirection)
Reads an .arc file which contains the layout.
void AnimeResRegister(const char **animeNames, int count)
Loads animation resources given by their names.
bool ReadResourceEx(const char *name, int allocDirection, bool isLocalized)
Reads an .arc file which contains the layout.
void NPaneRegister(const char **paneNames, nw4r::lyt::Pane **panes, int count)
Finds null panes by name and registers them to the list.
bool * mpEnabledAnims
A list of the enabled animations.
void TPaneNameRegister(const char **textboxNames, const int *messageIDs, int messageGroup, int count)
Finds text boxes by name, sets their messages, and registers them to the list.
void GroupRegister(const char **groupNames, const int *animeIdxs, int count)
Registers animation groups to the layout.
void TPaneRegister(const char **textboxNames, LytTextBox_c **panes, int count)
Finds text boxes by name and registers them to the list.
static TagProcessor_c s_TagPrc
The tag processor for layouts.
void AnimePlay()
Starts playing all enabled animations.
bool ReadResource(const char *name, bool isLocalized)
Reads an .arc file which contains the layout.
int mAnimGroupCount
The number of animation groups used by the layout.
bool isAllAnime()
Returns whether any animation is currently playing.
void LoopAnimeStartSetup(int animeIdx)
Prepares a looping animation to be played.
int mAnimCount
The number of animations used by the layout.
m2d::AnmResV2_c * mpAnimRes
The animations used by the layout.
m2d::AnmGroup_c * mpAnimGroup
The animation groups used by the layout.
void WPaneRegister(const char **windowPaneNames, nw4r::lyt::Window **panes, int count)
Finds windows by name and registers them to the list.
void allocStringBuffer(nw4r::lyt::Pane *pane)
Recursively allocates string buffers for all text boxes in the layout.
void SetScissorMask(const nw4r::lyt::Pane *pane, d2d::ScissorMask &scissorMask)
void ReverseAnimeStartSetup(int animeIdx, bool startAtEnd)
Prepares a reverse animation to be played.
virtual ~LytBase_c()
Destroys the layout.
virtual bool build(const char *name, d2d::ResAccMult_c *resAcc)
Builds the layout from a binary layout file.
LytBase_c()
Constructs a new layout.
void PPaneRegister(const char **picPaneNames, nw4r::lyt::Picture **panes, int count)
Finds picture panes by name and registers them to the list.
void AllAnimeEndSetup()
Prepares all animations to be stopped.
bool ReadResource2(const char *name, int allocDirection)
Reads an .arc file which contains the layout.
bool doDelete()
Cleans up all resources used by the layout.
d2d::ResAccMultLoader_c mResAccessorLoader
The resource loader used to load the layout's resources.
void AnimeEndSetup(int animeIdx)
Prepares an animation to be stopped.
void AnimeStartBaseSetup(int animeIdx)
Base setup for starting an animation.
int mLastStartedAnimNum
The number of the most recently started animation.
void AnimeStartSetup(int animeIdx, bool startAtEnd)
Prepares an animation to be played.
A text box class with BMG message support.
void setMessage(MsgRes_c *bmg, ulong messageGroup, ulong messageID, long placeholderCount,...)
Sets the message to display in the text box.
m2d::Layout_c mLayout
The layout instance.
nw4r::lyt::Picture * findPictureByName(const char *name)
Finds a picture pane by name.
nw4r::lyt::DrawInfo mDrawInfo
The parameters for drawing the layout.
nw4r::lyt::TextBox * findTextBoxByName(const char *name)
Finds a text box pane by name.
nw4r::lyt::Pane * getRootPane()
Gets the root pane of the layout.
ResAccMult_c * mpResAccessor
The resource accessor for the layout.
nw4r::lyt::Pane * findPaneByName(const char *name)
Finds a pane by name.
virtual bool build(const char *name, ResAccMult_c *resAcc)
Builds the layout from a binary layout file.
nw4r::lyt::Window * findWindowByName(const char *name)
Finds a window pane by name.
A two-dimensional floating point vector.
Stores clipping settings for a layout.