refactor: effects, audio, animation and UI text game messages as structs

Converts PlayAnimation, PlayNDAudioEmitter, PlayEmbeddedEffectOnAllClientsNearObject,
PlayFXEffect, StopFXEffect, BroadcastTextToChatbox, Play2DAmbientSound,
Stop2DAmbientSound, UIMessageServerToSingleClient, UIMessageServerToAllClients,
StartCelebrationEffect, DisplayMessageBox, DisplayChatBubble, ChangeIdleFlags,
SetNameBillboardState, ShowBillboardInteractIcon, PlayCinematic, EndCinematic,
SlashCommandTextFeedback, PlayEmote and SetEmoteLockState (21 old Send
functions, 23 with overloads) and the received MessageBoxRespond,
ChoiceBoxRespond, CinematicUpdate and PlayEmote to NetGameMsgs in
EffectsMessages.{h,cpp}. The high traffic messages get a constructor for their
required fields. UI messages own their AMF arguments. Every caller is switched,
the received messages are registered in GameMessageHandler's map, and the old
functions and switch cases are deleted. Handlers are copied verbatim.

No wire change and no change in recipients: functions that always broadcast
whatever address they were given are sent with Send(UNASSIGNED_SYSTEM_ADDRESS),
functions that only did SEND_PACKET use SendToClient. Quirks are kept and
documented on the structs (PlayAnimation's UTF-8 sized name, the always written
null terminator in BroadcastTextToChatbox, StartCelebrationEffect always
writing celebrationID, SetNameBillboardState having no payload).

Verified byte for byte against a frozen verbatim copy of the old functions over
an input grid, to one client and broadcast; received messages compared with the
old handlers' read sequences and every truncated payload rejected; hand
computed golden bytes; round trips; a deliberate width mutation made the tests
fail. The byte-equality helper gains a Broadcast mode for functions that
ignored their address.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Aaron Kimbrell
2026-09-26 19:06:00 -05:00
parent 5a9a3e380b
commit dae1925d1a
117 changed files with 2832 additions and 1058 deletions

View File

@@ -1,6 +1,7 @@
#include "ChooseYourDestinationNsToNt.h"
#include "Character.h"
#include "GameMessages.h"
#include "EffectsMessages.h"
#include "eTerminateType.h"
bool ChooseYourDestinationNsToNt::CheckChoice(Entity* self, Entity* player) {
@@ -56,7 +57,15 @@ void ChooseYourDestinationNsToNt::BaseChoiceBoxRespond(Entity* self, Entity* sen
self->SetVar(u"teleportString", strText);
self->SetVar(u"transferZoneID", GeneralUtils::to_u16string(newMap.value()));
GameMessages::SendDisplayMessageBox(sender->GetObjectID(), true, self->GetObjectID(), u"TransferBox", 0, strText, u"", sender->GetSystemAddress());
GameMessages::DisplayMessageBox messageBox;
messageBox.target = sender->GetObjectID();
messageBox.bShow = true;
messageBox.callbackClient = self->GetObjectID();
messageBox.identifier = u"TransferBox";
messageBox.imageID = 0;
messageBox.text = strText;
messageBox.userData = u"";
messageBox.Send(sender->GetSystemAddress());
} else {
GameMessages::SendTerminateInteraction(sender->GetObjectID(), eTerminateType::FROM_INTERACTION, self->GetObjectID());
}