rodecomp/Source/UI/ChatNotifications.cpp
2026-10-24 00:35:19 +00:00

46 lines
1.1 KiB
C++

#include "UI/ChatNotifications.h"
#include "UI/ShortcutVisibility.h"
#include "UI/TextWrapping.h"
#include "UI/UIWindow.h"
#include <cstring>
#include <vector>
// OFFSET: 0x00AA9100
// FUNCTION: fn_17253
// Complete kind-1/19 branches.
void ChatNotifications::Text(const char* text, std::uint32_t color, const char* extra, int value, bool alternate) {
if (this->restricted != 0 && !this->allowsRestricted) {
return;
}
if (color == 0) {
color = 0xFFFFFF;
}
if (this->chat) {
if (std::strcmp(text, "No Msg") != 0 && std::strcmp(text, "NO MSG") != 0) {
this->chat->SendMsg(
nullptr, alternate ? 115 : 37, reinterpret_cast<std::intptr_t>(text), color,
reinterpret_cast<std::intptr_t>(extra), value
);
}
return;
}
std::vector<std::string> lines;
WrapPlainText(text, lines, 94, this->codePage, this->inlineCharset);
for (const auto& line : lines) {
this->queued.push_back({line, color});
}
}
// OFFSET: 0x00AA9100
// FUNCTION: fn_17253
// Complete kind-3 branch.
void ChatNotifications::Refresh() {
this->shortcuts.Show(1);
if (this->chat) {
this->chat->SendMsg(nullptr, 16, 0, 0, 0, 0);
}
}