Decompile 2 functions in Source/UI/Window/UINormalMB.cpp, Source/UI/Window/UINormalMB.h, ...
Batch #4883 by youko: 0 byte-identical, 2 confirmed by peer review. - fn_12880 UINormalMB::Create: logic confirmed by peer review - fn_12881 UIQuestDisplay::Create: logic confirmed by peer review Peer-reviewed-by: eAthena, alisonrag, gordaoprogramas Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes).
This commit is contained in:
parent
9823c4a3b4
commit
805dfefac4
4 changed files with 90 additions and 2 deletions
|
|
@ -19,6 +19,12 @@ struct PACKET_CZ_ACTIVE_QUEST {
|
|||
};
|
||||
#pragma pack(pop)
|
||||
|
||||
// OFFSET: 0x00948D10
|
||||
// FUNCTION: fn_12881
|
||||
void UIQuestDisplay::Create(int width, int height) {
|
||||
this->SetSize(width, height);
|
||||
}
|
||||
|
||||
// OFFSET: 0x0094F1D0
|
||||
// FUNCTION: fn_12934
|
||||
void UIQuestDisplay::Slot33(int x, int y) {
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ public:
|
|||
void Slot11() override;
|
||||
void Slot33(int x, int y) override;
|
||||
int SendMsg(UIWindow* sender, int message, std::intptr_t argument1, std::intptr_t argument2, std::intptr_t argument3, std::intptr_t argument4) override;
|
||||
void Create(int width, int height);
|
||||
|
||||
protected:
|
||||
/* 0080 */ int m_selectedIndex;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,15 @@
|
|||
#include "UI/Window/UINormalMB.h"
|
||||
#include "Contents/MessageTable.h"
|
||||
#include "Render/Renderer.h"
|
||||
#include "Resource/ResourceMgr.h"
|
||||
#include "Resource/SkinPalette.h"
|
||||
#include "UI/Buttons/UIBitmapButton.h"
|
||||
#include "UI/Text/UITextViewer.h"
|
||||
#include "UI/UIStaticBitmap.h"
|
||||
#include "UI/Window/UIWindowMgr.h"
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
// OFFSET: 0x00946C00
|
||||
// FUNCTION: fn_12851
|
||||
UINormalMB::UINormalMB(UIWindowContext& windows, UIFrameContext& frames) : UIFrameWnd(windows, frames, 0), m_owner(nullptr), m_viewer(nullptr) {
|
||||
|
|
@ -42,3 +50,70 @@ int UINormalMB::SendMsg(UIWindow* sender, int message, std::intptr_t a, std::int
|
|||
return this->UIFrameWnd::SendMsg(sender, message, a, b, c, d);
|
||||
}
|
||||
}
|
||||
|
||||
// INLINED
|
||||
__forceinline void UINormalMB::AddButton(const char* normal, const char* hover, const char* pressed, int x, int y, int id) {
|
||||
auto* button = new UIBitmapButton(*this->m_context, this->m_textContext->buttons);
|
||||
button->SetBitmap(normal, 0, 0);
|
||||
button->SetBitmap(hover, 1, 0);
|
||||
button->SetBitmap(pressed, 2, 0);
|
||||
button->SetSize(button->BitmapWidth(), button->BitmapHeight());
|
||||
button->Move(x, y);
|
||||
button->SetId(id);
|
||||
this->AddChild(button);
|
||||
}
|
||||
|
||||
// OFFSET: 0x009487B0
|
||||
// FUNCTION: fn_12880
|
||||
void UINormalMB::Create(UIWindow* owner, const char* text, int type, bool defaultAccept, const char* title, int width, int height, const char* icon) {
|
||||
this->m_owner = owner;
|
||||
this->m_message = text;
|
||||
this->m_title = title ? title : LookupMessage(3700);
|
||||
|
||||
this->SetSize(width, height);
|
||||
this->Slot15(width, height);
|
||||
this->Slot22(width, height);
|
||||
this->Move(static_cast<int>((g_renderer->viewport.width - width) * 0.5), static_cast<int>((g_renderer->viewport.height - height) * 0.5));
|
||||
|
||||
int inset = 0;
|
||||
|
||||
if (icon) {
|
||||
auto* image = new UIStaticBitmap(*this->m_context, this->m_textContext->buttons);
|
||||
image->SetBitmap(icon);
|
||||
image->SetSize(image->geometry.width, image->geometry.height);
|
||||
image->Move(10, 22);
|
||||
this->AddChild(image);
|
||||
inset = image->geometry.width + image->geometry.x;
|
||||
}
|
||||
|
||||
this->m_viewer = new UITextViewer(*this->m_context, *this->m_textContext);
|
||||
this->m_viewer->Configure(inset + 10, 22, width - inset - 20, height - 55, 0);
|
||||
unsigned red, green, blue;
|
||||
SkinPaletteChannels(ResourceMgr::Instance(), 2, 2, red, green, blue);
|
||||
this->m_viewer->backgroundColor = RGB(red, green, blue) | 0xFF000000u;
|
||||
this->m_viewer->Invalidate();
|
||||
this->AddChild(this->m_viewer);
|
||||
this->m_viewer->SendMsg(nullptr, 29, reinterpret_cast<std::intptr_t>(this->m_message.c_str()), static_cast<int>(width / 7.5), 0, 0);
|
||||
|
||||
switch (type) {
|
||||
case 0:
|
||||
this->AddButton("유저인터페이스\\btn_ok.bmp", "유저인터페이스\\btn_ok_a.bmp", "유저인터페이스\\btn_ok_b.bmp", width - 46, height - 24, 184);
|
||||
this->m_message0 = 184;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
this->AddButton("유저인터페이스\\btn_ok.bmp", "유저인터페이스\\btn_ok_a.bmp", "유저인터페이스\\btn_ok_b.bmp", width - 91, height - 24, 187);
|
||||
this->AddButton("유저인터페이스\\btn_cancel.bmp", "유저인터페이스\\btn_cancel_a.bmp", "유저인터페이스\\btn_cancel_b.bmp", width - 46, height - 24, 188);
|
||||
this->m_message1 = 188;
|
||||
this->m_message0 = defaultAccept ? 187 : 188;
|
||||
break;
|
||||
|
||||
case 4:
|
||||
this->AddButton("유저인터페이스\\btn_cancel.bmp", "유저인터페이스\\btn_cancel_a.bmp", "유저인터페이스\\btn_cancel_b.bmp", width - 46, height - 24, 185);
|
||||
this->m_message0 = 185;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,19 +7,25 @@
|
|||
#include <string>
|
||||
|
||||
class UITextViewer;
|
||||
struct UITextViewerContext;
|
||||
|
||||
class UINormalMB : public UIFrameWnd {
|
||||
public:
|
||||
UINormalMB(UIWindowContext& windows, UIFrameContext& frames);
|
||||
int SendMsg(UIWindow* sender, int message, std::intptr_t a, std::intptr_t b, std::intptr_t c, std::intptr_t d) override;
|
||||
void Create(UIWindow* owner, const char* text, int type, bool defaultAccept, const char* title, int width, int height, const char* icon);
|
||||
|
||||
protected:
|
||||
/* 00B4 */ UIWindow* m_owner;
|
||||
/* 00B8 */ UITextViewer* m_viewer;
|
||||
/* 00BC */ std::string unknown_00BC;
|
||||
/* 00D4 */ std::string unknown_00D4;
|
||||
/* 00BC */ std::string m_message;
|
||||
/* 00D4 */ std::string m_title;
|
||||
/* 00EC */ unsigned char m_keepOpen;
|
||||
/* 00F0 */ std::map<int, void (*)()> m_actions;
|
||||
|
||||
private:
|
||||
UITextViewerContext* m_textContext;
|
||||
void AddButton(const char* normal, const char* hover, const char* pressed, int x, int y, int id);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue