From 7601a4cd29f83ad2d4cf9fc3ff622e1eb9a5036a Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Thu, 12 Jul 2018 23:13:30 +0300 Subject: [PATCH] Revert 64257ef to not break C++ header compability --- common/net_api.h | 14 +++++++------- common/port.h | 1 + engine/cdll_exp.h | 30 +++++++++--------------------- engine/cdll_int.h | 1 + engine/client/client.h | 11 +++-------- engine/common/common.h | 5 ++--- engine/eiface.h | 39 ++++++++++++++++----------------------- engine/menu_int.h | 2 -- 8 files changed, 39 insertions(+), 64 deletions(-) diff --git a/common/net_api.h b/common/net_api.h index 86d90ba1..00831394 100644 --- a/common/net_api.h +++ b/common/net_api.h @@ -28,6 +28,8 @@ // kill the request hook after receiving the first response #define FNETAPI_MULTIPLE_RESPONSE ( 1<<0 ) +typedef void (*net_api_response_func_t) ( struct net_response_s *response ); + #define NET_SUCCESS ( 0 ) #define NET_ERROR_TIMEOUT ( 1<<0 ) #define NET_ERROR_PROTO_UNSUPPORTED ( 1<<1 ) @@ -58,8 +60,6 @@ typedef struct net_response_s void *response; } net_response_t; -typedef void (*net_api_response_func_t) ( net_response_t *response ); - typedef struct net_status_s { // Connected to remote server? 1 == yes, 0 otherwise @@ -83,15 +83,15 @@ typedef struct net_api_s // APIs void (*InitNetworking)( void ); void (*Status )( struct net_status_s *status ); - void (*SendRequest)( int context, int request, int flags, double timeout, netadr_t *remote_address, net_api_response_func_t response ); + void (*SendRequest)( int context, int request, int flags, double timeout, struct netadr_s *remote_address, net_api_response_func_t response ); void (*CancelRequest)( int context ); void (*CancelAllRequests)( void ); - char *(*AdrToString)( netadr_t *a ); - int ( *CompareAdr)( netadr_t *a, netadr_t *b ); - int ( *StringToAdr)( char *s, netadr_t *a ); + char *(*AdrToString)( struct netadr_s *a ); + int ( *CompareAdr)( struct netadr_s *a, struct netadr_s *b ); + int ( *StringToAdr)( char *s, struct netadr_s *a ); const char *(*ValueForKey)( const char *s, const char *key ); void (*RemoveKey)( char *s, const char *key ); void (*SetValueForKey)( char *s, const char *key, const char *value, int maxsize ); } net_api_t; -#endif//NET_APIH +#endif//NET_APIH \ No newline at end of file diff --git a/common/port.h b/common/port.h index fc3b5b44..79ef55eb 100644 --- a/common/port.h +++ b/common/port.h @@ -76,6 +76,7 @@ GNU General Public License for more details. // Windows-specific #define __cdecl #define __stdcall + #define _inline static inline #define O_BINARY 0 // O_BINARY is Windows extension #define O_TEXT 0 // O_TEXT is Windows extension diff --git a/engine/cdll_exp.h b/engine/cdll_exp.h index a6d200d0..9d72df37 100644 --- a/engine/cdll_exp.h +++ b/engine/cdll_exp.h @@ -15,18 +15,6 @@ GNU General Public License for more details. #ifndef CDLL_EXP_H #define CDLL_EXP_H -typedef struct r_studio_interface_s r_studio_interface_t; -typedef struct engine_studio_api_s engine_studio_api_t; -typedef struct mstudioevent_s mstudioevent_t; -typedef struct local_state_s local_state_t; -typedef struct playermove_s playermove_t; -typedef struct tempent_s tempent_t; -typedef struct physent_s physent_t; -typedef struct pmtrace_s pmtrace_t; -typedef struct usercmd_s usercmd_t; -typedef struct netadr_s netadr_t; - - // NOTE: ordering is important! typedef struct cldll_func_s { @@ -36,15 +24,15 @@ typedef struct cldll_func_s int (*pfnRedraw)( float flTime, int intermission ); int (*pfnUpdateClientData)( client_data_t *cdata, float flTime ); void (*pfnReset)( void ); - void (*pfnPlayerMove)( playermove_t *ppmove, int server ); - void (*pfnPlayerMoveInit)( playermove_t *ppmove ); + void (*pfnPlayerMove)( struct playermove_s *ppmove, int server ); + void (*pfnPlayerMoveInit)( struct playermove_s *ppmove ); char (*pfnPlayerMoveTexture)( char *name ); void (*IN_ActivateMouse)( void ); void (*IN_DeactivateMouse)( void ); void (*IN_MouseEvent)( int mstate ); void (*IN_ClearStates)( void ); void (*IN_Accumulate)( void ); - void (*CL_CreateMove)( float frametime, usercmd_t *cmd, int active ); + void (*CL_CreateMove)( float frametime, struct usercmd_s *cmd, int active ); int (*CL_IsThirdPerson)( void ); void (*CL_CameraOffset)( float *ofs ); // unused void *(*KB_Find)( const char *name ); @@ -54,26 +42,26 @@ typedef struct cldll_func_s void (*pfnCreateEntities)( void ); void (*pfnDrawNormalTriangles)( void ); void (*pfnDrawTransparentTriangles)( void ); - void (*pfnStudioEvent)( const mstudioevent_t *event, const cl_entity_t *entity ); - void (*pfnPostRunCmd)( local_state_t *from, local_state_t *to, usercmd_t *cmd, int runfuncs, double time, unsigned int random_seed ); + void (*pfnStudioEvent)( const struct mstudioevent_s *event, const cl_entity_t *entity ); + void (*pfnPostRunCmd)( struct local_state_s *from, struct local_state_s *to, usercmd_t *cmd, int runfuncs, double time, unsigned int random_seed ); void (*pfnShutdown)( void ); void (*pfnTxferLocalOverrides)( entity_state_t *state, const clientdata_t *client ); void (*pfnProcessPlayerState)( entity_state_t *dst, const entity_state_t *src ); void (*pfnTxferPredictionData)( 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 ); void (*pfnDemo_ReadBuffer)( int size, byte *buffer ); - int (*pfnConnectionlessPacket)( const netadr_t *net_from, const char *args, char *buffer, int *size ); + int (*pfnConnectionlessPacket)( const struct netadr_s *net_from, const char *args, char *buffer, int *size ); int (*pfnGetHullBounds)( int hullnumber, float *mins, float *maxs ); void (*pfnFrame)( double time ); int (*pfnKey_Event)( int eventcode, int keynum, const char *pszCurrentBinding ); - void (*pfnTempEntUpdate)( double frametime, double client_time, double cl_gravity, tempent_t **ppTempEntFree, tempent_t **ppTempEntActive, int ( *Callback_AddVisibleEntity )( cl_entity_t *pEntity ), void ( *Callback_TempEntPlaySound )( tempent_t *pTemp, float damp )); + void (*pfnTempEntUpdate)( double frametime, double client_time, double cl_gravity, struct tempent_s **ppTempEntFree, struct tempent_s **ppTempEntActive, int ( *Callback_AddVisibleEntity )( cl_entity_t *pEntity ), void ( *Callback_TempEntPlaySound )( struct tempent_s *pTemp, float damp )); cl_entity_t *(*pfnGetUserEntity)( int index ); void (*pfnVoiceStatus)( int entindex, qboolean bTalking ); void (*pfnDirectorMessage)( int iSize, void *pbuf ); - int (*pfnGetStudioModelInterface)( int version, r_studio_interface_t **ppinterface, engine_studio_api_t *pstudio ); + int (*pfnGetStudioModelInterface)( int version, struct r_studio_interface_s **ppinterface, struct engine_studio_api_s *pstudio ); void (*pfnChatInputPosition)( int *x, int *y ); // Xash3D extension int (*pfnGetRenderInterface)( int version, render_api_t *renderfuncs, render_interface_t *callback ); - void (*pfnClipMoveToEntity)( physent_t *pe, const vec3_t start, vec3_t mins, vec3_t maxs, const vec3_t end, pmtrace_t *tr ); + void (*pfnClipMoveToEntity)( struct physent_s *pe, const vec3_t start, vec3_t mins, vec3_t maxs, const vec3_t end, struct pmtrace_s *tr ); // Xash3D FWGS extension int (*pfnTouchEvent)( int type, int fingerID, float x, float y, float dx, float dy ); void (*pfnMoveEvent)( float forwardmove, float sidemove ); diff --git a/engine/cdll_int.h b/engine/cdll_int.h index 3589c9e6..db6d9eb9 100644 --- a/engine/cdll_int.h +++ b/engine/cdll_int.h @@ -212,6 +212,7 @@ typedef struct cl_enginefuncs_s float (*pfnRandomFloat)( float flLow, float flHigh ); int (*pfnRandomLong)( int lLow, int lHigh ); void (*pfnHookEvent)( const char *name, void ( *pfnEvent )( struct event_args_s *args )); + int (*Con_IsVisible) (); const char *(*pfnGetGameDirectory)( void ); struct cvar_s *(*pfnGetCvarPointer)( const char *szName ); diff --git a/engine/client/client.h b/engine/client/client.h index 694c1a7e..442189dd 100644 --- a/engine/client/client.h +++ b/engine/client/client.h @@ -954,13 +954,11 @@ void CL_InitStudioAPI( void ); // // cl_frame.c // -typedef struct channel_s channel_t; -typedef struct rawchan_s rawchan_t; int CL_ParsePacketEntities( sizebuf_t *msg, qboolean delta ); qboolean CL_AddVisibleEntity( cl_entity_t *ent, int entityType ); void CL_ResetLatchedVars( cl_entity_t *ent, qboolean full_reset ); -qboolean CL_GetEntitySpatialization( channel_t *ch ); -qboolean CL_GetMovieSpatialization( rawchan_t *ch ); +qboolean CL_GetEntitySpatialization( struct channel_s *ch ); +qboolean CL_GetMovieSpatialization( struct rawchan_s *ch ); void CL_ComputePlayerOrigin( cl_entity_t *clent ); void CL_ProcessPacket( frame_t *frame ); void CL_MoveThirdpersonCamera( void ); @@ -981,7 +979,6 @@ void CL_ClearAllRemaps( void ); // // cl_tent.c // -typedef struct particle_s particle_t; int CL_AddEntity( int entityType, cl_entity_t *pEnt ); void CL_WeaponAnim( int iAnim, int body ); void CL_ClearEffects( void ); @@ -991,7 +988,7 @@ void CL_DrawParticlesExternal( const ref_viewpass_t *rvp, qboolean trans_pass, f void CL_FireCustomDecal( int textureIndex, int entityIndex, int modelIndex, float *pos, int flags, float scale ); void CL_DecalShoot( int textureIndex, int entityIndex, int modelIndex, float *pos, int flags ); void CL_PlayerDecal( int playerIndex, int textureIndex, int entityIndex, float *pos ); -void R_FreeDeadParticles( particle_t **ppparticles ); +void R_FreeDeadParticles( struct particle_s **ppparticles ); void CL_AddClientResource( const char *filename, int type ); void CL_AddClientResources( void ); int CL_FxBlend( cl_entity_t *e ); @@ -1114,6 +1111,4 @@ void SCR_RunCinematic( void ); void SCR_StopCinematic( void ); void CL_PlayVideo_f( void ); -extern rgba_t g_color_table[8]; - #endif//CLIENT_H diff --git a/engine/common/common.h b/engine/common/common.h index bb9adff9..f821bb78 100644 --- a/engine/common/common.h +++ b/engine/common/common.h @@ -981,7 +981,6 @@ void Key_EnableTextInput( qboolean enable, qboolean force ); // shared calls typedef struct sv_client_s sv_client_t; typedef struct sizebuf_s sizebuf_t; -typedef struct physent_s physent_t; qboolean CL_IsInGame( void ); qboolean CL_IsInMenu( void ); qboolean CL_IsInConsole( void ); @@ -1036,8 +1035,8 @@ qboolean SV_Initialized( void ); qboolean CL_LoadProgs( const char *name ); int SV_GetSaveComment( const char *savename, char *comment ); qboolean SV_NewGame( const char *mapName, qboolean loadGame ); -void SV_ClipPMoveToEntity( physent_t *pe, const vec3_t start, vec3_t mins, vec3_t maxs, const vec3_t end, struct pmtrace_s *tr ); -void CL_ClipPMoveToEntity( physent_t *pe, const vec3_t start, vec3_t mins, vec3_t maxs, const vec3_t end, struct pmtrace_s *tr ); +void SV_ClipPMoveToEntity( struct physent_s *pe, const vec3_t start, vec3_t mins, vec3_t maxs, const vec3_t end, struct pmtrace_s *tr ); +void CL_ClipPMoveToEntity( struct physent_s *pe, const vec3_t start, vec3_t mins, vec3_t maxs, const vec3_t end, struct pmtrace_s *tr ); void CL_Particle( const vec3_t origin, int color, float life, int zpos, int zvel ); // debug thing void SV_SysError( const char *error_string ); void SV_ShutdownGame( void ); diff --git a/engine/eiface.h b/engine/eiface.h index 2e456814..bd197786 100644 --- a/engine/eiface.h +++ b/engine/eiface.h @@ -234,14 +234,14 @@ typedef struct enginefuncs_s int (*pfnCheckVisibility )( const edict_t *entity, unsigned char *pset ); - void (*pfnDeltaSetField) ( delta_t *pFields, const char *fieldname ); - void (*pfnDeltaUnsetField)( delta_t *pFields, const char *fieldname ); - void (*pfnDeltaAddEncoder)( char *name, void (*conditionalencode)( delta_t *pFields, const unsigned char *from, const unsigned char *to ) ); + void (*pfnDeltaSetField) ( struct delta_s *pFields, const char *fieldname ); + void (*pfnDeltaUnsetField)( struct delta_s *pFields, const char *fieldname ); + void (*pfnDeltaAddEncoder)( char *name, void (*conditionalencode)( struct delta_s *pFields, const unsigned char *from, const unsigned char *to ) ); int (*pfnGetCurrentPlayer)( void ); int (*pfnCanSkipPlayer)( const edict_t *player ); - int (*pfnDeltaFindField)( delta_t *pFields, const char *fieldname ); - void (*pfnDeltaSetFieldByIndex)( delta_t *pFields, int fieldNumber ); - void (*pfnDeltaUnsetFieldByIndex)( delta_t *pFields, int fieldNumber ); + int (*pfnDeltaFindField)( struct delta_s *pFields, const char *fieldname ); + void (*pfnDeltaSetFieldByIndex)( struct delta_s *pFields, int fieldNumber ); + void (*pfnDeltaUnsetFieldByIndex)( struct delta_s *pFields, int fieldNumber ); void (*pfnSetGroupMask)( int mask, int op ); int (*pfnCreateInstancedBaseline)( int classname, struct entity_state_s *baseline ); void (*pfnCvar_DirectSet)( struct cvar_s *var, const char *value ); @@ -393,13 +393,6 @@ typedef struct #undef ARRAYSIZE #define ARRAYSIZE(p) (sizeof(p)/sizeof(p[0])) -typedef struct playermove_s playermove_t; -typedef struct clientdata_s clientdata_t; -typedef struct entity_state_s entity_state_t; -typedef struct weapon_data_s weapon_data_t; -typedef struct netadr_t netadr_s; -typedef struct usercmd_s usercmd_t; - typedef struct { // Initialize/shutdown the game (one-time call after loading of game .dll ) @@ -450,22 +443,22 @@ typedef struct // Notify game .dll that engine is going to shut down. Allows mod authors to set a breakpoint. void (*pfnSys_Error)( const char *error_string ); - void (*pfnPM_Move)( playermove_t *ppmove, qboolean server ); - void (*pfnPM_Init)( playermove_t *ppmove ); + void (*pfnPM_Move)( struct playermove_s *ppmove, qboolean server ); + void (*pfnPM_Init)( struct playermove_s *ppmove ); char (*pfnPM_FindTextureType)( char *name ); - void (*pfnSetupVisibility)( edict_t *pViewEntity, edict_t *pClient, unsigned char **pvs, unsigned char **pas ); - void (*pfnUpdateClientData) ( const edict_t *ent, int sendweapons, clientdata_t *cd ); - int (*pfnAddToFullPack)( entity_state_t *state, int e, edict_t *ent, edict_t *host, int hostflags, int player, unsigned char *pSet ); - void (*pfnCreateBaseline)( int player, int eindex, entity_state_t *baseline, edict_t *entity, int playermodelindex, vec3_t player_mins, vec3_t player_maxs ); + void (*pfnSetupVisibility)( struct edict_s *pViewEntity, struct edict_s *pClient, unsigned char **pvs, unsigned char **pas ); + void (*pfnUpdateClientData) ( const struct edict_s *ent, int sendweapons, struct clientdata_s *cd ); + int (*pfnAddToFullPack)( struct entity_state_s *state, int e, edict_t *ent, edict_t *host, int hostflags, int player, unsigned char *pSet ); + void (*pfnCreateBaseline)( int player, int eindex, struct entity_state_s *baseline, struct edict_s *entity, int playermodelindex, vec3_t player_mins, vec3_t player_maxs ); void (*pfnRegisterEncoders)( void ); - int (*pfnGetWeaponData)( edict_t *player, weapon_data_t *info ); + int (*pfnGetWeaponData)( struct edict_s *player, struct weapon_data_s *info ); - void (*pfnCmdStart)( const edict_t *player, const usercmd_t *cmd, unsigned int random_seed ); + void (*pfnCmdStart)( const edict_t *player, const struct usercmd_s *cmd, unsigned int random_seed ); void (*pfnCmdEnd)( const edict_t *player ); // 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. - int (*pfnConnectionlessPacket )( const netadr_t *net_from, const char *args, char *response_buffer, int *response_buffer_size ); + int (*pfnConnectionlessPacket )( const struct netadr_s *net_from, const char *args, char *response_buffer, int *response_buffer_size ); // Enumerates player hulls. Returns 0 if the hull number doesn't exist, 1 otherwise int (*pfnGetHullBounds) ( int hullnumber, float *mins, float *maxs ); @@ -475,7 +468,7 @@ typedef struct // One of the pfnForceUnmodified 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 (*pfnInconsistentFile)( const edict_t *player, const char *filename, char *disconnect_message ); + int (*pfnInconsistentFile)( const struct edict_s *player, const char *filename, char *disconnect_message ); // The game .dll should return 1 if lag compensation should be allowed ( could also just set // the sv_unlag cvar. diff --git a/engine/menu_int.h b/engine/menu_int.h index 6ad0a413..2f7810d6 100644 --- a/engine/menu_int.h +++ b/engine/menu_int.h @@ -47,8 +47,6 @@ typedef struct ui_globalvars_s char maptitle[64]; // title of active map } ui_globalvars_t; -typedef struct ref_viewpass_s ref_viewpass_t; - typedef struct ui_enginefuncs_s { // image handlers