From aa6674b03259a305ea2d4d310825d5750ea2abb8 Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Sat, 26 Oct 2019 15:42:00 +0300 Subject: [PATCH] engine: support compiling with gcc3 --- common/com_model.h | 4 +-- common/const.h | 1 - common/r_efx.h | 3 +- common/xash3d_types.h | 2 -- engine/client/client.h | 3 +- engine/client/vox.h | 6 ++-- engine/common/common.h | 12 ++------ engine/common/filesystem.c | 8 +++--- engine/common/mod_local.h | 5 +--- engine/common/net_buffer.h | 4 +-- engine/common/net_encode.h | 46 ++++++++++++++++--------------- engine/common/soundlib/soundlib.h | 4 +-- engine/platform/platform.h | 5 ++-- ref_gl/gl_local.h | 2 +- 14 files changed, 45 insertions(+), 60 deletions(-) diff --git a/common/com_model.h b/common/com_model.h index f31a754a..535b81a4 100644 --- a/common/com_model.h +++ b/common/com_model.h @@ -232,7 +232,7 @@ typedef struct mextrasurf_s int reserved[32]; // just for future expansions or mod-makers } mextrasurf_t; -typedef struct msurface_s +struct msurface_s { int visframe; // should be drawn when node is crossed @@ -264,7 +264,7 @@ typedef struct msurface_s color24 *samples; // note: this is the actual lightmap data for this surface decal_t *pdecals; -} msurface_t; +}; typedef struct hull_s { diff --git a/common/const.h b/common/const.h index b6b96b6a..5cbf8988 100644 --- a/common/const.h +++ b/common/const.h @@ -729,7 +729,6 @@ enum typedef int func_t; typedef int string_t; -typedef unsigned char byte; typedef unsigned short word; #include "xash3d_types.h" diff --git a/common/r_efx.h b/common/r_efx.h index 8cffd850..b921e383 100644 --- a/common/r_efx.h +++ b/common/r_efx.h @@ -84,7 +84,6 @@ color24 gTracerColors[] = #define FTENT_CLIENTCUSTOM 0x00080000 // Must specify callback. Callback function is responsible for killing tempent and updating fields ( unless other flags specify how to do things ) #define FTENT_SCALE 0x00100000 // An experiment -typedef struct tempent_s TEMPENTITY; struct pmtrace_s; typedef struct tempent_s { @@ -99,7 +98,7 @@ typedef struct tempent_s int hitSound; void (*hitcallback)( struct tempent_s *ent, struct pmtrace_s *ptr ); void (*callback)( struct tempent_s *ent, float frametime, float currenttime ); - TEMPENTITY *next; + struct tempent_s *next; int priority; short clientIndex; // if attached, this is the index of the client to stick to // if COLLIDEALL, this is the index of the client to ignore diff --git a/common/xash3d_types.h b/common/xash3d_types.h index ac86cdea..5a353351 100644 --- a/common/xash3d_types.h +++ b/common/xash3d_types.h @@ -11,9 +11,7 @@ typedef unsigned char byte; typedef int sound_t; typedef float vec_t; -typedef vec_t vec2_t[2]; typedef vec_t vec3_t[3]; -typedef vec_t vec4_t[4]; typedef vec_t quat_t[4]; typedef byte rgba_t[4]; // unsigned byte colorpack typedef byte rgb_t[3]; // unsigned byte colorpack diff --git a/engine/client/client.h b/engine/client/client.h index fa5ec2a6..caceb099 100644 --- a/engine/client/client.h +++ b/engine/client/client.h @@ -16,6 +16,7 @@ GNU General Public License for more details. #ifndef CLIENT_H #define CLIENT_H +#include "xash3d_types.h" #include "mathlib.h" #include "cdll_int.h" #include "menu_int.h" @@ -38,8 +39,6 @@ GNU General Public License for more details. #define SPR_HUDSPRITE 1 // hud sprite #define SPR_MAPSPRITE 2 // contain overview.bmp that diced into frames 128x128 -typedef int sound_t; - //============================================================================= typedef struct netbandwithgraph_s { diff --git a/engine/client/vox.h b/engine/client/vox.h index 7276ee45..8e6e557b 100644 --- a/engine/client/vox.h +++ b/engine/client/vox.h @@ -41,8 +41,8 @@ typedef struct float length; } sentence_t; -typedef struct channel_s channel_t; -void VOX_LoadWord( channel_t *pchan ); -void VOX_FreeWord( channel_t *pchan ); +struct channel_s; +void VOX_LoadWord( struct channel_s *pchan ); +void VOX_FreeWord( struct channel_s *pchan ); #endif diff --git a/engine/common/common.h b/engine/common/common.h index c5f9d46b..3b15c8b4 100644 --- a/engine/common/common.h +++ b/engine/common/common.h @@ -829,7 +829,7 @@ void HPAK_FlushHostQueue( void ); // shared calls struct physent_s; -typedef struct sv_client_s sv_client_t; +struct sv_client_s; typedef struct sizebuf_s sizebuf_t; qboolean CL_IsInGame( void ); qboolean CL_IsInMenu( void ); @@ -858,7 +858,7 @@ void SV_CreateDecal( sizebuf_t *msg, const float *origin, int decalIndex, int en void Log_Printf( const char *fmt, ... ) _format( 1 ); void SV_BroadcastCommand( const char *fmt, ... ) _format( 1 ); qboolean SV_RestoreCustomDecal( struct decallist_s *entry, edict_t *pEdict, qboolean adjacent ); -void SV_BroadcastPrintf( sv_client_t *ignore, char *fmt, ... ) _format( 2 ); +void SV_BroadcastPrintf( struct sv_client_s *ignore, char *fmt, ... ) _format( 2 ); int R_CreateDecalList( struct decallist_s *pList ); void R_ClearAllDecals( void ); void CL_ClearStaticEntities( void ); @@ -960,14 +960,6 @@ void ID_Init( void ); const char *ID_GetMD5( void ); void GAME_EXPORT ID_SetCustomClientID( const char *id ); -// -// sequence.c -// -typedef struct sequenceEntry_ sequenceEntry_s; -typedef struct sentenceEntry_ sentenceEntry_s; -sequenceEntry_s *Sequence_Get( const char *fileName, const char *entryName ); -sentenceEntry_s *Sequence_PickSentence( const char *groupName, int pickMethod, int *picked ); - // // masterlist.c // diff --git a/engine/common/filesystem.c b/engine/common/filesystem.c index 0eaacbb3..3560e068 100644 --- a/engine/common/filesystem.c +++ b/engine/common/filesystem.c @@ -74,7 +74,7 @@ typedef struct wadtype_s signed char type; } wadtype_t; -typedef struct file_s +struct file_s { int handle; // file descriptor fs_offset_t real_length; // uncompressed file size (for files opened in "read" mode) @@ -85,9 +85,9 @@ typedef struct file_s // contents buffer fs_offset_t buff_ind, buff_len; // buffer current index and length byte buff[FILE_BUFF_SIZE]; // intermediate buffer -} file_t; +}; -typedef struct wfile_s +struct wfile_s { string filename; int infotableofs; @@ -96,7 +96,7 @@ typedef struct wfile_s file_t *handle; dlumpinfo_t *lumps; time_t filetime; -} wfile_t; +}; typedef struct pack_s { diff --git a/engine/common/mod_local.h b/engine/common/mod_local.h index 386a3057..7b1d8cdf 100644 --- a/engine/common/mod_local.h +++ b/engine/common/mod_local.h @@ -20,6 +20,7 @@ GNU General Public License for more details. #include "edict.h" #include "eiface.h" #include "ref_api.h" +#include "studio.h" #define LM_SAMPLE_SIZE 16 #define LM_SAMPLE_EXTRASIZE 8 @@ -172,10 +173,6 @@ void Mod_ReleaseHullPolygons( void ); // // mod_studio.c // -typedef struct studiohdr_s studiohdr_t; -typedef struct mstudioseqdesc_s mstudioseqdesc_t; -typedef struct mstudiobone_s mstudiobone_t; -typedef struct mstudioanim_s mstudioanim_t; void Mod_LoadStudioModel( model_t *mod, const void *buffer, qboolean *loaded ); void Mod_UnloadStudioModel( model_t *mod ); void Mod_InitStudioAPI( void ); diff --git a/engine/common/net_buffer.h b/engine/common/net_buffer.h index 53eb33ff..0d0af632 100644 --- a/engine/common/net_buffer.h +++ b/engine/common/net_buffer.h @@ -35,7 +35,7 @@ _inline int BitByte( int bits ) return PAD_NUMBER( bits, 8 ) >> 3; } -typedef struct sizebuf_s +struct sizebuf_s { qboolean bOverflow; // overflow reading or writing const char *pDebugName; // buffer name (pointer to const name) @@ -43,7 +43,7 @@ typedef struct sizebuf_s byte *pData; int iCurBit; int nDataBits; -} sizebuf_t; +}; #define MSG_StartReading MSG_StartWriting #define MSG_GetNumBytesRead MSG_GetNumBytesWritten diff --git a/engine/common/net_encode.h b/engine/common/net_encode.h index 9eeb2b58..28484143 100644 --- a/engine/common/net_encode.h +++ b/engine/common/net_encode.h @@ -16,6 +16,8 @@ GNU General Public License for more details. #ifndef NET_ENCODE_H #define NET_ENCODE_H +#include "eiface.h" + #define DT_BYTE BIT( 0 ) // A byte #define DT_SHORT BIT( 1 ) // 2 byte field #define DT_FLOAT BIT( 2 ) // A floating point field @@ -62,7 +64,7 @@ typedef struct } delta_field_t; // one field -typedef struct delta_s +struct delta_s { const char *name; int offset; // in bytes @@ -72,9 +74,9 @@ typedef struct delta_s float post_multiplier; // for DEFINE_DELTA_POST int bits; // how many bits we send\receive qboolean bInactive; // unsetted by user request -} delta_t; +}; -typedef void (*pfnDeltaEncode)( delta_t *pFields, const byte *from, const byte *to ); +typedef void (*pfnDeltaEncode)( struct delta_s *pFields, const byte *from, const byte *to ); typedef struct { @@ -113,24 +115,24 @@ void Delta_ParseTableField( sizebuf_t *msg ); // encode routines -typedef struct entity_state_s entity_state_t; -typedef struct usercmd_s usercmd_t; -typedef struct event_args_s event_args_t; -typedef struct movevars_s movevars_t; -typedef struct clientdata_s clientdata_t; -typedef struct weapon_data_s weapon_data_t; -void MSG_WriteDeltaUsercmd( sizebuf_t *msg, usercmd_t *from, usercmd_t *to ); -void MSG_ReadDeltaUsercmd( sizebuf_t *msg, usercmd_t *from, usercmd_t *to ); -void MSG_WriteDeltaEvent( sizebuf_t *msg, event_args_t *from, event_args_t *to ); -void MSG_ReadDeltaEvent( sizebuf_t *msg, event_args_t *from, event_args_t *to ); -qboolean MSG_WriteDeltaMovevars( sizebuf_t *msg, movevars_t *from, movevars_t *to ); -void MSG_ReadDeltaMovevars( sizebuf_t *msg, movevars_t *from, movevars_t *to ); -void MSG_WriteClientData( sizebuf_t *msg, clientdata_t *from, clientdata_t *to, float timebase ); -void MSG_ReadClientData( sizebuf_t *msg, clientdata_t *from, clientdata_t *to, float timebase ); -void MSG_WriteWeaponData( sizebuf_t *msg, weapon_data_t *from, weapon_data_t *to, float timebase, int index ); -void MSG_ReadWeaponData( sizebuf_t *msg, weapon_data_t *from, weapon_data_t *to, float timebase ); -void MSG_WriteDeltaEntity( entity_state_t *from, entity_state_t *to, sizebuf_t *msg, qboolean force, int type, float tbase, int ofs ); -qboolean MSG_ReadDeltaEntity( sizebuf_t *msg, entity_state_t *from, entity_state_t *to, int num, int type, float timebase ); -int Delta_TestBaseline( entity_state_t *from, entity_state_t *to, qboolean player, float timebase ); +struct entity_state_s; +struct usercmd_s; +struct event_args_s; +struct movevars_s; +struct clientdata_s; +struct weapon_data_s; +void MSG_WriteDeltaUsercmd( sizebuf_t *msg, struct usercmd_s *from, struct usercmd_s *to ); +void MSG_ReadDeltaUsercmd( sizebuf_t *msg, struct usercmd_s *from, struct usercmd_s *to ); +void MSG_WriteDeltaEvent( sizebuf_t *msg, struct event_args_s *from, struct event_args_s *to ); +void MSG_ReadDeltaEvent( sizebuf_t *msg, struct event_args_s *from, struct event_args_s *to ); +qboolean MSG_WriteDeltaMovevars( sizebuf_t *msg, struct movevars_s *from, struct movevars_s *to ); +void MSG_ReadDeltaMovevars( sizebuf_t *msg, struct movevars_s *from, struct movevars_s *to ); +void MSG_WriteClientData( sizebuf_t *msg, struct clientdata_s *from, struct clientdata_s *to, float timebase ); +void MSG_ReadClientData( sizebuf_t *msg, struct clientdata_s *from, struct clientdata_s *to, float timebase ); +void MSG_WriteWeaponData( sizebuf_t *msg, struct weapon_data_s *from, struct weapon_data_s *to, float timebase, int index ); +void MSG_ReadWeaponData( sizebuf_t *msg, struct weapon_data_s *from, struct weapon_data_s *to, float timebase ); +void MSG_WriteDeltaEntity( struct entity_state_s *from, struct entity_state_s *to, sizebuf_t *msg, qboolean force, int type, float tbase, int ofs ); +qboolean MSG_ReadDeltaEntity( sizebuf_t *msg, struct entity_state_s *from, struct entity_state_s *to, int num, int type, float timebase ); +int Delta_TestBaseline( struct entity_state_s *from, struct entity_state_s *to, qboolean player, float timebase ); #endif//NET_ENCODE_H diff --git a/engine/common/soundlib/soundlib.h b/engine/common/soundlib/soundlib.h index 81483177..686d50b1 100644 --- a/engine/common/soundlib/soundlib.h +++ b/engine/common/soundlib/soundlib.h @@ -60,7 +60,7 @@ typedef struct sndlib_s int cmd_flags; } sndlib_t; -typedef struct stream_s +struct stream_s { const streamfmt_t *format; // streamformat to operate @@ -77,7 +77,7 @@ typedef struct stream_s char temp[OUTBUF_SIZE]; // mpeg decoder stuff size_t pos; // actual track position (or actual buffer remains) int buffsize; // cached buffer size -} stream_t; +}; /* ======================================================================== diff --git a/engine/platform/platform.h b/engine/platform/platform.h index 21772b80..cc7857b8 100644 --- a/engine/platform/platform.h +++ b/engine/platform/platform.h @@ -103,15 +103,14 @@ typedef enum rserr_unknown } rserr_t; -typedef struct vidmode_s vidmode_t; - +struct vidmode_s; // Window qboolean R_Init_Video( const int type ); void R_Free_Video( void ); qboolean VID_SetMode( void ); rserr_t R_ChangeDisplaySettings( int width, int height, qboolean fullscreen ); int R_MaxVideoModes( void ); -vidmode_t*R_GetVideoMode( int num ); +struct vidmode_s *R_GetVideoMode( int num ); void* GL_GetProcAddress( const char *name ); // RenderAPI requirement void GL_UpdateSwapInterval( void ); int GL_SetAttribute( int attr, int val ); diff --git a/ref_gl/gl_local.h b/ref_gl/gl_local.h index ace58f8c..9d49cd8c 100644 --- a/ref_gl/gl_local.h +++ b/ref_gl/gl_local.h @@ -33,6 +33,7 @@ GNU General Public License for more details. #include "pm_movevars.h" //#include "cvar.h" #include "gl_export.h" +#include "wadfile.h" #ifndef offsetof #define offsetof(s,m) (size_t)&(((s *)0)->m) @@ -480,7 +481,6 @@ void R_AliasInit( void ); // // gl_warp.c // -typedef struct mip_s mip_t; void R_InitSkyClouds( mip_t *mt, struct texture_s *tx, qboolean custom_palette ); void R_AddSkyBoxSurface( msurface_t *fa ); void R_ClearSkyBox( void );