rodecomp/Source/UI/Layout/WindowGeometry.cpp
ragnarok-clanker a47d20f8be 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
2026-10-25 07:42:41 +00:00

50 lines
1.3 KiB
C++

#include "UI/Layout/WindowGeometry.h"
#include <windows.h>
#include <timeapi.h>
// OFFSET: 0x00A79A90
WindowGeometry::WindowGeometry()
: width(0), height(0), x(0), y(0), surface(nullptr), visible(1), id(600), unknown_0030(0), unknown_0034(0), targetAlpha(255), alphaStart(timeGetTime()),
currentAlpha(255) {
}
// OFFSET: 0x00A81D40
// FUNCTION: fn_16987
void WindowGeometry::Move(int newX, int newY) {
this->x = newX;
this->y = newY;
}
// OFFSET: 0x005C9630
// FUNCTION: fn_03632
void WindowGeometry::Show(int state) {
this->visible = state;
}
// OFFSET: 0x005C8F60
// FUNCTION: fn_03629
void WindowGeometry::SetId(int value) {
this->id = value;
}
// OFFSET: 0x00A7D6F0
// FUNCTION: fn_16954
std::uint32_t WindowGeometry::Color() {
std::uint32_t value = this->currentAlpha;
if (value != this->targetAlpha) {
const std::uint32_t step = (timeGetTime() - this->alphaStart) >> 4;
const std::uint32_t candidate = value < this->targetAlpha ? value + step : value - step;
const bool keepCandidate = value < this->targetAlpha ? candidate < this->targetAlpha : this->targetAlpha < candidate;
value = keepCandidate ? candidate : this->targetAlpha;
this->currentAlpha = value;
}
if (value > 255) {
value = this->targetAlpha;
this->currentAlpha = value;
}
return (value << 24) + 0xFFFFFF;
}