Avoid some struct declaration in parameter list

This commit is contained in:
Alibek Omarov 2018-04-14 04:26:12 +03:00
parent 4a0add4063
commit 64257ef428
8 changed files with 75 additions and 42 deletions

View File

@ -28,8 +28,6 @@
// 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 )
@ -60,6 +58,8 @@ 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, struct netadr_s *remote_address, net_api_response_func_t response );
void (*SendRequest)( int context, int request, int flags, double timeout, netadr_t *remote_address, net_api_response_func_t response );
void (*CancelRequest)( int context );
void (*CancelAllRequests)( void );
char *(*AdrToString)( struct netadr_s *a );
int ( *CompareAdr)( struct netadr_s *a, struct netadr_s *b );
int ( *StringToAdr)( char *s, struct netadr_s *a );
char *(*AdrToString)( netadr_t *a );
int ( *CompareAdr)( netadr_t *a, netadr_t *b );
int ( *StringToAdr)( char *s, netadr_t *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

View File

@ -68,6 +68,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

View File

@ -15,6 +15,18 @@ 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
{
@ -24,15 +36,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)( struct playermove_s *ppmove, int server );
void (*pfnPlayerMoveInit)( struct playermove_s *ppmove );
void (*pfnPlayerMove)( playermove_t *ppmove, int server );
void (*pfnPlayerMoveInit)( playermove_t *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, struct usercmd_s *cmd, int active );
void (*CL_CreateMove)( float frametime, usercmd_t *cmd, int active );
int (*CL_IsThirdPerson)( void );
void (*CL_CameraOffset)( float *ofs ); // unused
void *(*KB_Find)( const char *name );
@ -42,26 +54,26 @@ typedef struct cldll_func_s
void (*pfnCreateEntities)( void );
void (*pfnDrawNormalTriangles)( void );
void (*pfnDrawTransparentTriangles)( void );
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 (*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 (*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 struct netadr_s *net_from, const char *args, char *buffer, int *size );
int (*pfnConnectionlessPacket)( const netadr_t *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, struct tempent_s **ppTempEntFree, struct tempent_s **ppTempEntActive, int ( *Callback_AddVisibleEntity )( cl_entity_t *pEntity ), void ( *Callback_TempEntPlaySound )( struct tempent_s *pTemp, float damp ));
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 ));
cl_entity_t *(*pfnGetUserEntity)( int index );
void (*pfnVoiceStatus)( int entindex, qboolean bTalking );
void (*pfnDirectorMessage)( int iSize, void *pbuf );
int (*pfnGetStudioModelInterface)( int version, struct r_studio_interface_s **ppinterface, struct engine_studio_api_s *pstudio );
int (*pfnGetStudioModelInterface)( int version, r_studio_interface_t **ppinterface, engine_studio_api_t *pstudio );
void (*pfnChatInputPosition)( int *x, int *y );
// Xash3D extension
int (*pfnGetRenderInterface)( int version, render_api_t *renderfuncs, render_interface_t *callback );
void (*pfnClipMoveToEntity)( struct physent_s *pe, const vec3_t start, vec3_t mins, vec3_t maxs, const vec3_t end, struct pmtrace_s *tr );
void (*pfnClipMoveToEntity)( physent_t *pe, const vec3_t start, vec3_t mins, vec3_t maxs, const vec3_t end, pmtrace_t *tr );
// Xash3D FWGS extension
int (*pfnTouchEvent)( int type, int fingerID, float x, float y, float dx, float dy );
void (*pfnMoveEvent)( float forwardmove, float sidemove );

View File

@ -98,6 +98,9 @@ typedef struct hud_player_info_s
short bottomcolor;
} hud_player_info_t;
typedef struct event_args_s event_args_t;
typedef struct screenfade_s screenfade_t;
typedef struct cl_enginefuncs_s
{
// sprite handlers
@ -195,14 +198,14 @@ typedef struct cl_enginefuncs_s
void (*pfnWeaponAnim)( int iAnim, int body );
float (*pfnRandomFloat)( float flLow, float flHigh );
long (*pfnRandomLong)( long lLow, long lHigh );
void (*pfnHookEvent)( char *name, void ( *pfnEvent )( struct event_args_s *args ));
void (*pfnHookEvent)( char *name, void ( *pfnEvent )( event_args_t *args ));
int (*Con_IsVisible) ();
const char *(*pfnGetGameDirectory)( void );
struct cvar_s *(*pfnGetCvarPointer)( const char *szName );
const char *(*Key_LookupBinding)( const char *pBinding );
const char *(*pfnGetLevelName)( void );
void (*pfnGetScreenFade)( struct screenfade_s *fade );
void (*pfnSetScreenFade)( struct screenfade_s *fade );
void (*pfnGetScreenFade)( screenfade_t *fade );
void (*pfnSetScreenFade)( screenfade_t *fade );
void* (*VGui_GetPanel)( );
void (*VGui_ViewportPaintBackground)( int extents[4] );
@ -256,4 +259,4 @@ typedef struct cl_enginefuncs_s
}
#endif
#endif//CDLL_INT_H
#endif//CDLL_INT_H

View File

@ -906,11 +906,13 @@ 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( struct channel_s *ch );
qboolean CL_GetMovieSpatialization( struct rawchan_s *ch );
qboolean CL_GetEntitySpatialization( channel_t *ch );
qboolean CL_GetMovieSpatialization( rawchan_t *ch );
void CL_ComputePlayerOrigin( cl_entity_t *clent );
void CL_UpdateEntityFields( cl_entity_t *ent );
void CL_MoveThirdpersonCamera( void );
@ -931,6 +933,7 @@ 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 );
@ -940,7 +943,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( struct particle_s **ppparticles );
void R_FreeDeadParticles( particle_t **ppparticles );
void CL_AddClientResource( const char *filename, int type );
void CL_AddClientResources( void );
int CL_FxBlend( cl_entity_t *e );
@ -1048,4 +1051,6 @@ void SCR_RunCinematic( void );
void SCR_StopCinematic( void );
void CL_PlayVideo_f( void );
extern rgba_t g_color_table[8];
#endif//CLIENT_H

View File

@ -916,6 +916,7 @@ void Key_SetKeyDest( int key_dest );
// 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 );
@ -966,8 +967,8 @@ qboolean SV_Initialized( void );
qboolean CL_LoadProgs( const char *name );
qboolean SV_GetSaveComment( const char *savename, char *comment );
qboolean SV_NewGame( const char *mapName, qboolean loadGame );
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 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 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 );

View File

@ -96,6 +96,8 @@ typedef struct
typedef unsigned long CRC32_t;
typedef struct delta_s delta_t;
// Engine hands this to DLLs for functionality callbacks
typedef struct enginefuncs_s
{
@ -231,14 +233,14 @@ typedef struct enginefuncs_s
int (*pfnCheckVisibility )( const edict_t *entity, unsigned char *pset );
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 ) );
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 ) );
int (*pfnGetCurrentPlayer)( void );
int (*pfnCanSkipPlayer)( const edict_t *player );
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 );
int (*pfnDeltaFindField)( delta_t *pFields, const char *fieldname );
void (*pfnDeltaSetFieldByIndex)( delta_t *pFields, int fieldNumber );
void (*pfnDeltaUnsetFieldByIndex)( delta_t *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, char *value );
@ -389,6 +391,13 @@ typedef struct
#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 )
@ -439,22 +448,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)( struct playermove_s *ppmove, qboolean server );
void (*pfnPM_Init)( struct playermove_s *ppmove );
void (*pfnPM_Move)( playermove_t *ppmove, qboolean server );
void (*pfnPM_Init)( playermove_t *ppmove );
char (*pfnPM_FindTextureType)( char *name );
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 (*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 (*pfnRegisterEncoders)( void );
int (*pfnGetWeaponData)( struct edict_s *player, struct weapon_data_s *info );
int (*pfnGetWeaponData)( edict_t *player, weapon_data_t *info );
void (*pfnCmdStart)( const edict_t *player, const struct usercmd_s *cmd, unsigned int random_seed );
void (*pfnCmdStart)( const edict_t *player, const usercmd_t *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 struct netadr_s *net_from, const char *args, char *response_buffer, int *response_buffer_size );
int (*pfnConnectionlessPacket )( const netadr_t *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 );
@ -464,7 +473,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 struct edict_s *player, const char *filename, char *disconnect_message );
int (*pfnInconsistentFile)( const edict_t *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.
@ -496,4 +505,4 @@ extern NEW_DLL_FUNCTIONS gNewDLLFunctions;
typedef int (*APIFUNCTION)( DLL_FUNCTIONS *pFunctionTable, int interfaceVersion );
typedef int (*APIFUNCTION2)( DLL_FUNCTIONS *pFunctionTable, int *interfaceVersion );
#endif//EIFACE_H
#endif//EIFACE_H

View File

@ -43,6 +43,8 @@ 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