Batch #5730 by willerthal: 0 byte-identical, 1 confirmed by peer review. - fn_09881 UIPreviewEquipWnd::DrawCharacter: logic confirmed by peer review Peer-reviewed-by: ragnarok-clanker, Yommy, Qwenkler3.8 Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes).
184 lines
6 KiB
C++
184 lines
6 KiB
C++
#include "UI/UIPreviewEquipWnd.h"
|
|
|
|
#include "Client/Session.h"
|
|
#include "Contents/Actors/CharacterRender.h"
|
|
#include "Contents/Items/ItemInfo.h"
|
|
#include "Contents/UserData/NormalItemSlots.h"
|
|
#include "Render/Renderer.h"
|
|
#include "UI/Window/FuncDrawWNDChar.h"
|
|
#include "Utility/Math/AffineMatrix.h"
|
|
|
|
// OFFSET: 0x007F2F90
|
|
// FUNCTION: fn_09879
|
|
UIPreviewEquipWnd::UIPreviewEquipWnd(UIWindowContext& windows, UIFrameContext& frames)
|
|
: UIFrameWnd(windows, frames, 1), saved(nullptr), m_render(nullptr), m_leftButton(nullptr), m_rightButton(nullptr), unknown_00C4(0) {
|
|
}
|
|
|
|
// OFFSET: 0x007F3090
|
|
// FUNCTION: fn_09880
|
|
UIPreviewEquipWnd::~UIPreviewEquipWnd() {
|
|
delete this->m_render;
|
|
}
|
|
|
|
// OFFSET: 0x007F3590
|
|
// FUNCTION: fn_09881
|
|
void UIPreviewEquipWnd::DrawCharacter() {
|
|
CCharacterRender* render = this->m_render;
|
|
matrix view;
|
|
view.MakeXRotation(render->unknown_0074 / 180.0f * 3.141592f);
|
|
view.AppendYRotation(render->unknown_0078 / 180.0f * 3.141592f);
|
|
|
|
const float distance = -render->unknown_0070;
|
|
float eye[3];
|
|
eye[0] = distance * view.values[6] + view.values[9];
|
|
eye[1] = distance * view.values[7] + view.values[10];
|
|
eye[2] = distance * view.values[8] + view.values[11];
|
|
|
|
float up[3];
|
|
up[0] = render->unknown_0088;
|
|
up[1] = render->unknown_008C;
|
|
up[2] = *reinterpret_cast<float*>(&render->unknown_0090);
|
|
view.LookAt(eye, reinterpret_cast<float*>(&render->unknown_0004), up);
|
|
|
|
float screenX = 0.0f;
|
|
float screenY = 0.0f;
|
|
float depth = 0.0f;
|
|
g_renderer->ProjectViewportCentered(
|
|
reinterpret_cast<float*>(&render->unknown_0004), view.values, &screenX, &screenY, &depth,
|
|
static_cast<float>(this->geometry.width) + *reinterpret_cast<float*>(&render->unknown_0054),
|
|
static_cast<float>(this->geometry.height) + render->unknown_0058
|
|
);
|
|
|
|
FuncDrawWNDChar drawer(
|
|
this, static_cast<int>(screenX), static_cast<int>(screenY), static_cast<unsigned char>(render->unknown_0018[0]),
|
|
static_cast<short>(render->unknown_0010), render->unknown_0014, static_cast<short>(render->unknown_0050),
|
|
static_cast<short>(render->unknown_0018[1]), static_cast<short>(render->unknown_0028), static_cast<short>(render->unknown_002C),
|
|
static_cast<short>(render->unknown_0030), render->unknown_00BC, render->unknown_004C, render->unknown_0048, render->unknown_0018[2],
|
|
render->unknown_0018[3], render->unknown_0040, render->unknown_0044, 0
|
|
);
|
|
drawer.Draw(1);
|
|
}
|
|
|
|
// OFFSET: 0x007F3CD0
|
|
// FUNCTION: fn_09883
|
|
void UIPreviewEquipWnd::Paint() {
|
|
this->SetSolid(this->m_context->primitives, this->geometry.width, this->geometry.height, 0);
|
|
this->DrawNamed(this->m_context->primitives, 0, 0, "유저인터페이스\\equip_preview\\bg_mounting2.bmp", 0xffffffff, 0, 0);
|
|
void (UIPreviewEquipWnd::*draw)() = &UIPreviewEquipWnd::DrawCharacter;
|
|
(this->*draw)();
|
|
}
|
|
|
|
// OFFSET: 0x007F43E0
|
|
// FUNCTION: fn_09887
|
|
void UIPreviewEquipWnd::RefreshHeadgearLocations() {
|
|
if (this->m_render->unknown_0028) {
|
|
ITEM_INFO equipped = g_session.GetItem17F0(0);
|
|
if (this->m_render->unknown_0028 == equipped.unknown_0070) {
|
|
this->m_render->unknown_0034 = 1;
|
|
if (equipped.unknown_0000[2] == 0x301) {
|
|
this->m_render->unknown_0034 = 0x301;
|
|
this->m_render->unknown_0038 = 0x301;
|
|
this->m_render->unknown_003C = 0x301;
|
|
}
|
|
}
|
|
|
|
ITEM_INFO costume = g_session.GetItem2B50(0);
|
|
if (this->m_render->unknown_0028 == costume.unknown_0070) {
|
|
this->m_render->unknown_0034 = 1;
|
|
if (costume.unknown_0000[2] == 0x1C00) {
|
|
this->m_render->unknown_0034 = 0x301;
|
|
this->m_render->unknown_0038 = 0x301;
|
|
this->m_render->unknown_003C = 0x301;
|
|
}
|
|
}
|
|
}
|
|
|
|
if (this->m_render->unknown_002C) {
|
|
ITEM_INFO equipped = g_session.GetItem17F0(8);
|
|
if (this->m_render->unknown_002C == equipped.unknown_0070) {
|
|
if (equipped.unknown_0000[2] == 0x100) {
|
|
this->m_render->unknown_0038 = 0x100;
|
|
}
|
|
|
|
if (equipped.unknown_0000[2] == 0x101) {
|
|
this->m_render->unknown_0038 = 0x101;
|
|
this->m_render->unknown_0034 = 0x101;
|
|
}
|
|
|
|
if (equipped.unknown_0000[2] == 0x300) {
|
|
this->m_render->unknown_0038 = 0x300;
|
|
this->m_render->unknown_003C = 0x300;
|
|
}
|
|
|
|
if (equipped.unknown_0000[2] == 0x301) {
|
|
this->m_render->unknown_0034 = 0x301;
|
|
this->m_render->unknown_0038 = 0x301;
|
|
this->m_render->unknown_003C = 0x301;
|
|
}
|
|
}
|
|
|
|
ITEM_INFO costume = g_session.GetItem2B50(8);
|
|
if (this->m_render->unknown_002C == costume.unknown_0070) {
|
|
if (costume.unknown_0000[2] == 0x400) {
|
|
this->m_render->unknown_0038 = 0x100;
|
|
}
|
|
|
|
if (costume.unknown_0000[2] == 0x1400) {
|
|
this->m_render->unknown_0038 = 0x101;
|
|
this->m_render->unknown_0034 = 0x101;
|
|
}
|
|
|
|
if (costume.unknown_0000[2] == 0xC00) {
|
|
this->m_render->unknown_0038 = 0x300;
|
|
this->m_render->unknown_003C = 0x300;
|
|
}
|
|
|
|
if (costume.unknown_0000[2] == 0x1C00) {
|
|
this->m_render->unknown_0034 = 0x301;
|
|
this->m_render->unknown_0038 = 0x301;
|
|
this->m_render->unknown_003C = 0x301;
|
|
}
|
|
}
|
|
}
|
|
|
|
if (this->m_render->unknown_0030) {
|
|
ITEM_INFO equipped = g_session.GetItem17F0(9);
|
|
if (this->m_render->unknown_0030 == equipped.unknown_0070) {
|
|
if (equipped.unknown_0000[2] == 0x200) {
|
|
this->m_render->unknown_003C = 0x200;
|
|
}
|
|
|
|
if (equipped.unknown_0000[2] == 0x201) {
|
|
this->m_render->unknown_003C = 0x201;
|
|
this->m_render->unknown_0034 = 0x201;
|
|
}
|
|
}
|
|
|
|
ITEM_INFO costume = g_session.GetItem2B50(9);
|
|
if (this->m_render->unknown_0030 == costume.unknown_0070) {
|
|
if (costume.unknown_0000[2] == 0x800) {
|
|
this->m_render->unknown_003C = 0x200;
|
|
}
|
|
|
|
if (costume.unknown_0000[2] == 0x1800) {
|
|
this->m_render->unknown_003C = 0x201;
|
|
this->m_render->unknown_0034 = 0x201;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// OFFSET: 0x007F4830
|
|
// FUNCTION: fn_09888
|
|
void UIPreviewEquipWnd::Slot11() {
|
|
if (this->saved) {
|
|
this->saved->x = this->geometry.x;
|
|
this->saved->y = this->geometry.y;
|
|
}
|
|
}
|
|
|
|
// OFFSET: 0x007F3DB0
|
|
// FUNCTION: fn_09884
|
|
void UIPreviewEquipWnd::Slot19() {
|
|
this->Invalidate();
|
|
}
|