diff --git a/Source/Contents/Actors/CharacterRender.cpp b/Source/Contents/Actors/CharacterRender.cpp new file mode 100644 index 00000000..55d7c6a5 --- /dev/null +++ b/Source/Contents/Actors/CharacterRender.cpp @@ -0,0 +1,5 @@ +#include "Contents/Actors/CharacterRender.h" + +// OFFSET: 0x0080D2A0 + +// OFFSET: 0x0080D730 diff --git a/Source/Contents/Actors/CharacterRender.h b/Source/Contents/Actors/CharacterRender.h new file mode 100644 index 00000000..3c5ea89f --- /dev/null +++ b/Source/Contents/Actors/CharacterRender.h @@ -0,0 +1,62 @@ +#ifndef RAGNAROK_SOURCE_CONTENTS_ACTORS_CHARACTERRENDER_H +#define RAGNAROK_SOURCE_CONTENTS_ACTORS_CHARACTERRENDER_H + +#include +#include +#include + +class CCharacterRender { +public: + CCharacterRender(int unknown0068, int unknown006C); + virtual ~CCharacterRender(); + + /* 0004 */ int unknown_0004; + /* 0008 */ int unknown_0008; + /* 000C */ int unknown_000C; + /* 0010 */ int unknown_0010; + /* 0014 */ int unknown_0014; + /* 0018 */ int unknown_0018[4]; + /* 0028 */ int unknown_0028; + /* 002C */ int unknown_002C; + /* 0030 */ int unknown_0030; + /* 0034 */ int unknown_0034; + /* 0038 */ int unknown_0038; + /* 003C */ int unknown_003C; + /* 0040 */ int unknown_0040; + /* 0044 */ int unknown_0044; + /* 0048 */ int unknown_0048; + /* 004C */ unsigned char unknown_004C; + /* 0050 */ int unknown_0050; + /* 0054 */ int unknown_0054; + /* 0058 */ float unknown_0058; + /* 005C */ int unknown_005C; + /* 0060 */ int unknown_0060; + /* 0064 */ int unknown_0064; + /* 0068 */ int unknown_0068; + /* 006C */ int unknown_006C; + /* 0070 */ float unknown_0070; + /* 0074 */ float unknown_0074; + /* 0078 */ float unknown_0078; + /* 007C */ float unknown_007C; + /* 0080 */ float unknown_0080; + /* 0084 */ float unknown_0084; + /* 0088 */ float unknown_0088; + /* 008C */ float unknown_008C; + /* 0090 */ int unknown_0090; + /* 0094 */ int unknown_0094[5]; + /* 00A8 */ int unknown_00A8; + /* 00AC */ int unknown_00AC; + /* 00B0 */ unsigned char unknown_00B0; + /* 00B4 */ std::map unknown_00B4; + /* 00BC */ int unknown_00BC; + /* 00C0 */ unsigned char unknown_00C0; +}; + +#if defined(_WIN32) && !defined(_WIN64) +static_assert(offsetof(CCharacterRender, unknown_0068) == 0x68); +static_assert(offsetof(CCharacterRender, unknown_008C) == 0x8C); +static_assert(offsetof(CCharacterRender, unknown_00B4) == 0xB4); +static_assert(sizeof(CCharacterRender) == 0xC4); +#endif + +#endif diff --git a/Source/Contents/RouletteMgr.cpp b/Source/Contents/RouletteMgr.cpp new file mode 100644 index 00000000..f66bf372 --- /dev/null +++ b/Source/Contents/RouletteMgr.cpp @@ -0,0 +1,48 @@ +#include "Contents/RouletteMgr.h" +#include "Render/Renderer.h" +#include "Render/TextureQuad.h" +#include "Render/Textures/TextureCache.h" +#include "UI/Window/UIRoulletteWnd.h" +#include "UI/Window/UIWindowMgr.h" + +#include +#include +#include +#include +#include + +// GLOBAL: gl_24688 +RouletteMgr* g_rouletteMgr = nullptr; + +// OFFSET: 0x0080A310 + +// OFFSET: 0x0080A980 + +// OFFSET: 0x0080ABA0 +// FUNCTION: fn_10073 +void RouletteMgr::Reset() { + std::memset(&this->m_quads, 0, sizeof(this->m_quads)); + this->m_frame = 0; + this->m_cycle = 0; + this->m_stage = 0; + this->unknown_0018 = 0; + this->m_lastTick = 0; + this->m_interval = 0; + this->m_spinning = 0; +} + +// OFFSET: 0x0080ABF0 + +// OFFSET: 0x0080ACA0 + +// OFFSET: 0x0080ACC0 + +// OFFSET: 0x0080ADC0 + +// OFFSET: 0x0080B1D0 + +// OFFSET: 0x0080B270 + +// OFFSET: 0x0080B490 + +// OFFSET: 0x0080B680 diff --git a/Source/Contents/RouletteMgr.h b/Source/Contents/RouletteMgr.h new file mode 100644 index 00000000..7303fdaa --- /dev/null +++ b/Source/Contents/RouletteMgr.h @@ -0,0 +1,98 @@ +#ifndef RAGNAROK_SOURCE_CONTENTS_ROULETTEMGR_H +#define RAGNAROK_SOURCE_CONTENTS_ROULETTEMGR_H + +#include "Contents/Items/ItemInfo.h" +#include "Render/Primitives/RenderPrimitive.h" + +#include +#include +#include + +struct RouletteSlot { + /* 0000 */ short row; + /* 0002 */ short column; + /* 0004 */ int itemId; + /* 0008 */ short count; + + // INLINED + bool operator<(const RouletteSlot& other) const { + return this->row < other.row && this->column < other.column; + } +}; + +struct RouletteQuad { + /* 0000 */ RenderVertex vertices[6]; + + // INLINED + RouletteQuad() { + for (int i = 0; i < 6; ++i) { + this->vertices[i].x = 0; + this->vertices[i].y = 0; + this->vertices[i].z = 0; + this->vertices[i].rhw = 0; + this->vertices[i].diffuse = 0; + this->vertices[i].specular = 0xFF000000; + this->vertices[i].u = 0; + this->vertices[i].v = 0; + } + } +}; + +struct RouletteQuads { + /* 0000 */ RouletteQuad current; + /* 00C0 */ RouletteQuad start; + /* 0180 */ RouletteQuad target; +}; + +class RouletteMgr { +public: + static bool Create(); + static void Destroy(); + + /* 0000 */ unsigned char m_valid; + /* 0004 */ int unknown_0004; + /* 0008 */ int m_frame; + /* 000C */ int m_cycle; + /* 0010 */ unsigned char m_spinning; + /* 0014 */ int m_stage; + /* 0018 */ int unknown_0018; + /* 001C */ RouletteQuads m_quads; + /* 025C */ unsigned long m_lastTick; + /* 0260 */ unsigned long m_interval; + /* 0264 */ int m_index; + /* 0268 */ int m_additionItemId; + /* 026C */ int m_goldPoint; + /* 0270 */ int m_silverPoint; + /* 0274 */ int m_bronzePoint; + /* 0278 */ unsigned char m_resultShown; + /* 0279 */ unsigned char m_bonus; + /* 027C */ std::multimap m_items; + /* 0288 */ ITEM_INFO m_resultItem; + /* 0380 */ ITEM_INFO m_additionItem; + + RouletteMgr(); + void AddItem(RouletteSlot slot); + void Reset(); + void Draw(); + void Update(); + void SetAdditionItem(int itemId); + void StartSpin(int x, int y, int originX, int originY); + void SetQuad(int x, int y, int originX, int originY); + void SetResult(unsigned short index, unsigned char shown, unsigned char bonus); +}; + +extern RouletteMgr* g_rouletteMgr; + +#if defined(_WIN32) && !defined(_WIN64) +static_assert(sizeof(RouletteSlot) == 12); +static_assert(sizeof(RouletteQuads) == 0x240); +static_assert(offsetof(RouletteMgr, m_quads) == 0x1C); +static_assert(offsetof(RouletteMgr, m_lastTick) == 0x25C); +static_assert(offsetof(RouletteMgr, m_resultShown) == 0x278); +static_assert(offsetof(RouletteMgr, m_items) == 0x27C); +static_assert(offsetof(RouletteMgr, m_resultItem) == 0x288); +static_assert(offsetof(RouletteMgr, m_additionItem) == 0x380); +static_assert(sizeof(RouletteMgr) == 0x478); +#endif + +#endif diff --git a/Source/UI/Window/UIRoulletteWnd.cpp b/Source/UI/Window/UIRoulletteWnd.cpp new file mode 100644 index 00000000..fd71fcf5 --- /dev/null +++ b/Source/UI/Window/UIRoulletteWnd.cpp @@ -0,0 +1,11 @@ +#include "UI/Window/UIRoulletteWnd.h" +#include "Contents/RouletteMgr.h" + +// OFFSET: 0x0080BAF0 + +// OFFSET: 0x0080C490 +// FUNCTION: fn_10088 +void UIRoulletteWnd::Slot25(int, int) { +} + +// OFFSET: 0x0080CE40 diff --git a/Source/UI/Window/UIRoulletteWnd.h b/Source/UI/Window/UIRoulletteWnd.h index 8623ed06..3f84d72e 100644 --- a/Source/UI/Window/UIRoulletteWnd.h +++ b/Source/UI/Window/UIRoulletteWnd.h @@ -1,18 +1,36 @@ #ifndef RAGNAROK_SOURCE_UI_WINDOW_UIROULLETTEWND_H #define RAGNAROK_SOURCE_UI_WINDOW_UIROULLETTEWND_H +#include "Contents/Items/ItemInfo.h" #include "UI/Window/UIFrameWnd.h" +#include + class UIRoulletteWnd : public UIFrameWnd { public: + ~UIRoulletteWnd() override; + void Slot25(int x, int y) override; + int CoinType() const; + /* 00BC */ std::uint32_t unknown_00BC; /* 00C0 */ std::uint32_t unknown_00C0; /* 00C4 */ std::uint32_t unknown_00C4; /* 00C8 */ unsigned char m_enabled; + /* 00D0 */ ITEM_INFO m_item; + /* 01C8 */ std::list m_items; + /* 01D0 */ UIWindow* unknown_01D0; + /* 01D4 */ UIWindow* unknown_01D4; + /* 01D8 */ UIWindow* unknown_01D8; + /* 01DC */ UIWindow* unknown_01DC; + /* 01E0 */ UIWindow* unknown_01E0; }; #if defined(_WIN32) && !defined(_WIN64) static_assert(offsetof(UIRoulletteWnd, m_enabled) == 0xC8); +static_assert(offsetof(UIRoulletteWnd, m_item) == 0xD0); +static_assert(offsetof(UIRoulletteWnd, m_items) == 0x1C8); +static_assert(offsetof(UIRoulletteWnd, unknown_01E0) == 0x1E0); +static_assert(sizeof(UIRoulletteWnd) == 0x1E8); #endif #endif diff --git a/data/compile.json b/data/compile.json index 6e862e40..141347a1 100644 --- a/data/compile.json +++ b/data/compile.json @@ -287,6 +287,7 @@ "Source/Contents/ActorNameRequests.cpp": 4, "Source/Contents/Actors/ActorStateFlags.cpp": 4, "Source/Contents/Actors/AttackMotion.cpp": 4, + "Source/Contents/Actors/CharacterRender.cpp": 4, "Source/Contents/Actors/GameActor.cpp": 4, "Source/Contents/Actors/GameObject.cpp": 4, "Source/Contents/Actors/GroundScope.cpp": 4, @@ -483,6 +484,7 @@ "Source/Contents/RobeOpacity.cpp": 4, "Source/Contents/RobeResources.cpp": 4, "Source/Contents/RobeTopLayer.cpp": 4, + "Source/Contents/RouletteMgr.cpp": 4, "Source/Contents/ServerTimeManager.cpp": 4, "Source/Contents/ShowRankingScheduler.cpp": 4, "Source/Contents/SignBoard/SignBoard.cpp": 4, @@ -821,6 +823,7 @@ "Source/UI/Window/UIOpenMailBoxWnd.cpp": 2, "Source/UI/Window/UIOpenRoulletteWnd.cpp": 2, "Source/UI/Window/UIResizer.cpp": 2, + "Source/UI/Window/UIRoulletteWnd.cpp": 2, "Source/UI/Window/UISecondCostumeWnd.cpp": 2, "Source/UI/Window/UISeekPartyListWnd.cpp": 2, "Source/UI/Window/UITab.cpp": 2,