MBU-Team / OpenMBU

A reverse engineered version of Marble Blast Ultra from Xbox 360
156 stars 20 forks source link

Fix tagged messages in MBU #178

Closed polyrain closed 11 months ago

polyrain commented 1 year ago

Closes #172

In Marble Blast Ultra, whenever a client receives a message from the server, first a generic callback is called for every callback not registered to a type (this being onServerMessage currently). This callback doesn't work properly for tagged messages ever since the MBO code got added, as the tagged messages are being treated as server messages to be rendered in the Chat Box (not as a tooltip like they were in the XBLA release). Nothing renders at all due to a faulty comparison in game/cpmmon/client/message.cs shown below:

function defaultMessageCallback(%msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10)
{
   %msg = detag(%msgString);
   if (%msg !$= "" && %msg != 0) // %msg != 0 is faulty
      onServerMessage(%msg);
}

Regardless of this, rather than interfere with the client chat code (which is more complex than the original messaging functionality), this PR simply adds callbacks for the message types sent by a server when a gem/easter egg is picked up or the player touches an EndPad. The logic here simply detags the string and tries to load any additional data into it before correctly playing any sound effects and rendering text as required.