#pragma once #include #include #include "fixed_str.hpp" #include "quantized.hpp" namespace net { enum MessageType : uint8_t { MSG_NONE, /*~~~~~~~~ Client->Server ~~~~~~~~*/ // ID MSG_ID, // IN MSG_IN, // VIEWANGLES MSG_VIEWANGLES, // MENUACTION ... MSG_MENUACTION, /*~~~~~~~~ Session ~~~~~~~~*/ // CHAT MSG_CHAT, /*~~~~~~~~ World ~~~~~~~~*/ // CHWORLD MSG_CHWORLD, // ENV MSG_ENV, // CAM MSG_CAM, // USETARGET ... MSG_USETARGET, // REMOTEMENU ... MSG_REMOTEMENU, /*~~~~~~~~ Entity ~~~~~~~~*/ // ENTSPAWN data... MSG_ENTSPAWN, // ENTMSG data... MSG_ENTMSG, // UPDATEENTS ... MSG_UPDATEENTS, // ENTDESTROY MSG_ENTDESTROY, /*~~~~~~~~ Destructibles ~~~~~~~~*/ // OBJDESTROY MSG_OBJDESTROY, // OBJRESPAWN MSG_OBJRESPAWN, /*~~~~~~~~~~~~~~~~*/ MSG_COUNT, }; using PlayerName = FixedStr<64>; using MapName = FixedStr<32>; using ModelName = FixedStr<64>; using ChatMessage = FixedStr<1024>; // pi approx fraction constexpr long long PI_N = 245850922; constexpr long long PI_D = 78256779; using ViewYawQ = Quantized; using ViewPitchQ = Quantized; // env using DayTimeQ = Quantized; // entities using EntNum = uint16_t; using EntCount = EntNum; enum EntType : uint8_t { ET_NONE, ET_SIMPLE, ET_CHARACTER, ET_VEHICLE, ET_MARKER, ET_COUNT, }; enum EntMsgType : uint8_t { EMSG_NONE, EMSG_NAMETAG, EMSG_ATTACH, // EMSG_UPDATE, // deprecated EMSG_PLAYSOUND, EMSG_DEFORM, EMSG_TUNING, }; using PositionElemQ = Quantized; struct PositionQ { PositionElemQ x, y, z; }; using AngleQ = Quantized; using PositiveAngleQ = Quantized; using QuatElemQ = Quantized; struct QuatQ { QuatElemQ x, y, z; }; using WheelZOffsetQ = Quantized; using RotationSpeedQ = Quantized; using ColorQ = Quantized; using NameTag = FixedStr<64>; using SoundName = FixedStr<64>; using SoundVolumeQ = Quantized; using SoundPitchQ = Quantized; using AnimBlendQ = Quantized; using AnimTimeQ = Quantized; using AnimAimAngleQ = Quantized; using NumClothes = uint8_t; using ClothesName = FixedStr<32>; // destructibles using ObjNum = uint16_t; using ObjCount = ObjNum; using NumTexels = uint16_t; // version using Version = uint32_t; // tuning using TuningPartIdx = uint8_t; // use target using UseTargetName = FixedStr<128>; using UseDelayQ = Quantized; // remote menu enum MenuMessageType { MMSG_CREATE, MMSG_UPDATE, MMSG_ITEM_UPDATE_TEXT, MMSG_ITEM_UPDATE_SELECTION, MMSG_SET_HOVER, MMSG_CLOSE, }; using MenuId = uint8_t; using MenuTitle = FixedStr<64>; using MenuItemId = uint8_t; using MenuItemCount = MenuItemId; using MenuItemText = FixedStr<64>; using MenuItemSelection = FixedStr<64>; // menu actions enum MenuActionType { MA_CLICK, MA_SELECT, MA_HOVER, MA_EXIT, }; using MenuSelectDir = uint8_t; // 0=left, 1=right } // namespace net