diff --git a/src/game/client/cdll_int.cpp b/src/game/client/cdll_int.cpp index 55ef08f0e..6f5073dc4 100644 --- a/src/game/client/cdll_int.cpp +++ b/src/game/client/cdll_int.cpp @@ -47,26 +47,23 @@ void InitInput(); void EV_HookEvents(); void IN_Commands(); -/* -================================ -HUD_GetHullBounds - - Engine calls this to enumerate player collision hulls, for prediction. Return 0 if the hullnumber doesn't exist. -================================ -*/ +/** + * @brief Engine calls this to enumerate player collision hulls, for prediction. + * @return 0 if the hullnumber doesn't exist, 1 otherwise. + */ int DLLEXPORT HUD_GetHullBounds(int hullnumber, float* mins, float* maxs) { return static_cast(PM_GetHullBounds(hullnumber, mins, maxs)); } -/* -================================ -HUD_ConnectionlessPacket - - Return 1 if the packet is valid. Set response_buffer_size if you want to send a response packet. Incoming, it holds the max - size of the response_buffer, so you must zero it out if you choose not to respond. -================================ -*/ +/** + * @brief Return 1 if the packet is valid. + * @param net_from Address of the sender. + * @param args Argument string. + * @param response_buffer Buffer to write a response message to. + * @param[in,out] response_buffer_size Initially holds the maximum size of @p response_buffer. + * Set to size of response message or 0 if sending no response. + */ int DLLEXPORT HUD_ConnectionlessPacket(const netadr_t* net_from, const char* args, char* response_buffer, int* response_buffer_size) { // Parse stuff from args @@ -119,17 +116,10 @@ int DLLEXPORT Initialize(cl_enginefunc_t* pEnginefuncs, int iVersion) return 1; } - -/* -========================== - HUD_VidInit - -Called when the game initializes -and whenever the vid_mode is changed -so the HUD can reinitialize itself. -========================== -*/ - +/** + * @brief Called whenever the client connects to a server. Reinitializes all the hud variables. + * @details The original documentation for this and HUD_Init() were swapped. + */ int DLLEXPORT HUD_VidInit() { g_Client.VidInit(); @@ -143,16 +133,10 @@ int DLLEXPORT HUD_VidInit() return 1; } -/* -========================== - HUD_Init - -Called whenever the client connects -to a server. Reinitializes all -the hud variables. -========================== -*/ - +/** + * @brief Called when the game initializes and whenever the vid_mode is changed so the HUD can reinitialize itself. + * @details The original documentation for this and HUD_VidInit() were swapped. + */ void DLLEXPORT HUD_Init() { g_Client.HudInit(); @@ -161,16 +145,9 @@ void DLLEXPORT HUD_Init() Scheme_Init(); } - -/* -========================== - HUD_Redraw - -called every screen frame to -redraw the HUD. -=========================== -*/ - +/** + * @brief called every screen frame to redraw the HUD. + */ int DLLEXPORT HUD_Redraw(float time, int intermission) { gHUD.Redraw(time, 0 != intermission); @@ -178,19 +155,11 @@ int DLLEXPORT HUD_Redraw(float time, int intermission) return 1; } - -/* -========================== - HUD_UpdateClientData - -called every time shared client -dll/engine data gets changed, -and gives the cdll a chance -to modify the data. - -returns 1 if anything has been changed, 0 otherwise. -========================== -*/ +/** + * @brief called every time shared client dll/engine data gets changed, + * and gives the cdll a chance to modify the data. + * @return 1 if anything has been changed, 0 otherwise. + */ int DLLEXPORT HUD_UpdateClientData(client_data_t* pcldata, float flTime) { @@ -199,27 +168,18 @@ int DLLEXPORT HUD_UpdateClientData(client_data_t* pcldata, float flTime) return static_cast(gHUD.UpdateClientData(pcldata, flTime)); } -/* -========================== - HUD_Reset - -Called at start and end of demos to restore to "non"HUD state. -========================== -*/ - +/** + * @brief Called at start and end of demos to restore to "non"HUD state. + * @details Never called in Steam Half-Life. + */ void DLLEXPORT HUD_Reset() { gHUD.VidInit(); } -/* -========================== -HUD_Frame - -Called by engine every frame that client .dll is loaded -========================== -*/ - +/** + * @brief Called by engine every frame that client .dll is loaded + */ void DLLEXPORT HUD_Frame(double time) { GetClientVoiceMgr()->Frame(time); @@ -227,28 +187,17 @@ void DLLEXPORT HUD_Frame(double time) g_Client.RunFrame(); } - -/* -========================== -HUD_VoiceStatus - -Called when a player starts or stops talking. -========================== -*/ - +/** + * @brief Called when a player starts or stops talking. + */ void DLLEXPORT HUD_VoiceStatus(int entindex, qboolean bTalking) { GetClientVoiceMgr()->UpdateSpeakerStatus(entindex, 0 != bTalking); } -/* -========================== -HUD_DirectorMessage - -Called when a director event message was received -========================== -*/ - +/** + * @brief Called when a director event message was received + */ void DLLEXPORT HUD_DirectorMessage(int iSize, void* pbuf) { BufferReader reader{{reinterpret_cast(pbuf), static_cast(iSize)}}; @@ -273,6 +222,11 @@ void CL_LoadParticleMan() } } +/** + * @brief Used by Steam Half-Life to load the client dll interface. + * If not present, the client dll will be unloaded, global destructors will run, the client dll will be loaded again + * and functions will be retrieved using GetProcAddress/dlsym. + */ extern "C" void DLLEXPORT F(void* pv) { cldll_func_t* pcldll_func = (cldll_func_t*)pv; @@ -327,13 +281,16 @@ extern "C" void DLLEXPORT F(void* pv) #include "cl_dll/IGameClientExports.h" -//----------------------------------------------------------------------------- -// Purpose: Exports functions that are used by the gameUI for UI dialogs -//----------------------------------------------------------------------------- +/** + * @brief Exports functions that are used by the gameUI for UI dialogs + */ class CClientExports : public IGameClientExports { public: - // returns the name of the server the user is connected to, if any + /** + * @brief returns the name of the server the user is connected to, if any + * @details Does not appear to be called in Steam Half-Life + */ const char* GetServerHostName() override { /*if (gViewPortInterface) diff --git a/src/game/client/entity.cpp b/src/game/client/entity.cpp index f765b3036..80e064ffa 100644 --- a/src/game/client/entity.cpp +++ b/src/game/client/entity.cpp @@ -36,12 +36,9 @@ static TEMPENTITY gTempEnts[MAX_TEMPENTS]; static TEMPENTITY* gpTempEntFree = nullptr; static TEMPENTITY* gpTempEntActive = nullptr; -/* -======================== -HUD_AddEntity - Return 0 to filter entity from visible list for rendering -======================== -*/ +/** + * @brief Return 0 to filter entity from visible list for rendering + */ int DLLEXPORT HUD_AddEntity(int type, cl_entity_t* ent, const char* modelname) { switch (type) @@ -72,15 +69,12 @@ int DLLEXPORT HUD_AddEntity(int type, cl_entity_t* ent, const char* modelname) return 1; } -/* -========================= -HUD_TxferLocalOverrides - -The server sends us our origin with extra precision as part of the clientdata structure, not during the normal -playerstate update in entity_state_t. In order for these overrides to eventually get to the appropriate playerstate -structure, we need to copy them into the state structure at this point. -========================= -*/ +/** + * @brief The server sends us our origin with extra precision as part of the clientdata structure, + * not during the normal playerstate update in entity_state_t. + * In order for these overrides to eventually get to the appropriate playerstate structure, + * we need to copy them into the state structure at this point. + */ void DLLEXPORT HUD_TxferLocalOverrides(entity_state_t* state, const clientdata_t* client) { state->origin = client->origin; @@ -96,14 +90,10 @@ void DLLEXPORT HUD_TxferLocalOverrides(entity_state_t* state, const clientdata_t state->iuser4 = client->iuser4; } -/* -========================= -HUD_ProcessPlayerState - -We have received entity_state_t for this player over the network. We need to copy appropriate fields to the -playerstate structure -========================= -*/ +/** + * @brief We have received entity_state_t for this player over the network. + * We need to copy appropriate fields to the playerstate structure + */ void DLLEXPORT HUD_ProcessPlayerState(entity_state_t* dst, const entity_state_t* src) { // Copy in network data @@ -161,16 +151,13 @@ void DLLEXPORT HUD_ProcessPlayerState(entity_state_t* dst, const entity_state_t* } } -/* -========================= -HUD_TxferPredictionData - -Because we can predict an arbitrary number of frames before the server responds with an update, we need to be able to copy client side prediction data in - from the state that the server ack'd receiving, which can be anywhere along the predicted frame path ( i.e., we could predict 20 frames into the future and the server ack's - up through 10 of those frames, so we need to copy persistent client-side only state from the 10th predicted frame to the slot the server - update is occupying. -========================= -*/ +/** + * @brief Because we can predict an arbitrary number of frames before the server responds with an update, + * we need to be able to copy client side prediction data in from the state that the server ack'd receiving, + * which can be anywhere along the predicted frame path ( i.e., we could predict 20 frames into the future + * and the server ack's up through 10 of those frames ), so we need to copy persistent client-side only state + * from the 10th predicted frame to the slot the server update is occupying. + */ void DLLEXPORT HUD_TxferPredictionData(entity_state_t* ps, const entity_state_t* pps, clientdata_t* pcd, const clientdata_t* ppcd, weapon_data_t* wd, const weapon_data_t* pwd) { ps->oldbuttons = pps->oldbuttons; @@ -296,13 +283,9 @@ void Beams() } #endif -/* -========================= -HUD_CreateEntities - -Gives us a chance to add additional entities to the render this frame -========================= -*/ +/** + * @brief Gives us a chance to add additional entities to the render this frame + */ void DLLEXPORT HUD_CreateEntities() { #if defined(BEAM_TEST) @@ -315,15 +298,10 @@ void DLLEXPORT HUD_CreateEntities() GetClientVoiceMgr()->CreateEntities(); } - -/* -========================= -HUD_StudioEvent - -The entity's studio model description indicated an event was -fired during this frame, handle the event by it's tag ( e.g., muzzleflash, sound ) -========================= -*/ +/** + * @brief The entity's studio model description indicated an event was fired during this frame, + * handle the event by it's tag ( e.g., muzzleflash, sound ) + */ void DLLEXPORT HUD_StudioEvent(const mstudioevent_t* event, const cl_entity_t* entity) { bool iMuzzleFlash = true; @@ -364,14 +342,20 @@ void DLLEXPORT HUD_StudioEvent(const mstudioevent_t* event, const cl_entity_t* e /** * @brief Simulation and cleanup of temporary entities + * @param frametime Simulation time + * @param client_time Absolute time on client + * @param cl_gravity True gravity on client + * @param ppTempEntFree List of freed temporary ents + * @param ppTempEntActive List of active temporary ents + * @param Callback_AddVisibleEntity Callback to add an entity to the list of visible entities to draw this frame * @param Callback_TempEntPlaySound Obsolete. Use CL_TempEntPlaySound instead. */ void DLLEXPORT HUD_TempEntUpdate( - double frametime, // Simulation time - double client_time, // Absolute time on client - double cl_gravity, // True gravity on client - TEMPENTITY** ppTempEntFree, // List of freed temporary ents - TEMPENTITY** ppTempEntActive, // List + double frametime, + double client_time, + double cl_gravity, + TEMPENTITY** ppTempEntFree, + TEMPENTITY** ppTempEntActive, int (*Callback_AddVisibleEntity)(cl_entity_t* pEntity), void (*Callback_TempEntPlaySound)(TEMPENTITY* pTemp, float damp)) { @@ -737,17 +721,12 @@ void DLLEXPORT HUD_TempEntUpdate( gEngfuncs.pEventAPI->EV_PopPMStates(); } -/* -================= -HUD_GetUserEntity - -If you specify negative numbers for beam start and end point entities, then - the engine will call back into this function requesting a pointer to a cl_entity_t - object that describes the entity to attach the beam onto. - -Indices must start at 1, not zero. -================= -*/ +/** + * @brief If you specify negative numbers for beam start and end point entities, + * then the engine will call back into this function requesting a pointer to a cl_entity_t object + * that describes the entity to attach the beam onto. + * Indices must start at 1, not zero. + */ cl_entity_t DLLEXPORT* HUD_GetUserEntity(int index) { #if defined(BEAM_TEST) diff --git a/src/game/client/hl/hl_weapons.cpp b/src/game/client/hl/hl_weapons.cpp index b9895b335..4017b1392 100644 --- a/src/game/client/hl/hl_weapons.cpp +++ b/src/game/client/hl/hl_weapons.cpp @@ -307,17 +307,16 @@ void SetLocalBody(int id, int body) } } -/* -===================== -HUD_PostRunCmd - -Client calls this during prediction, after it has moved the player and updated any info changed into to-> -time is the current client clock based on prediction -cmd is the command that caused the movement, etc -runfuncs is 1 if this is the first time we've predicted this command. If so, sounds and effects should play, otherwise, they should -be ignored -===================== -*/ +/** + * @brief Client calls this during prediction, after it has moved the player and updated any info changed into @p to. + * @param from Incoming state. + * @param to Outgoing state. This should be @p from, modified by predicted actions. + * @param cmd The command that caused the movement, etc. + * @param runfuncs 1 if this is the first time we've predicted this command. If so, sounds and effects should play, + * otherwise they should be ignored. + * @param time the current client clock based on prediction. + * @param random_seed Random number generator seed shared between server and client. + */ void DLLEXPORT HUD_PostRunCmd(local_state_t* from, local_state_t* to, usercmd_t* cmd, int runfuncs, double time, unsigned int random_seed) { g_runfuncs = 0 != runfuncs; diff --git a/src/game/client/input/input.cpp b/src/game/client/input/input.cpp index a82f812d6..5c866a5a7 100644 --- a/src/game/client/input/input.cpp +++ b/src/game/client/input/input.cpp @@ -112,15 +112,11 @@ struct kblist_t kblist_t* g_kbkeys = nullptr; -/* -============ -KB_ConvertString - -Removes references to +use and replaces them with the keyname in the output string. If - a binding is unfound, then the original text is retained. -NOTE: Only works for text with +word in it. -============ -*/ +/** + * @brief Removes references to +use and replaces them with the keyname in the output string. + * If a binding is unfound, then the original text is retained. + * NOTE: Only works for text with +word in it. + */ std::string KB_ConvertString(const char* in) { char binding[64]; @@ -179,13 +175,10 @@ std::string KB_ConvertString(const char* in) return buffer; } -/* -============ -KB_Find - -Allows the engine to get a kbutton_t directly ( so it can check +mlook state, etc ) for saving out to .cfg files -============ -*/ +/** + * @brief Allows the engine to get a kbutton_t directly ( so it can check +mlook state, etc ) + * for saving out to .cfg files + */ kbutton_t DLLEXPORT* KB_Find(const char* name) { kblist_t* p; @@ -200,13 +193,9 @@ kbutton_t DLLEXPORT* KB_Find(const char* name) return nullptr; } -/* -============ -KB_Add - -Add a kbutton_t * to the list of pointers the engine can retrieve via KB_Find -============ -*/ +/** + * @brief Add a kbutton_t* to the list of pointers the engine can retrieve via KB_Find + */ void KB_Add(const char* name, kbutton_t* pkb) { kblist_t* p; @@ -227,13 +216,9 @@ void KB_Add(const char* name, kbutton_t* pkb) g_kbkeys = p; } -/* -============ -KB_Init - -Add kbutton_t definitions that the engine can query if needed -============ -*/ +/** + * @brief Add kbutton_t definitions that the engine can query if needed + */ void KB_Init() { g_kbkeys = nullptr; @@ -243,13 +228,9 @@ void KB_Init() KB_Add("in_jlook", &in_jlook); } -/* -============ -KB_Shutdown - -Clear kblist -============ -*/ +/** + * @brief Clear kblist + */ void KB_Shutdown() { kblist_t *p, *n; @@ -263,11 +244,6 @@ void KB_Shutdown() g_kbkeys = nullptr; } -/* -============ -KeyDown -============ -*/ void KeyDown(kbutton_t* b) { int k; @@ -297,11 +273,6 @@ void KeyDown(kbutton_t* b) b->state |= 1 + 2; // down + impulse down } -/* -============ -KeyUp -============ -*/ void KeyUp(kbutton_t* b) { int k; @@ -336,13 +307,9 @@ void KeyUp(kbutton_t* b) b->state |= 4; // impulse up } -/* -============ -HUD_Key_Event - -Return 1 to allow engine to process the key, otherwise, act on it as needed -============ -*/ +/** + * @brief Return 1 to allow engine to process the key, otherwise, act on it as needed + */ int DLLEXPORT HUD_Key_Event(int down, int keynum, const char* pszCurrentBinding) { if (gViewPort) @@ -515,16 +482,14 @@ void IN_MLookUp() } } -/* -=============== -CL_KeyState - -Returns 0.25 if a key was pressed and released during the frame, -0.5 if it was pressed and held -0 if held then released, and -1.0 if held for the entire time -=============== -*/ +/** + * @brief
+ *	Returns 0.25 if a key was pressed and released during the frame,
+ *	0.5 if it was pressed and held
+ *	0 if held then released, and
+ *	1.0 if held for the entire time
+ *	
+ */ float CL_KeyState(kbutton_t* key) { float val = 0.0; @@ -570,13 +535,9 @@ float CL_KeyState(kbutton_t* key) return val; } -/* -================ -CL_AdjustAngles - -Moves the local angle positions -================ -*/ +/** + * @brief Moves the local angle positions + */ void CL_AdjustAngles(float frametime, Vector& viewangles) { float speed; @@ -624,15 +585,11 @@ void CL_AdjustAngles(float frametime, Vector& viewangles) viewangles[ROLL] = -50; } -/* -================ -CL_CreateMove - -Send the intended movement message to the server -if active == 1 then we are 1) not playing back demos ( where our commands are ignored ) and -2 ) we have finished signing on to server -================ -*/ +/** + * @brief Send the intended movement message to the server + * @details if active == 1 then we are 1) not playing back demos ( where our commands are ignored ) and + * 2 ) we have finished signing on to server + */ void DLLEXPORT CL_CreateMove(float frametime, usercmd_t* cmd, int active) { float spd; @@ -738,26 +695,18 @@ void DLLEXPORT CL_CreateMove(float frametime, usercmd_t* cmd, int active) } } -/* -============ -CL_IsDead - -Returns 1 if health is <= 0 -============ -*/ +/** + * @brief Returns 1 if health is <= 0 + */ bool CL_IsDead() { return gHUD.m_Health.m_iHealth <= 0; } -/* -============ -CL_ButtonBits - -Returns appropriate button info for keyboard and mouse state -Set bResetState to 1 to clear old state info -============ -*/ +/** + * @brief Returns appropriate button info for keyboard and mouse state + * @param bResetState Set to 1 to clear old state info + */ int CL_ButtonBits(bool bResetState) { int bits = 0; @@ -864,12 +813,6 @@ int CL_ButtonBits(bool bResetState) return bits; } -/* -============ -CL_ResetButtonBits - -============ -*/ void CL_ResetButtonBits(int bits) { int bitsNew = CL_ButtonBits(false) ^ bits; @@ -890,11 +833,6 @@ void CL_ResetButtonBits(int bits) } } -/* -============ -InitInput -============ -*/ void InitInput() { gEngfuncs.pfnAddCommand("+moveup", IN_UpDown); @@ -981,11 +919,6 @@ void InitInput() V_Init(); } -/* -============ -ShutdownInput -============ -*/ void ShutdownInput() { IN_Shutdown(); @@ -995,7 +928,6 @@ void ShutdownInput() #include "interface.h" void CL_UnloadParticleMan(); - void DLLEXPORT HUD_Shutdown() { gHUD.Shutdown(); diff --git a/src/game/client/input/inputw32.cpp b/src/game/client/input/inputw32.cpp index 9d603f421..e7cd2d8a4 100644 --- a/src/game/client/input/inputw32.cpp +++ b/src/game/client/input/inputw32.cpp @@ -36,8 +36,8 @@ bool g_iVisibleMouse = false; /** -* @brief Tells the input code to reset the mouse position to center. -*/ + * @brief Tells the input code to reset the mouse position to center. + */ bool g_ResetMousePosition = false; extern bool iMouseInUse; @@ -163,11 +163,6 @@ cvar_t* joy_wwhack2; bool joy_avail, joy_advancedinit, joy_haspov; -/* -=========== -Force_CenterView_f -=========== -*/ void Force_CenterView_f() { Vector viewangles; @@ -243,11 +238,6 @@ void MousePos_ThreadFunction() } #endif -/* -=========== -IN_ActivateMouse -=========== -*/ void DLLEXPORT IN_ActivateMouse() { // This is the first function called after the engine has initialized itself, allowing us to do some post-init work. @@ -312,11 +302,6 @@ void DLLEXPORT IN_DeactivateMouse() SDL_SetRelativeMouseMode(SDL_FALSE); } -/* -=========== -IN_StartupMouse -=========== -*/ void IN_StartupMouse() { if (0 != gEngfuncs.CheckParm("-nomouse", nullptr)) @@ -349,11 +334,6 @@ void IN_StartupMouse() mouse_buttons = MOUSE_BUTTON_COUNT; } -/* -=========== -IN_Shutdown -=========== -*/ void IN_Shutdown() { // Reset flag in case we're reloading due to video setting change. @@ -376,25 +356,17 @@ void IN_Shutdown() #endif } -/* -=========== -IN_GetMousePos - -Ask for mouse position from engine -=========== -*/ +/** + * @brief Ask for mouse position from engine + */ void IN_GetMousePos(int* mx, int* my) { gEngfuncs.GetMousePosition(mx, my); } -/* -=========== -IN_ResetMouse - -FIXME: Call through to engine? -=========== -*/ +/** + * @brief FIXME: Call through to engine? + */ void IN_ResetMouse() { // no work to do in SDL @@ -415,11 +387,6 @@ void IN_ResetMouse() #endif } -/* -=========== -IN_MouseEvent -=========== -*/ void DLLEXPORT IN_MouseEvent(int mstate) { int i; @@ -446,12 +413,9 @@ void DLLEXPORT IN_MouseEvent(int mstate) mouse_oldbuttonstate = mstate; } -//----------------------------------------------------------------------------- -// Purpose: Allows modulation of mouse scaling/senstivity value and application -// of custom algorithms. -// Input : *x - -// *y - -//----------------------------------------------------------------------------- +/** + * @brief Allows modulation of mouse scaling/senstivity value and application of custom algorithms. + */ void IN_ScaleMouse(float& x, float& y) { float mx = x; @@ -495,11 +459,6 @@ void IN_ScaleMouse(float& x, float& y) } } -/* -=========== -IN_MouseMove -=========== -*/ void IN_MouseMove(float frametime, usercmd_t* cmd) { Point pos; @@ -638,11 +597,6 @@ void IN_MouseMove(float frametime, usercmd_t* cmd) */ } -/* -=========== -IN_Accumulate -=========== -*/ void DLLEXPORT IN_Accumulate() { // only accumulate mouse if we are not moving the camera with the mouse @@ -676,11 +630,6 @@ void DLLEXPORT IN_Accumulate() } } -/* -=================== -IN_ClearStates -=================== -*/ void DLLEXPORT IN_ClearStates() { if (!mouseactive) @@ -691,11 +640,6 @@ void DLLEXPORT IN_ClearStates() mouse_oldbuttonstate = 0; } -/* -=============== -IN_StartupJoystick -=============== -*/ void IN_StartupJoystick() { // abort startup if user requests no joystick @@ -738,7 +682,6 @@ void IN_StartupJoystick() } } - int RawValuePointer(int axis) { switch (axis) @@ -755,11 +698,6 @@ int RawValuePointer(int axis) } } -/* -=========== -Joy_AdvancedUpdate_f -=========== -*/ void Joy_AdvancedUpdate_f() { @@ -816,12 +754,6 @@ void Joy_AdvancedUpdate_f() } } - -/* -=========== -IN_Commands -=========== -*/ void IN_Commands() { int i, key_index; @@ -888,24 +820,12 @@ void IN_Commands() } } - -/* -=============== -IN_ReadJoystick -=============== -*/ bool IN_ReadJoystick() { SDL_JoystickUpdate(); return true; } - -/* -=========== -IN_JoyMove -=========== -*/ void IN_JoyMove(float frametime, usercmd_t* cmd) { float speed, aspeed; @@ -1087,11 +1007,6 @@ void IN_JoyMove(float frametime, usercmd_t* cmd) gEngfuncs.SetViewAngles(viewangles); } -/* -=========== -IN_Move -=========== -*/ void IN_Move(float frametime, usercmd_t* cmd) { if (g_ResetMousePosition) @@ -1108,11 +1023,6 @@ void IN_Move(float frametime, usercmd_t* cmd) IN_JoyMove(frametime, cmd); } -/* -=========== -IN_Init -=========== -*/ void IN_Init() { m_filter = gEngfuncs.pfnRegisterVariable("m_filter", "0", FCVAR_ARCHIVE); diff --git a/src/game/client/rendering/GameStudioModelRenderer.cpp b/src/game/client/rendering/GameStudioModelRenderer.cpp index 07e4626cb..e8c17f53e 100644 --- a/src/game/client/rendering/GameStudioModelRenderer.cpp +++ b/src/game/client/rendering/GameStudioModelRenderer.cpp @@ -85,13 +85,9 @@ r_studio_interface_t studio = R_StudioDrawPlayer, }; -/* -==================== -HUD_GetStudioModelInterface - -Export this function for the engine to use the studio renderer class to render objects. -==================== -*/ +/** + * @brief Export this function for the engine to use the studio renderer class to render objects. + */ int DLLEXPORT HUD_GetStudioModelInterface(int version, r_studio_interface_t** ppinterface, engine_studio_api_t* pstudio) { if (version != STUDIO_INTERFACE_VERSION) diff --git a/src/game/client/rendering/tri.cpp b/src/game/client/rendering/tri.cpp index 14694e67e..0e1a80029 100644 --- a/src/game/client/rendering/tri.cpp +++ b/src/game/client/rendering/tri.cpp @@ -30,26 +30,17 @@ void RenderFog() } } -/* -================= -HUD_DrawNormalTriangles - -Non-transparent triangles-- add them here -================= -*/ +/** + * @brief Non-transparent triangles-- add them here + */ void DLLEXPORT HUD_DrawNormalTriangles() { gHUD.m_Spectator.DrawOverview(); } - -/* -================= -HUD_DrawTransparentTriangles - -Render any triangles with transparent rendermode needs here -================= -*/ +/** + * @brief Render any triangles with transparent rendermode needs here + */ void DLLEXPORT HUD_DrawTransparentTriangles() { if (g_pParticleMan) diff --git a/src/game/client/ui/vgui/vgui_SpectatorPanel.cpp b/src/game/client/ui/vgui/vgui_SpectatorPanel.cpp index 04f1ecbb3..4e1cf5c66 100644 --- a/src/game/client/ui/vgui/vgui_SpectatorPanel.cpp +++ b/src/game/client/ui/vgui/vgui_SpectatorPanel.cpp @@ -13,14 +13,9 @@ #include "Exports.h" -/* -========================== -HUD_ChatInputPosition - -Sets the location of the input for chat text -========================== -*/ - +/** + * @brief Sets the location of the input for chat text + */ void DLLEXPORT HUD_ChatInputPosition(int* x, int* y) { *y = gHUD.m_SayText.GetChatYInputPosition(); diff --git a/src/game/server/client.cpp b/src/game/server/client.cpp index 1cc2af3a2..bd6bc500e 100644 --- a/src/game/server/client.cpp +++ b/src/game/server/client.cpp @@ -44,13 +44,9 @@ unsigned int g_ulFrameCount; -/* -=========== -ClientConnect - -called when a player connects to a server -============ -*/ +/** + * @brief called when a player connects to a server + */ qboolean ClientConnect(edict_t* pEntity, const char* pszName, const char* pszAddress, char szRejectReason[128]) { return static_cast(g_pGameRules->ClientConnected(pEntity, pszName, pszAddress, szRejectReason)); @@ -61,15 +57,9 @@ qboolean ClientConnect(edict_t* pEntity, const char* pszName, const char* pszAdd } -/* -=========== -ClientDisconnect - -called when a player disconnects from a server - -GLOBALS ASSUMED SET: g_fGameOver -============ -*/ +/** + * @brief called when a player disconnects from a server + */ void ClientDisconnect(edict_t* pEntity) { if (g_fGameOver) @@ -117,7 +107,9 @@ void ClientDisconnect(edict_t* pEntity) } -// called by ClientKill and DeadThink +/** + * @brief called by ClientKill and DeadThink + */ void respawn(CBasePlayer* player, bool fCopyCorpse) { if (g_pGameRules->IsMultiplayer()) @@ -137,13 +129,9 @@ void respawn(CBasePlayer* player, bool fCopyCorpse) } } -/* -============ -ClientKill - -Player entered the suicide command -============ -*/ +/** + * @brief Player entered the suicide command + */ void ClientKill(edict_t* pEntity) { CBasePlayer* pl = ToBasePlayer(pEntity); @@ -169,13 +157,9 @@ void ClientKill(edict_t* pEntity) // respawn( pev ); } -/* -=========== -ClientPutInServer - -called each time a player is spawned -============ -*/ +/** + * @brief called each time a player is spawned + */ void ClientPutInServer(edict_t* pEntity) { auto pPlayer = g_EntityDictionary->Create("player", &pEntity->v); @@ -202,8 +186,6 @@ void ClientPutInServer(edict_t* pEntity) #include "voice_gamemgr.h" extern CVoiceGameMgr g_VoiceGameMgr; - - #if defined(_MSC_VER) || defined(WIN32) typedef wchar_t uchar16; typedef unsigned int uchar32; @@ -212,9 +194,9 @@ typedef unsigned short uchar16; typedef wchar_t uchar32; #endif -//----------------------------------------------------------------------------- -// Purpose: determine if a uchar32 represents a valid Unicode code point -//----------------------------------------------------------------------------- +/** + * @brief determine if a uchar32 represents a valid Unicode code point + */ bool Q_IsValidUChar32(uchar32 uVal) { // Values > 0x10FFFF are explicitly invalid; ditto for UTF-16 surrogate halves, @@ -222,9 +204,11 @@ bool Q_IsValidUChar32(uchar32 uVal) return (uVal < 0x110000u) && ((uVal - 0x00D800u) > 0x7FFu) && ((uVal & 0xFFFFu) < 0xFFFEu) && ((uVal - 0x00FDD0u) > 0x1Fu); } - -// Decode one character from a UTF-8 encoded string. Treats 6-byte CESU-8 sequences -// as a single character, as if they were a correctly-encoded 4-byte UTF-8 sequence. +/* + * @brief Decode one character from a UTF-8 encoded string. + * @details Treats 6-byte CESU-8 sequences as a single character, + * as if they were a correctly-encoded 4-byte UTF-8 sequence. + */ int Q_UTF8ToUChar32(const char* pUTF8_, uchar32& uValueOut, bool& bErrorOut) { const uint8* pUTF8 = (const uint8*)pUTF8_; @@ -296,11 +280,9 @@ int Q_UTF8ToUChar32(const char* pUTF8_, uchar32& uValueOut, bool& bErrorOut) goto decodeFinished; } - - -//----------------------------------------------------------------------------- -// Purpose: Returns true if UTF-8 string contains invalid sequences. -//----------------------------------------------------------------------------- +/** + * @brief Returns true if UTF-8 string contains invalid sequences. + */ bool Q_UnicodeValidate(const char* pUTF8) { bool bError = false; @@ -317,12 +299,15 @@ bool Q_UnicodeValidate(const char* pUTF8) return true; } -//// HOST_SAY -// String comes in as -// say blah blah blah -// or as -// blah blah blah -// +/** + * @brief Handles incoming @c say and @c say_team commands and sends them to other players. + *
+ *	String comes in as
+ *	say blah blah blah
+ *	or as
+ *	blah blah blah
+ *	
+ */ void Host_Say(CBasePlayer* player, bool teamonly) { int j; @@ -994,8 +979,7 @@ void SV_CreateClientCommands() UTIL_ConsolePrint(player, "NPC fell out of level\n"); UTIL_Remove(entity); } - } - }, + } }, {.Flags = ClientCommandFlag::Cheat}); } @@ -1010,13 +994,10 @@ bool UTIL_CheatsAllowed(CBasePlayer* player, std::string_view name) return true; } -/* -=========== -ClientCommand -called each time a player uses a "cmd" command -============ -*/ -// Use CMD_ARGV, CMD_ARGV, and CMD_ARGC to get pointers the character string command. +/** + * @brief called each time a player uses a @c "cmd" command + * @details Use CMD_ARGV, CMD_ARGV, and CMD_ARGC to get pointers the character string command. + */ void ExecuteClientCommand(edict_t* pEntity) { // Is the client spawned yet? @@ -1049,13 +1030,9 @@ void ExecuteClientCommand(edict_t* pEntity) } -/* -======================== -ClientUserInfoChanged - -called after the player changes -userinfo - gives dll a chance to modify it before -it gets sent into the rest of the engine. +/** +* @brief called after the player changes userinfo. +* gives dll a chance to modify it before it gets sent into the rest of the engine. ======================== */ void ClientUserInfoChanged(edict_t* pEntity, char* infobuffer) @@ -1152,13 +1129,9 @@ void ServerActivate(edict_t* pEdictList, int edictCount, int clientMax) } -/* -================ -PlayerPreThink - -Called every frame before physics are run -================ -*/ +/** + * @brief Called every frame before physics are run + */ void PlayerPreThink(edict_t* pEntity) { CBasePlayer* pPlayer = ToBasePlayer(pEntity); @@ -1167,13 +1140,9 @@ void PlayerPreThink(edict_t* pEntity) pPlayer->PreThink(); } -/* -================ -PlayerPostThink - -Called every frame after physics are run -================ -*/ +/** + * @brief Called every frame after physics are run + */ void PlayerPostThink(edict_t* pEntity) { CBasePlayer* pPlayer = ToBasePlayer(pEntity); @@ -1182,13 +1151,10 @@ void PlayerPostThink(edict_t* pEntity) pPlayer->PostThink(); } - - void ParmsNewLevel() { } - void ParmsChangeLevel() { // retrieve the pointer to the save data @@ -1198,7 +1164,6 @@ void ParmsChangeLevel() pSaveData->connectionCount = CChangeLevel::ChangeList(pSaveData->levelList, MAX_LEVEL_CONNECTIONS); } - // // GLOBALS ASSUMED SET: g_ulFrameCount // @@ -1215,7 +1180,6 @@ void StartFrame() g_ulFrameCount++; } - void ClientPrecache() { g_GameLogger->trace("Precaching player assets"); @@ -1346,13 +1310,9 @@ void ClientPrecache() UTIL_PrecacheOther("monster_human_grunt"); } -/* -=============== -GetGameDescription - -Returns the descriptive name of this .dll. E.g., Half-Life, or Team Fortress 2 -=============== -*/ +/** + * @brief Returns the descriptive name of this .dll. E.g., Half-Life, or Team Fortress 2 + */ const char* GetGameDescription() { if (g_pGameRules) // this function may be called before the world has spawned, and the game rules initialized @@ -1361,27 +1321,18 @@ const char* GetGameDescription() return "Half-Life"; } -/* -================ -Sys_Error - -Engine is going to shut down, allows setting a breakpoint in game .dll to catch that occasion -================ -*/ +/** + * @brief Engine is going to shut down, allows setting a breakpoint in game .dll to catch that occasion + */ void Sys_Error(const char* error_string) { // Default case, do nothing. MOD AUTHORS: Add code ( e.g., _asm { int 3 }; here to cause a breakpoint for debugging your game .dlls } -/* -================ -PlayerCustomization - -A new player customization has been registered on the server -UNDONE: This only sets the # of frames of the spray can logo -animation right now. -================ -*/ +/** + * @brief A new player customization has been registered on the server + * @details UNDONE: This only sets the # of frames of the spray can logo animation right now. + */ void PlayerCustomization(edict_t* pEntity, customization_t* pCust) { CBasePlayer* pPlayer = ToBasePlayer(pEntity); @@ -1418,20 +1369,19 @@ void PlayerCustomization(edict_t* pEntity, customization_t* pCust) // PAS and PVS routines for client messaging // -/* -================ -SetupVisibility - -A client can have a separate "view entity" indicating that his/her view should depend on the origin of that -view entity. If that's the case, then pViewEntity will be non-nullptr and will be used. Otherwise, the current -entity's origin is used. Either is offset by the view_ofs to get the eye position. - -From the eye position, we set up the PAS and PVS to use for filtering network messages to the client. At this point, we could - override the actual PAS or PVS values, or use a different origin. - -NOTE: Do not cache the values of pas and pvs, as they depend on reusable memory in the engine, they are only good for this one frame -================ -*/ +/** + * @brief A client can have a separate "view entity" indicating that his/her view should depend on the origin of that + * view entity. + * If that's the case, then pViewEntity will be non-nullptr and will be used. + * Otherwise, the current entity's origin is used. + * Either is offset by the view_ofs to get the eye position. + * + * From the eye position, we set up the PAS and PVS to use for filtering network messages to the client. + * At this point, we could override the actual PAS or PVS values, or use a different origin. + * + * NOTE: Do not cache the values of pas and pvs, as they depend on reusable memory in the engine, + * they are only good for this one frame + */ void SetupVisibility(edict_t* pViewEntity, edict_t* pClient, unsigned char** pvs, unsigned char** pas) { Vector org; @@ -1462,19 +1412,21 @@ void SetupVisibility(edict_t* pViewEntity, edict_t* pClient, unsigned char** pvs #include "entity_state.h" -/* -AddToFullPack - -Return 1 if the entity state has been filled in for the ent and the entity will be propagated to the client, 0 otherwise - -state is the server maintained copy of the state info that is transmitted to the client -a MOD could alter values copied into state to send the "host" a different look for a particular entity update, etc. -e and ent are the entity that is being added to the update, if 1 is returned -host is the player's edict of the player whom we are sending the update to -player is 1 if the ent/e is a player and 0 otherwise -pSet is either the PAS or PVS that we previous set up. We can use it to ask the engine to filter the entity against the PAS or PVS. -we could also use the pas/ pvs that we set in SetupVisibility, if we wanted to. Caching the value is valid in that case, but still only for the current frame -*/ +/** + * @brief Return 1 if the entity state has been filled in for the ent and the entity will be propagated to the client, + * 0 otherwise + * @param state the server maintained copy of the state info that is transmitted to the client + * a MOD could alter values copied into state to send the "host" a different look for a particular entity update, etc. + * @param e index of the entity that is being added to the update, if 1 is returned + * @param ent the entity that is being added to the update, if 1 is returned + * @param host is the player's edict of the player whom we are sending the update to + * @param hostflags 1 if the host has cl_lw enabled, 0 otherwise + * @param player 1 if the ent/e is a player and 0 otherwise + * @param pSet either the PAS or PVS that we previous set up. + * We can use it to ask the engine to filter the entity against the PAS or PVS. + * we could also use the pas/ pvs that we set in SetupVisibility, if we wanted to. + * Caching the value is valid in that case, but still only for the current frame + */ int AddToFullPack(entity_state_t* state, int e, edict_t* ent, edict_t* host, int hostflags, int player, unsigned char* pSet) { // Entities with an index greater than this will corrupt the client's heap because @@ -1684,13 +1636,10 @@ int AddToFullPack(entity_state_t* state, int e, edict_t* ent, edict_t* host, int return 1; } -/* -=================== -CreateBaseline - -Creates baselines used for network encoding, especially for player data since players are not spawned until connect time. -=================== -*/ +/** + * @brief Creates baselines used for network encoding, + * especially for player data since players are not spawned until connect time. + */ void CreateBaseline(int player, int eindex, entity_state_t* baseline, edict_t* entity, int playermodelindex, Vector* player_mins, Vector* player_maxs) { baseline->origin = entity->v.origin; @@ -1770,14 +1719,10 @@ void Entity_FieldInit(delta_t* pFields) entity_field_alias[FIELD_ANGLES2].field = DELTA_FINDFIELD(pFields, entity_field_alias[FIELD_ANGLES2].name); } -/* -================== -Entity_Encode - -Callback for sending entity_state_t info over network. -FIXME: Move to script -================== -*/ +/** + * @brief Callback for sending entity_state_t info over network. + * FIXME: Move to script + */ void Entity_Encode(delta_t* pFields, const unsigned char* from, const unsigned char* to) { entity_state_t *f, *t; @@ -1841,13 +1786,9 @@ void Player_FieldInit(delta_t* pFields) player_field_alias[FIELD_ORIGIN2].field = DELTA_FINDFIELD(pFields, player_field_alias[FIELD_ORIGIN2].name); } -/* -================== -Player_Encode - -Callback for sending entity_state_t for players info over network. -================== -*/ +/** + * @brief Callback for sending entity_state_t for players info over network. + */ void Player_Encode(delta_t* pFields, const unsigned char* from, const unsigned char* to) { entity_state_t *f, *t; @@ -1922,14 +1863,10 @@ void Custom_Entity_FieldInit(delta_t* pFields) custom_entity_field_alias[CUSTOMFIELD_ANIMTIME].field = DELTA_FINDFIELD(pFields, custom_entity_field_alias[CUSTOMFIELD_ANIMTIME].name); } -/* -================== -Custom_Encode - -Callback for sending entity_state_t info ( for custom entities ) over network. -FIXME: Move to script -================== -*/ +/** + * @brief Callback for sending entity_state_t info ( for custom entities ) over network. + * FIXME: Move to script + */ void Custom_Encode(delta_t* pFields, const unsigned char* from, const unsigned char* to) { entity_state_t *f, *t; @@ -1975,13 +1912,10 @@ void Custom_Encode(delta_t* pFields, const unsigned char* from, const unsigned c } } -/* -================= -RegisterEncoders - -Allows game .dll to override network encoding of certain types of entities and tweak values, etc. -================= -*/ +/** + * @brief Allows game .dll to override network encoding of certain types of entities and tweak values, etc. + * @details See the mod's @c delta.lst configuration file for relevant encoding settings. + */ void RegisterEncoders() { DELTA_ADDENCODER("Entity_Encode", Entity_Encode); @@ -2044,14 +1978,10 @@ int GetWeaponData(edict_t* player, weapon_data_t* info) return 1; } -/* -================= -UpdateClientData - -Data sent to current client only -engine sets cd to 0 before calling. -================= -*/ +/** + * @brief Data sent to current client only + * @param cd zeroed out by engine before call. + */ void UpdateClientData(const edict_t* ent, int sendweapons, clientdata_t* cd) { if (!ent) @@ -2162,14 +2092,10 @@ void UpdateClientData(const edict_t* ent, int sendweapons, clientdata_t* cd) #endif } -/* -================= -CmdStart - -We're about to run this usercmd for the specified player. We can set up groupinfo and masking here, etc. -This is the time to examine the usercmd for anything extra. This call happens even if think does not. -================= -*/ +/** + * @brief We're about to run this usercmd for the specified player. We can set up groupinfo and masking here, etc. + * This is the time to examine the usercmd for anything extra. This call happens even if think does not. + */ void CmdStart(const edict_t* player, const usercmd_t* cmd, unsigned int random_seed) { auto pl = ToBasePlayer(const_cast(player)); @@ -2185,13 +2111,9 @@ void CmdStart(const edict_t* player, const usercmd_t* cmd, unsigned int random_s pl->random_seed = random_seed; } -/* -================= -CmdEnd - -Each cmdstart is exactly matched with a cmd end, clean up any group trace flags, etc. here -================= -*/ +/** + * @brief Each cmdstart is exactly matched with a cmd end, clean up any group trace flags, etc. here + */ void CmdEnd(const edict_t* player) { auto pl = ToBasePlayer(const_cast(player)); @@ -2204,14 +2126,14 @@ void CmdEnd(const edict_t* player) } } -/* -================================ -ConnectionlessPacket - - Return 1 if the packet is valid. Set response_buffer_size if you want to send a response packet. Incoming, it holds the max - size of the response_buffer, so you must zero it out if you choose not to respond. -================================ -*/ +/** + * @brief Return 1 if the packet is valid. + * @param net_from Address of the sender. + * @param args Argument string. + * @param response_buffer Buffer to write a response message to. + * @param[in,out] response_buffer_size Initially holds the maximum size of @p response_buffer. + * Set to size of response message or 0 if sending no response. + */ int ConnectionlessPacket(const netadr_t* net_from, const char* args, char* response_buffer, int* response_buffer_size) { // Parse stuff from args @@ -2226,26 +2148,19 @@ int ConnectionlessPacket(const netadr_t* net_from, const char* args, char* respo return 0; } -/* -================================ -GetHullBounds - - Engine calls this to enumerate player collision hulls, for prediction. Return 0 if the hullnumber doesn't exist. -================================ -*/ +/** + * @brief Engine calls this to enumerate player collision hulls, for prediction. + * @return 0 if the hullnumber doesn't exist, 1 otherwise. + */ int GetHullBounds(int hullnumber, float* mins, float* maxs) { return static_cast(PM_GetHullBounds(hullnumber, mins, maxs)); } -/* -================================ -CreateInstancedBaselines - -Create pseudo-baselines for items that aren't placed in the map at spawn time, but which are likely -to be created during play ( e.g., grenades, ammo packs, projectiles, corpses, etc. ) -================================ -*/ +/** + * @brief Create pseudo-baselines for items that aren't placed in the map at spawn time, but which are likely + * to be created during play ( e.g., grenades, ammo packs, projectiles, corpses, etc. ) + */ void CreateInstancedBaselines() { // int iret = 0; @@ -2260,14 +2175,11 @@ void CreateInstancedBaselines() // UTIL_Remove( pc ); } -/* -================================ -InconsistentFile - -One of the ENGINE_FORCE_UNMODIFIED files failed the consistency check for the specified player - Return 0 to allow the client to continue, 1 to force immediate disconnection ( with an optional disconnect message of up to 256 characters ) -================================ -*/ +/** + * @brief One of the ENGINE_FORCE_UNMODIFIED files failed the consistency check for the specified player + * @return 0 to allow the client to continue, 1 to force immediate disconnection + * ( with an optional disconnect message of up to 256 characters ) + */ int InconsistentFile(const edict_t* player, const char* filename, char* disconnect_message) { // Server doesn't care? @@ -2281,17 +2193,12 @@ int InconsistentFile(const edict_t* player, const char* filename, char* disconne return 1; } -/* -================================ -AllowLagCompensation - - The game .dll should return 1 if lag compensation should be allowed ( could also just set - the sv_unlag cvar. - Most games right now should return 0, until client-side weapon prediction code is written - and tested for them ( note you can predict weapons, but not do lag compensation, too, - if you want. -================================ -*/ +/** + * @brief The game .dll should return 1 if lag compensation should be allowed ( must also set the sv_unlag cvar ). + * @details Most games right now should return 0, + * until client-side weapon prediction code is written and tested for them + * ( note you can predict weapons, but not do lag compensation, too, if you want ). + */ int AllowLagCompensation() { return 1;