Added SendNetworkCommand

Allows for a custom message to be sent over the network without the need for SendNetworkEvent. This includes all the possible valid types of byte, word, long, float, and string.
This commit is contained in:
Boondorl 2024-01-04 03:07:17 -05:00 committed by Christoph Oelckers
commit 9565c94cd2
6 changed files with 371 additions and 0 deletions

View file

@ -2705,6 +2705,21 @@ void Net_DoCommand (int type, uint8_t **stream, int player)
case DEM_ENDSCREENJOB:
EndScreenJob();
break;
case DEM_ZSC_CMD:
{
int cmd = ReadLong(stream);
unsigned int size = ReadWord(stream);
TArray<uint8_t> buffer = {};
buffer.Grow(size);
for (unsigned int i = 0u; i < size; ++i)
buffer.Push(ReadByte(stream));
FNetworkCommand netCmd = { player, cmd, buffer };
primaryLevel->localEventManager->NetCommand(netCmd);
}
break;
default:
I_Error ("Unknown net command: %d", type);
@ -2763,6 +2778,10 @@ void Net_SkipCommand (int type, uint8_t **stream)
skip = strlen((char *)(*stream)) + 15;
break;
case DEM_ZSC_CMD:
skip = 6 + (((*stream)[4] << 8) | (*stream)[5]);
break;
case DEM_SUMMON2:
case DEM_SUMMONFRIEND2:
case DEM_SUMMONFOE2: