#include <stdint.h>

#include "msg_private.h"

/*
 * Delta bitmask and netfield descriptor tables recovered from the original
 * i386 data image. Original records store 32-bit string VAs; these C tables
 * preserve the offset/bits rows and use host string pointers.
 */
uint32_t msg_bitmaskTable[MSG_BITMASK_TABLE_COUNT] = {
    UINT32_C(0x00000000),
    UINT32_C(0x00000001),
    UINT32_C(0x00000003),
    UINT32_C(0x00000007),
    UINT32_C(0x0000000f),
    UINT32_C(0x0000001f),
    UINT32_C(0x0000003f),
    UINT32_C(0x0000007f),
    UINT32_C(0x000000ff),
    UINT32_C(0x000001ff),
    UINT32_C(0x000003ff),
    UINT32_C(0x000007ff),
    UINT32_C(0x00000fff),
    UINT32_C(0x00001fff),
    UINT32_C(0x00003fff),
    UINT32_C(0x00007fff),
    UINT32_C(0x0000ffff),
    UINT32_C(0x0001ffff),
    UINT32_C(0x0003ffff),
    UINT32_C(0x0007ffff),
    UINT32_C(0x000fffff),
    UINT32_C(0x001fffff),
    UINT32_C(0x003fffff),
    UINT32_C(0x007fffff),
    UINT32_C(0x00ffffff),
    UINT32_C(0x01ffffff),
    UINT32_C(0x03ffffff),
    UINT32_C(0x07ffffff),
    UINT32_C(0x0fffffff),
    UINT32_C(0x1fffffff),
    UINT32_C(0x3fffffff),
    UINT32_C(0x7fffffff),
    UINT32_C(0xffffffff),
};
netField_t msg_entityDefaultNetFields[MSG_DELTA_ENTITY_FIELD_COUNT] = {
    {"pos.trTime", 16, 32},
    {"pos.trBase[0]", 24, 0},
    {"pos.trBase[1]", 28, 0},
    {"pos.trDelta[1]", 40, 0},
    {"pos.trDelta[0]", 36, 0},
    {"angles2[1]", 108, 0},
    {"apos.trBase[1]", 64, -100},
    {"apos.trBase[0]", 60, -100},
    {"pos.trBase[2]", 32, 0},
    {"pos.trDelta[2]", 44, 0},
    {"eventSequence", 168, 8},
    {"eType", 4, 8},
    {"eFlags", 8, 24},
    {"groundEntityNum", 124, 10},
    {"legsAnim", 208, 10},
    {"clientNum", 148, 8},
    {"apos.trBase[2]", 68, -100},
    {"events[0]", 172, 8},
    {"index", 140, 9},
    {"events[1]", 176, 8},
    {"events[2]", 180, 8},
    {"events[3]", 184, 8},
    {"eventParm", 164, 8},
    {"torsoAnim", 212, 10},
    {"surfType", 136, 8},
    {"scale", 220, 8},
    {"otherEntityNum", 116, 10},
    {"fWaistPitch", 240, 0},
    {"pos.trType", 12, 8},
    {"xmodel", 144, 9},
    {"angles2[0]", 104, 0},
    {"fTorsoHeight", 232, 0},
    {"fTorsoPitch", 236, 0},
    {"apos.trType", 48, 8},
    {"solid", 160, 24},
    {"weapon", 204, 7},
    {"apos.trTime", 52, 32},
    {"apos.trDelta[0]", 72, 0},
    {"eventParms[0]", 188, 8},
    {"pos.trDuration", 20, 32},
    {"animMovetype", 228, 4},
    {"eventParms[1]", 192, 8},
    {"apos.trDelta[2]", 80, 0},
    {"eventParms[2]", 196, 8},
    {"eventParms[3]", 200, 8},
    {"leanf", 216, 0},
    {"apos.trDelta[1]", 76, 0},
    {"loopSound", 132, 8},
    {"attackerEntityNum", 120, 10},
    {"iHeadIcon", 152, 4},
    {"iHeadIconTeam", 156, 2},
    {"apos.trDuration", 56, 32},
    {"time", 84, 32},
    {"time2", 88, 32},
    {"origin2[0]", 92, 0},
    {"origin2[1]", 96, 0},
    {"origin2[2]", 100, 0},
    {"angles2[2]", 112, 0},
    {"constantLight", 128, 32},
    {"dmgFlags", 224, 32},
};

netField_t msg_entityAltTrajectoryNetFields[MSG_DELTA_ENTITY_FIELD_COUNT] = {
    {"pos.trBase[2]", 32, 0},
    {"pos.trBase[0]", 24, 0},
    {"pos.trBase[1]", 28, 0},
    {"apos.trBase[2]", 68, -100},
    {"apos.trBase[1]", 64, -100},
    {"apos.trBase[0]", 60, -100},
    {"angles2[1]", 108, -100},
    {"time", 84, -16},
    {"time2", 88, 6},
    {"origin2[0]", 92, 8},
    {"origin2[2]", 100, 8},
    {"angles2[0]", 104, -100},
    {"origin2[1]", 96, -100},
    {"angles2[2]", 112, -100},
    {"leanf", 216, -100},
    {"loopSound", 132, 8},
    {"eType", 4, 8},
    {"eFlags", 8, 24},
    {"eventSequence", 168, 8},
    {"events[0]", 172, 8},
    {"events[1]", 176, 8},
    {"events[2]", 180, 8},
    {"events[3]", 184, 8},
    {"eventParm", 164, 8},
    {"eventParms[0]", 188, 8},
    {"eventParms[1]", 192, 8},
    {"eventParms[2]", 196, 8},
    {"eventParms[3]", 200, 8},
    {"iHeadIcon", 152, 6},
    {"iHeadIconTeam", 156, 2},
    {"animMovetype", 228, 8},
    {"index", 140, 9},
    {"torsoAnim", 212, 10},
    {"surfType", 136, 8},
    {"scale", 220, 8},
    {"otherEntityNum", 116, 10},
    {"fWaistPitch", 240, 0},
    {"pos.trType", 12, 8},
    {"xmodel", 144, 9},
    {"fTorsoHeight", 232, 0},
    {"fTorsoPitch", 236, 0},
    {"apos.trType", 48, 8},
    {"solid", 160, 24},
    {"weapon", 204, 7},
    {"apos.trTime", 52, 32},
    {"apos.trDelta[0]", 72, 0},
    {"apos.trDelta[2]", 80, 0},
    {"apos.trDelta[1]", 76, 0},
    {"attackerEntityNum", 120, 10},
    {"apos.trDuration", 56, 32},
    {"constantLight", 128, 32},
    {"dmgFlags", 224, 32},
    {"pos.trTime", 16, 32},
    {"pos.trDuration", 20, 32},
    {"groundEntityNum", 124, 10},
    {"legsAnim", 208, 10},
    {"clientNum", 148, 8},
    {"pos.trDelta[1]", 40, 0},
    {"pos.trDelta[0]", 36, 0},
    {"pos.trDelta[2]", 44, 0},
};

netField_t msg_entityBaselineNetFields[MSG_DELTA_ENTITY_BASE_FIELD_COUNT] = {
    {"absmin[1]", 256, 0},
    {"absmax[1]", 268, 0},
    {"absmin[0]", 252, 0},
    {"absmax[0]", 264, 0},
    {"absmin[2]", 260, 0},
    {"absmax[2]", 272, 0},
    {"pos.trBase[1]", 28, 0},
    {"pos.trBase[0]", 24, 0},
    {"eType", 4, 8},
    {"eFlags", 8, 24},
    {"pos.trBase[2]", 32, 0},
    {"svFlags", 244, 32},
    {"groundEntityNum", 124, 10},
    {"apos.trBase[1]", 64, 0},
    {"clientNum", 148, 8},
    {"apos.trBase[0]", 60, 0},
    {"index", 140, 9},
    {"apos.trBase[2]", 68, 0},
    {"eventSequence", 168, 8},
    {"events[0]", 172, 8},
    {"legsAnim", 208, 10},
    {"events[1]", 176, 8},
    {"events[2]", 180, 8},
    {"events[3]", 184, 8},
    {"weapon", 204, 7},
    {"pos.trType", 12, 8},
    {"xmodel", 144, 9},
    {"pos.trTime", 16, 32},
    {"apos.trType", 48, 8},
    {"solid", 160, 24},
    {"pos.trDuration", 20, 32},
    {"eventParms[0]", 188, 8},
    {"torsoAnim", 212, 10},
    {"pos.trDelta[0]", 36, 0},
    {"pos.trDelta[1]", 40, 0},
    {"angles2[1]", 108, 0},
    {"angles2[0]", 104, 0},
    {"animMovetype", 228, 4},
    {"pos.trDelta[2]", 44, 0},
    {"otherEntityNum", 116, 10},
    {"eventParms[1]", 192, 8},
    {"surfType", 136, 8},
    {"eventParm", 164, 8},
    {"eventParms[2]", 196, 8},
    {"scale", 220, 8},
    {"eventParms[3]", 200, 8},
    {"fTorsoHeight", 232, 0},
    {"fWaistPitch", 240, 0},
    {"fTorsoPitch", 236, 0},
    {"apos.trTime", 52, 32},
    {"apos.trDelta[0]", 72, 0},
    {"apos.trDelta[2]", 80, 0},
    {"singleClient", 248, 6},
    {"leanf", 216, 0},
    {"apos.trDelta[1]", 76, 0},
    {"loopSound", 132, 8},
    {"attackerEntityNum", 120, 10},
    {"iHeadIcon", 152, 4},
    {"iHeadIconTeam", 156, 2},
    {"apos.trDuration", 56, 32},
    {"time", 84, 32},
    {"time2", 88, 32},
    {"origin2[0]", 92, 0},
    {"origin2[1]", 96, 0},
    {"origin2[2]", 100, 0},
    {"angles2[2]", 112, 0},
    {"constantLight", 128, 32},
    {"dmgFlags", 224, 32},
};

netField_t msg_clientNetFields[MSG_DELTA_CLIENT_FIELD_COUNT] = {
    {"team", 4, 2},
    {"name[0]", 60, 32},
    {"name[4]", 64, 32},
    {"attachModelIndex[0]", 12, 8},
    {"attachModelIndex[2]", 20, 8},
    {"attachModelIndex[3]", 24, 8},
    {"modelindex", 8, 8},
    {"attachModelIndex[1]", 16, 8},
    {"name[8]", 68, 32},
    {"name[12]", 72, 32},
    {"attachModelIndex[4]", 28, 8},
    {"name[16]", 76, 32},
    {"attachTagIndex[0]", 36, 5},
    {"attachTagIndex[1]", 40, 5},
    {"attachTagIndex[2]", 44, 5},
    {"attachTagIndex[3]", 48, 5},
    {"attachTagIndex[4]", 52, 5},
    {"attachModelIndex[5]", 32, 8},
    {"attachTagIndex[5]", 56, 5},
    {"name[20]", 80, 32},
    {"name[24]", 84, 32},
    {"name[28]", 88, 32},
};

#define MSG_PLAYERSTATE_NETFIELD(fieldName, member, bitCount) \
    { (fieldName), offsetof(playerState_t, member), (bitCount) }

netField_t msg_playerStateNetFields[MSG_DELTA_PLAYERSTATE_FIELD_COUNT] = {
    MSG_PLAYERSTATE_NETFIELD("commandTime", commandTime, 32),
    MSG_PLAYERSTATE_NETFIELD("origin[1]", psOrigin[1], 0),
    MSG_PLAYERSTATE_NETFIELD("origin[0]", psOrigin[0], 0),
    MSG_PLAYERSTATE_NETFIELD("origin[2]", psOrigin[2], 0),
    MSG_PLAYERSTATE_NETFIELD("viewangles[1]", viewAngles[1], -100),
    MSG_PLAYERSTATE_NETFIELD("viewangles[0]", viewAngles[0], -100),
    MSG_PLAYERSTATE_NETFIELD("iCompassFriendInfo", compassFriendInfo, 32),
    MSG_PLAYERSTATE_NETFIELD("eFlags", entityStateFlags, 24),
    MSG_PLAYERSTATE_NETFIELD("bobCycle", bobCycle, 8),
    MSG_PLAYERSTATE_NETFIELD("viewHeightCurrent", viewHeightCurrent, 0),
    MSG_PLAYERSTATE_NETFIELD("eventSequence", eventIndex, 8),
    MSG_PLAYERSTATE_NETFIELD("legsAnim", legsAnim, 10),
    MSG_PLAYERSTATE_NETFIELD("pm_flags", playerStateFlags, 24),
    MSG_PLAYERSTATE_NETFIELD("delta_angles[1]", deltaAngles[1], 16),
    MSG_PLAYERSTATE_NETFIELD("velocity[1]", velocity[1], 0),
    MSG_PLAYERSTATE_NETFIELD("velocity[0]", velocity[0], 0),
    MSG_PLAYERSTATE_NETFIELD("iCompassTankInfo", compassTankInfo, 32),
    MSG_PLAYERSTATE_NETFIELD("speed", speed, 16),
    MSG_PLAYERSTATE_NETFIELD("mins[0]", playerMins[0], 0),
    MSG_PLAYERSTATE_NETFIELD("mins[1]", playerMins[1], 0),
    MSG_PLAYERSTATE_NETFIELD("maxs[0]", playerMaxs[0], 0),
    MSG_PLAYERSTATE_NETFIELD("maxs[1]", playerMaxs[1], 0),
    MSG_PLAYERSTATE_NETFIELD("maxs[2]", playerMaxs[2], 0),
    MSG_PLAYERSTATE_NETFIELD("proneViewHeight", proneViewHeight, -8),
    MSG_PLAYERSTATE_NETFIELD("crouchViewHeight", crouchViewHeight, -8),
    MSG_PLAYERSTATE_NETFIELD("standViewHeight", standViewHeight, -8),
    MSG_PLAYERSTATE_NETFIELD("deadViewHeight", deadViewHeight, -8),
    MSG_PLAYERSTATE_NETFIELD("walkSpeedScale", walkSpeedScale, 0),
    MSG_PLAYERSTATE_NETFIELD("runSpeedScale", runSpeedScale, 0),
    MSG_PLAYERSTATE_NETFIELD("sprintSpeedScale", sprintSpeedScale, 0),
    MSG_PLAYERSTATE_NETFIELD("proneSpeedScale", proneSpeedScale, 0),
    MSG_PLAYERSTATE_NETFIELD("crouchSpeedScale", crouchSpeedScale, 0),
    MSG_PLAYERSTATE_NETFIELD("strafeSpeedScale", strafeSpeedScale, 0),
    MSG_PLAYERSTATE_NETFIELD("backSpeedScale", backSpeedScale, 0),
    MSG_PLAYERSTATE_NETFIELD("leanSpeedScale", leanSpeedScale, 0),
    MSG_PLAYERSTATE_NETFIELD("fatigueScale", fatigueScale, 0),
    MSG_PLAYERSTATE_NETFIELD("lastSprintTime", lastSprintTime, 0),
    MSG_PLAYERSTATE_NETFIELD("friction", friction, 0),
    MSG_PLAYERSTATE_NETFIELD("groundEntityNum", groundEntityNum, 10),
    MSG_PLAYERSTATE_NETFIELD("viewHeightTarget", viewHeightTarget, -8),
    MSG_PLAYERSTATE_NETFIELD("events[0]", events[0], 8),
    MSG_PLAYERSTATE_NETFIELD("weapons[0]", weaponBits[0], 32),
    MSG_PLAYERSTATE_NETFIELD("weaponslots[0]", weaponSlots[0], 32),
    MSG_PLAYERSTATE_NETFIELD("gravity", gravity, 16),
    MSG_PLAYERSTATE_NETFIELD("serverCursorHintString", serverCursorHintString, -8),
    MSG_PLAYERSTATE_NETFIELD("viewmodelIndex", viewModelIndex, 8),
    MSG_PLAYERSTATE_NETFIELD("events[1]", events[1], 8),
    MSG_PLAYERSTATE_NETFIELD("events[2]", events[2], 8),
    MSG_PLAYERSTATE_NETFIELD("events[3]", events[3], 8),
    MSG_PLAYERSTATE_NETFIELD("delta_angles[0]", deltaAngles[0], 16),
    MSG_PLAYERSTATE_NETFIELD("weapon", currentWeapon, 7),
    MSG_PLAYERSTATE_NETFIELD("movementDir", movementDir, 8),
    MSG_PLAYERSTATE_NETFIELD("viewHeightLerpTarget", viewHeightLerpTarget, -8),
    MSG_PLAYERSTATE_NETFIELD("weaponslots[4]", weaponSlots[4], 32),
    MSG_PLAYERSTATE_NETFIELD("proneDirection", proneDirection, 0),
    MSG_PLAYERSTATE_NETFIELD("aimSpreadScale", aimSpreadScale, 0),
    MSG_PLAYERSTATE_NETFIELD("weapAnim", weaponAnim, 10),
    MSG_PLAYERSTATE_NETFIELD("jumpTime", lastJumpCommandTime, 32),
    MSG_PLAYERSTATE_NETFIELD("velocity[2]", velocity[2], 0),
    MSG_PLAYERSTATE_NETFIELD("weaponTime", weaponTime, -16),
    MSG_PLAYERSTATE_NETFIELD("proneTorsoPitch", proneTorsoPitch, 0),
    MSG_PLAYERSTATE_NETFIELD("proneDirectionPitch", proneDirectionPitch, 0),
    MSG_PLAYERSTATE_NETFIELD("fTorsoPitch", torsoPitch, 0),
    MSG_PLAYERSTATE_NETFIELD("fWaistPitch", waistPitch, 0),
    MSG_PLAYERSTATE_NETFIELD("fTorsoHeight", torsoHeight, 0),
    MSG_PLAYERSTATE_NETFIELD("weaponstate", weaponState, 4),
    MSG_PLAYERSTATE_NETFIELD("torsoTimer", torsoTimer, 16),
    MSG_PLAYERSTATE_NETFIELD("torsoAnim", torsoAnim, 10),
    MSG_PLAYERSTATE_NETFIELD("eventParms[0]", eventParms[0], 8),
    MSG_PLAYERSTATE_NETFIELD("vLadderVec[0]", ladderNormal[0], 0),
    MSG_PLAYERSTATE_NETFIELD("eventParms[3]", eventParms[3], 8),
    MSG_PLAYERSTATE_NETFIELD("viewHeightLerpDown", viewHeightLerpDown, 1),
    MSG_PLAYERSTATE_NETFIELD("weaponDelay", weaponDelay, -16),
    MSG_PLAYERSTATE_NETFIELD("eventParms[1]", eventParms[1], 8),
    MSG_PLAYERSTATE_NETFIELD("viewHeightLerpTime", viewHeightLerpTime, 32),
    MSG_PLAYERSTATE_NETFIELD("eventParms[2]", eventParms[2], 8),
    MSG_PLAYERSTATE_NETFIELD("vLadderVec[1]", ladderNormal[1], 0),
    MSG_PLAYERSTATE_NETFIELD("fWeaponPosFrac", adsFraction, 0),
    MSG_PLAYERSTATE_NETFIELD("pm_type", pmType, 8),
    MSG_PLAYERSTATE_NETFIELD("legsTimer", legsTimer, 16),
    MSG_PLAYERSTATE_NETFIELD("fJumpOriginZ", jumpOriginZ, 0),
    MSG_PLAYERSTATE_NETFIELD("leanf", leanFraction, 0),
    MSG_PLAYERSTATE_NETFIELD("damageEvent", damageEvent, 8),
    MSG_PLAYERSTATE_NETFIELD("damageYaw", damageYaw, 8),
    MSG_PLAYERSTATE_NETFIELD("damagePitch", damagePitch, 8),
    MSG_PLAYERSTATE_NETFIELD("damageCount", damageCount, 7),
    MSG_PLAYERSTATE_NETFIELD("weaponrechamber[0]", weaponRechamberBits[0], 32),
    MSG_PLAYERSTATE_NETFIELD("grenadeTimeLeft", grenadeTimeLeft, -16),
    MSG_PLAYERSTATE_NETFIELD("pm_time", pmTime, -16),
    MSG_PLAYERSTATE_NETFIELD("iFoliageSoundTime", foliageSoundTime, 32),
    MSG_PLAYERSTATE_NETFIELD("iFatigueSoundTime", fatigueSoundTime, 32),
    MSG_PLAYERSTATE_NETFIELD("deltaTime", deltaTime, 32),
    MSG_PLAYERSTATE_NETFIELD("serverCursorHint", serverCursorHint, 8),
    MSG_PLAYERSTATE_NETFIELD("serverCursorHintVal", serverCursorHintVal, 8),
    MSG_PLAYERSTATE_NETFIELD("shellshockIndex", motionState.shellshock.index, 4),
    MSG_PLAYERSTATE_NETFIELD("shellshockTime", motionState.shellshock.time, 32),
    MSG_PLAYERSTATE_NETFIELD("shellshockDuration", motionState.shellshock.duration, 16),
    MSG_PLAYERSTATE_NETFIELD("delta_angles[2]", deltaAngles[2], 16),
    MSG_PLAYERSTATE_NETFIELD("vLadderVec[2]", ladderNormal[2], 0),
    MSG_PLAYERSTATE_NETFIELD("clientNum", psClientNum, 8),
    MSG_PLAYERSTATE_NETFIELD("weapons[1]", weaponBits[1], 32),
    MSG_PLAYERSTATE_NETFIELD("weaponrechamber[1]", weaponRechamberBits[1], 32),
    MSG_PLAYERSTATE_NETFIELD("viewangles[2]", viewAngles[2], -100),
    MSG_PLAYERSTATE_NETFIELD("viewHeightLerpPosAdj", viewHeightLerpPosAdj, 0),
    MSG_PLAYERSTATE_NETFIELD("mins[2]", playerMins[2], 0),
    MSG_PLAYERSTATE_NETFIELD("viewlocked", viewLocked, 8),
    MSG_PLAYERSTATE_NETFIELD("viewlocked_entNum", viewLockedEntityNum, 16),
    MSG_PLAYERSTATE_NETFIELD("vehPos", vehiclePosition, 4),
    MSG_PLAYERSTATE_NETFIELD("vehType", vehicleType, 4),
    MSG_PLAYERSTATE_NETFIELD("vehMotion", vehicleMotion, 2),
    MSG_PLAYERSTATE_NETFIELD("weapons[2]", weaponBits[2], 32),
    MSG_PLAYERSTATE_NETFIELD("weapons[3]", weaponBits[3], 32),
    MSG_PLAYERSTATE_NETFIELD("weaponrechamber[2]", weaponRechamberBits[2], 32),
    MSG_PLAYERSTATE_NETFIELD("weaponrechamber[3]", weaponRechamberBits[3], 32)
};

#undef MSG_PLAYERSTATE_NETFIELD

#define MSG_OBJECTIVE_NETFIELD(name_, member_, bits_) \
    {(name_), (int32_t)offsetof(objective_t, member_), (bits_)}

netField_t msg_objectiveNetFields[CODUO_OBJECTIVE_NET_FIELD_COUNT] = {
    MSG_OBJECTIVE_NETFIELD("origin[0]", origin[0], 0),
    MSG_OBJECTIVE_NETFIELD("origin[1]", origin[1], 0),
    MSG_OBJECTIVE_NETFIELD("origin[2]", origin[2], 0),
    MSG_OBJECTIVE_NETFIELD("icon", icon, 12),
    MSG_OBJECTIVE_NETFIELD("entNum", entityNum, 10),
    MSG_OBJECTIVE_NETFIELD("teamNum", teamNum, 4),
};

#undef MSG_OBJECTIVE_NETFIELD

#define MSG_HUD_ELEM_NETFIELD(name_, member_, bits_) \
    {(name_), (int32_t)offsetof(hudElem_t, member_), (bits_)}

netField_t msg_hudElemNetFields[CODUO_HUD_ELEM_NET_FIELD_COUNT] = {
    MSG_HUD_ELEM_NETFIELD("color.rgba", color.rgba, 32),
    MSG_HUD_ELEM_NETFIELD("type", type, 4),
    MSG_HUD_ELEM_NETFIELD("fontScale", fontScale, 0),
    MSG_HUD_ELEM_NETFIELD("y", y, 10),
    MSG_HUD_ELEM_NETFIELD("x", x, 10),
    MSG_HUD_ELEM_NETFIELD("alignY", alignY, 2),
    MSG_HUD_ELEM_NETFIELD("alignX", alignX, 2),
    MSG_HUD_ELEM_NETFIELD("time", timerValue, 32),
    MSG_HUD_ELEM_NETFIELD("font", font, 4),
    MSG_HUD_ELEM_NETFIELD("text", text, 8),
    MSG_HUD_ELEM_NETFIELD("shaderIndex", materialIndex, 8),
    MSG_HUD_ELEM_NETFIELD("width", width, 10),
    MSG_HUD_ELEM_NETFIELD("height", height, 10),
    MSG_HUD_ELEM_NETFIELD("sort", sortKey, 0),
    MSG_HUD_ELEM_NETFIELD("fromColor.rgba", fromColor.rgba, 32),
    MSG_HUD_ELEM_NETFIELD("fadeStartTime", fadeStartTime, 32),
    MSG_HUD_ELEM_NETFIELD("fadeTime", fadeTime, 16),
    MSG_HUD_ELEM_NETFIELD("scaleStartTime", scaleStartTime, 32),
    MSG_HUD_ELEM_NETFIELD("scaleTime", scaleTime, 16),
    MSG_HUD_ELEM_NETFIELD("fromHeight", scaleFromHeight, 10),
    MSG_HUD_ELEM_NETFIELD("value", value, 0),
    MSG_HUD_ELEM_NETFIELD("label", label, 8),
    MSG_HUD_ELEM_NETFIELD("fromWidth", scaleFromWidth, 10),
    MSG_HUD_ELEM_NETFIELD("moveStartTime", moveStartTime, 32),
    MSG_HUD_ELEM_NETFIELD("moveTime", moveTime, 16),
    MSG_HUD_ELEM_NETFIELD("fromX", moveFromX, 10),
    MSG_HUD_ELEM_NETFIELD("fromY", moveFromY, 10),
    MSG_HUD_ELEM_NETFIELD("duration", rotationPeriodMs, 32),
    MSG_HUD_ELEM_NETFIELD("SCOORD", shaderRightTexcoord, 32),
    MSG_HUD_ELEM_NETFIELD("TCOORD", shaderBottomTexcoord, 32),
};

#undef MSG_HUD_ELEM_NETFIELD
