Reconstruct readable C++ and organize cohesive source subsystems

Administrative source import: native x86 compilation passed for 423 authored units. Source placement and submission states are migrated separately; this commit does not imply peer acceptance.

Previous head: 35d2a8cb36
Payload SHA256: 592f016d2730c5593bb653aa054c1e5f76a6df72c8f5a09e66f74876e2e33dee
This commit is contained in:
ragnarok-clanker 2026-10-25 07:42:41 +00:00
commit a47d20f8be
890 changed files with 11796 additions and 16664 deletions

View file

@ -1,86 +0,0 @@
#include "UI/ShortcutLayout.h"
#include "UI/UIBitmapButton.h"
#include <bit>
namespace {
int Add(int left, int right) {
return std::bit_cast<int>(static_cast<unsigned>(left) + static_cast<unsigned>(right));
}
int Multiply(int value, unsigned scale) {
return std::bit_cast<int>(static_cast<unsigned>(value) * scale);
}
}
void ShortcutLayout::PlaceRowButtons() {
this->decrease.Move(
Add(Add(this->window.geometry.width, -this->decrease.geometry.width), -2), Add(Multiply(this->grid.rows, 33), -28)
);
this->increase.Move(
Add(Add(this->window.geometry.width, -this->increase.geometry.width), -2), Add(Multiply(this->grid.rows, 33), -13)
);
this->decrease.Enable(this->grid.rows == 1 ? 0 : 1);
this->increase.Enable(1);
this->increase.SetDisabled(this->grid.rows == 4 ? 1 : 0);
this->increase.Invalidate();
}
// OFFSET: 0x0093B450
// FUNCTION: fn_12760
void ShortcutLayout::ResizeRows() {
const int height = Add(this->itemSlotActive ? 43 : 10, Multiply(this->grid.rows, 33));
if (height == this->window.geometry.height) {
return;
}
this->window.Resize(this->window.geometry.width, height);
// Original positions both row buttons before either Enable callback.
this->decrease.Move(
Add(Add(this->window.geometry.width, -this->decrease.geometry.width), -2), Add(Multiply(this->grid.rows, 33), -28)
);
this->increase.Move(
Add(Add(this->window.geometry.width, -this->increase.geometry.width), -2), Add(Multiply(this->grid.rows, 33), -13)
);
this->showItems.Move(247, Add(height, -10));
this->hideItems.Move(247, Add(height, -10));
this->decrease.Enable(this->grid.rows == 1 ? 0 : 1);
this->increase.Enable(1);
this->increase.SetDisabled(this->grid.rows == 4 ? 1 : 0);
this->increase.Invalidate();
this->window.Slot11();
}
// OFFSET: 0x0093B450
// FUNCTION: fn_12760
void ShortcutLayout::Restore(NormalItemSlotWindow* value) {
this->saved = value;
if (!value->IsValid(this->screenWidth, this->screenHeight, this->itemSlotActive)) {
value->Reset();
}
const int height = value->height;
this->window.Resize(this->window.geometry.width, height);
const int extent = this->itemSlotActive ? Add(height, -43) : height;
this->showItems.Move(247, Add(height, -10));
this->hideItems.Move(247, Add(height, -10));
this->showItems.Enable(this->itemSlotActive ? 0 : 1);
this->showItems.SetDisabled(this->itemSlotActive ? 1 : 0);
this->showItems.Invalidate();
this->hideItems.Enable(this->itemSlotActive ? 1 : 0);
this->hideItems.SetDisabled(this->itemSlotActive ? 0 : 1);
this->hideItems.Invalidate();
this->grid.rows = extent / 33;
this->PlaceRowButtons();
this->window.SendMsg(nullptr, 23, 0, 0, 0, 0);
this->window.Move(value->x, value->y);
}
// OFFSET: 0x00940FE0
// FUNCTION: fn_12787
void ShortcutLayout::Persist() {
if (!this->saved) {
return;
}
this->saved->x = this->window.geometry.x;
this->saved->y = this->window.geometry.y;
this->saved->width = this->window.geometry.width;
this->saved->height = this->window.geometry.height;
}