From e8a9eb775ef3c46b486ce816bafcd22b2b9eab1a Mon Sep 17 00:00:00 2001 From: OM Date: Thu, 29 Jun 2023 21:28:43 +0200 Subject: [PATCH] Added protocol/targetGame variables --- code/cgame/cg_public.h | 3 + code/fgame/g_public.h | 330 +---------------------------------------- 2 files changed, 8 insertions(+), 325 deletions(-) diff --git a/code/cgame/cg_public.h b/code/cgame/cg_public.h index 55290315..135b63d4 100644 --- a/code/cgame/cg_public.h +++ b/code/cgame/cg_public.h @@ -360,6 +360,9 @@ typedef struct clientAnim_t* anim; stopWatch_t* stopWatch; + target_game_e targetGame; + protocol_e protocol; + } clientGameImport_t; diff --git a/code/fgame/g_public.h b/code/fgame/g_public.h index a8adbfe8..eb98af61 100644 --- a/code/fgame/g_public.h +++ b/code/fgame/g_public.h @@ -219,7 +219,6 @@ typedef struct profGame_s //=============================================================== -#if 1 typedef struct gameImport_s { void ( *Printf )( const char *format, ... ); @@ -398,333 +397,14 @@ typedef struct gameImport_s cvar_t *fsDebug; + // // New functions will start from here + // + + target_game_e targetGame; + protocol_e protocol; } gameImport_t; -#else - -typedef struct gameImport_s { - //============== general Quake services ================== - - void ( *Printf )( const char *fmt, ... ); - void ( *DPrintf )( const char *fmt, ... ); - void ( *Error )( int level, const char *fmt, ... ); - int ( *Milliseconds )( void ); - const char *( *LV_ConvertString )( const char *string ); - void* ( *Malloc )( int size ); - void ( *Free )( void *ptr ); - int ( *Argc )( void ); - char *( *Argv )( int n ); - const char *( *Args )(); - long ( *FS_FOpenFile )( const char *qpath, fileHandle_t *f, fsMode_t mode ); - void ( *FS_Read )( void *buffer, int len, fileHandle_t f ); - int ( *FS_Write )( const void *buffer, int len, fileHandle_t f ); - void ( *FS_FCloseFile )( fileHandle_t f ); - int ( *FS_GetFileList )( const char *path, const char *extension, char *listbuf, int bufsize ); - int ( *FS_Seek )( fileHandle_t f, long offset, int origin ); // fsOrigin_t - int ( *FS_Tell )( fileHandle_t f ); - int ( *FS_ReadFile )( const char *name, void **buffer, qboolean something ); - void ( *FS_FreeFile )( void *buffer ); - int ( *FS_WriteFile )( const char *qpath, const void *buffer, int size ); - fileHandle_t ( *FS_FOpenFileWrite )( const char *name ); - fileHandle_t ( *FS_FOpenFileAppend )( const char *fileName ); - void ( *FS_Flush )( fileHandle_t f ); - void ( *SendConsoleCommand )( const char *text ); - cvar_t *( *Cvar_Get )( const char *varName, const char *varValue, int varFlags ); - void ( *Cvar_Register )( vmCvar_t *cvar, const char *var_name, const char *value, int flags ); - void ( *Cvar_Update )( vmCvar_t *cvar ); - void ( *Cvar_Set )( const char *var_name, const char *value ); - int ( *Cvar_VariableIntegerValue )( const char *var_name ); - float ( *Cvar_VariableValue )( const char *var_name ); - void ( *Cvar_VariableStringBuffer )( const char *var_name, char *buffer, int bufsize ); - void ( *LocateGameData )( gentity_t *gEnts, int numGEntities, int sizeofGEntity_t, playerState_t *gameClients, int sizeofGameClient ); - void ( *DropClient )( int clientNum, const char *reason ); - void ( *SendServerCommand )( int clientNum, const char *text, ... ); - void ( *SetConfigstring )( int num, const char *string ); - char *( *GetConfigstring )( int num ); - void ( *GetUserinfo )( int num, char *buffer, int bufferSize ); - void ( *SetUserinfo )( int num, const char *buffer ); - void ( *GetServerinfo )( char *buffer, int bufferSize ); - - void ( *AddCommand )( const char *cmd, xcommand_t function ); - - // - // MODEL UTILITY FUNCTIONS - // - qboolean ( *IsModel )( int index ); - void ( *SetBrushModel )( gentity_t *ent, const char *name ); - - // DEF SPECIFIC STUFF - int ( *NumSkins )( dtiki_t *tiki ); - int ( *NumSurfaces )( dtiki_t *tiki ); - int ( *NumTags )( dtiki_t *tiki ); - qboolean ( *Frame_Commands )( dtiki_t *tiki, int animNum, int frameNum, tikiCmd_t *tiki_cmd ); - void ( *CalculateBounds )( dtiki_t *tiki, float scale, vec3_t mins, vec3_t maxs ); - - void ( *Trace )( trace_t *results, const vec3_t start, const vec3_t mins, const vec3_t maxs, const vec3_t end, int passEntityNum, int contentmask, int capsule, qboolean deepTrace ); - int ( *PointContents )( const vec3_t point, int passEntityNum ); - int ( *PointBrushnum )( vec3_t p, clipHandle_t model ); - qboolean ( *InPVS )( const vec3_t p1, const vec3_t p2 ); - qboolean ( *InPVSIgnorePortals )( const vec3_t p1, const vec3_t p2 ); - void ( *AdjustAreaPortalState )( gentity_t *ent, qboolean open ); - qboolean ( *AreasConnected )( int area1, int area2 ); - void ( *LinkEntity )( gentity_t *ent ); - void ( *UnlinkEntity )( gentity_t *ent ); - int ( *AreaEntities )( const vec3_t mins, const vec3_t maxs, int *list, int maxcount ); - void ( *ClipToEntity )( trace_t *trace, const vec3_t start, const vec3_t mins, const vec3_t maxs, const vec3_t end, int entityNum, int contentmask ); - int ( *EntitiesInBox )( const vec3_t mins, const vec3_t maxs, int *entityList, int maxcount ); - qboolean ( *EntityContact )( const vec3_t mins, const vec3_t maxs, const gentity_t *ent ); - int ( *BotAllocateClient )( void ); - void ( *BotFreeClient )( int clientNum ); - void ( *GetUsercmd )( int clientNum, usercmd_t *cmd ); - qboolean ( *GetEntityToken )( char *buffer, int bufferSize ); - - int ( *DebugPolygonCreate )( int color, int numPoints, vec3_t *points ); - void ( *DebugPolygonDelete )( int id ); - - int ( *BotLibSetup )( void ); - int ( *BotLibShutdown )( void ); - int ( *BotLibVarSet )( char *var_name, char *value ); - int ( *BotLibVarGet )( char *var_name, char *value, int size ); - int ( *BotLibDefine )( char *string ); - int ( *BotLibStartFrame )( float time ); - int ( *BotLibLoadMap )( const char *mapname ); - int ( *BotLibUpdateEntity )( int ent, void *bue ); - int ( *BotLibTest )( int parm0, char *parm1, vec3_t parm2, vec3_t parm3 ); - - int ( *BotGetSnapshotEntity )( int clientNum, int sequence ); - int ( *BotGetServerCommand )( int clientNum, char *message, int size ); - void ( *BotUserCommand )( int client, usercmd_t *ucmd ); - - int ( *AAS_BBoxAreas )( vec3_t absmins, vec3_t absmaxs, int *areas, int maxareas ); - int ( *AAS_AreaInfo )( int areanum, void *info ); - void ( *AAS_EntityInfo )( int entnum, void *info ); - - int ( *AAS_Initialized )( void ); - void ( *AAS_PresenceTypeBoundingBox )( int presencetype, vec3_t mins, vec3_t maxs ); - float ( *AAS_Time )( void ); - - int ( *AAS_PointAreaNum )( vec3_t point ); - int ( *AAS_PointReachabilityAreaIndex )( vec3_t point ); - int ( *AAS_TraceAreas )( vec3_t start, vec3_t end, int *areas, vec3_t *points, int maxareas ); - - int ( *AAS_PointContents )( vec3_t point ); - int ( *AAS_NextBSPEntity )( int ent ); - int ( *AAS_ValueForBSPEpairKey )( int ent, char *key, char *value, int size ); - int ( *AAS_VectorForBSPEpairKey )( int ent, char *key, vec3_t v ); - int ( *AAS_FloatForBSPEpairKey )( int ent, char *key, float *value ); - int ( *AAS_IntForBSPEpairKey )( int ent, char *key, int *value ); - - int ( *AAS_AreaReachability )( int areanum ); - - int ( *AAS_AreaTravelTimeToGoalArea )( int areanum, vec3_t origin, int goalareanum, int travelflags ); - int ( *AAS_EnableRoutingArea )( int areanum, int enable ); - int ( *AAS_PredictRoute )( void /*struct aas_predictroute_s*/ *route, int areanum, vec3_t origin, - int goalareanum, int travelflags, int maxareas, int maxtime, - int stopevent, int stopcontents, int stoptfl, int stopareanum ); - - int ( *AAS_AlternativeRouteGoals )( vec3_t start, int startareanum, vec3_t goal, int goalareanum, int travelflags, - void /*struct aas_altroutegoal_s*/ *altroutegoals, int maxaltroutegoals, - int type ); - int ( *AAS_Swimming )( vec3_t origin ); - int ( *AAS_PredictClientMovement )( void *move, int entnum, vec3_t origin, int presencetype, int onground, vec3_t velocity, vec3_t cmdmove, int cmdframes, int maxframes, float frametime, int stopevent, int stopareanum, int visualize ); - - - void ( *EA_Say )( int client, char *str ); - void ( *EA_SayTeam )( int client, char *str ); - void ( *EA_Command )( int client, char *command ); - - void ( *EA_Action )( int client, int action ); - void ( *EA_Gesture )( int client ); - void ( *EA_Talk )( int client ); - void ( *EA_Attack )( int client ); - void ( *EA_Use )( int client ); - void ( *EA_Respawn )( int client ); - void ( *EA_Crouch )( int client ); - void ( *EA_MoveUp )( int client ); - void ( *EA_MoveDown )( int client ); - void ( *EA_MoveForward )( int client ); - void ( *EA_MoveBack )( int client ); - void ( *EA_MoveLeft )( int client ); - void ( *EA_MoveRight )( int client ); - void ( *EA_SelectWeapon )( int client, int weapon ); - void ( *EA_Jump )( int client ); - void ( *EA_DelayedJump )( int client ); - void ( *EA_Move )( int client, vec3_t dir, float speed ); - void ( *EA_View )( int client, vec3_t viewangles ); - - void ( *EA_EndRegular )( int client, float thinktime ); - void ( *EA_GetInput )( int client, float thinktime, void *input ); - void ( *EA_ResetInput )( int client ); - - int ( *BotLoadCharacter )( char *charfile, float skill ); - void ( *BotFreeCharacter )( int character ); - float ( *Characteristic_Float )( int character, int index ); - float ( *Characteristic_BFloat )( int character, int index, float min, float max ); - int ( *Characteristic_Integer )( int character, int index ); - int ( *Characteristic_BInteger )( int character, int index, int min, int max ); - void ( *Characteristic_String )( int character, int index, char *buf, int size ); - - int ( *BotAllocChatState )( void ); - void ( *BotFreeChatState )( int handle ); - void ( *BotQueueConsoleMessage )( int chatstate, int type, char *message ); - void ( *BotRemoveConsoleMessage )( int chatstate, int handle ); - int ( *BotNextConsoleMessage )( int chatstate, void *cm ); - int ( *BotNumConsoleMessages )( int chatstate ); - void ( *BotInitialChat )( int chatstate, char *type, int mcontext, char *var0, char *var1, char *var2, char *var3, char *var4, char *var5, char *var6, char *var7 ); - int ( *BotNumInitialChats )( int chatstate, char *type ); - int ( *BotReplyChat )( int chatstate, char *message, int mcontext, int vcontext, char *var0, char *var1, char *var2, char *var3, char *var4, char *var5, char *var6, char *var7 ); - int ( *BotChatLength )( int chatstate ); - void ( *BotEnterChat )( int chatstate, int client, int sendto ); - void ( *BotGetChatMessage )( int chatstate, char *buf, int size ); - int ( *StringContains )( char *str1, char *str2, int casesensitive ); - int ( *BotFindMatch )( char *str, void *match, unsigned long int context ); - void ( *BotMatchVariable )( void *match, int variable, char *buf, int size ); - void ( *UnifyWhiteSpaces )( char *string ); - void ( *BotReplaceSynonyms )( char *string, unsigned long int context ); - int ( *BotLoadChatFile )( int chatstate, char *chatfile, char *chatname ); - void ( *BotSetChatGender )( int chatstate, int gender ); - void ( *BotSetChatName )( int chatstate, char *name, int client ); - void ( *BotResetGoalState )( int goalstate ); - void ( *BotRemoveFromAvoidGoals )( int goalstate, int number ); - void ( *BotResetAvoidGoals )( int goalstate ); - void ( *BotPushGoal )( int goalstate, void *goal ); - void ( *BotPopGoal )( int goalstate ); - void ( *BotEmptyGoalStack )( int goalstate ); - void ( *BotDumpAvoidGoals )( int goalstate ); - void ( *BotDumpGoalStack )( int goalstate ); - void ( *BotGoalName )( int number, char *name, int size ); - int ( *BotGetTopGoal )( int goalstate, void *goal ); - int ( *BotGetSecondGoal )( int goalstate, void *goal ); - int ( *BotChooseLTGItem )( int goalstate, vec3_t origin, int *inventory, int travelflags ); - int ( *BotChooseNBGItem )( int goalstate, vec3_t origin, int *inventory, int travelflags, void *ltg, float maxtime ); - int ( *BotTouchingGoal )( vec3_t origin, void *goal ); - int ( *BotItemGoalInVisButNotVisible )( int viewer, vec3_t eye, vec3_t viewangles, void *goal ); - int ( *BotGetNextCampSpotGoal )( int num, void *goal ); - int ( *BotGetMapLocationGoal )( char *name, void *goal ); - int ( *BotGetLevelItemGoal )( int index, char *classname, void *goal ); - float ( *BotAvoidGoalTime )( int goalstate, int number ); - void ( *BotSetAvoidGoalTime )( int goalstate, int number, float avoidtime ); - void ( *BotInitLevelItems )( void ); - void ( *BotUpdateEntityItems )( void ); - int ( *BotLoadItemWeights )( int goalstate, char *filename ); - void ( *BotFreeItemWeights )( int goalstate ); - void ( *BotInterbreedGoalFuzzyLogic )( int parent1, int parent2, int child ); - void ( *BotSaveGoalFuzzyLogic )( int goalstate, char *filename ); - void ( *BotMutateGoalFuzzyLogic )( int goalstate, float range ); - int ( *BotAllocGoalState )( int state ); - void ( *BotFreeGoalState )( int handle ); - - void ( *BotResetMoveState )( int movestate ); - void ( *BotMoveToGoal )( void *result, int movestate, void *goal, int travelflags ); - int ( *BotMoveInDirection )( int movestate, vec3_t dir, float speed, int type ); - void ( *BotResetAvoidReach )( int movestate ); - void ( *BotResetLastAvoidReach )( int movestate ); - int ( *BotReachabilityArea )( vec3_t origin, int testground ); - int ( *BotMovementViewTarget )( int movestate, void *goal, int travelflags, float lookahead, vec3_t target ); - int ( *BotPredictVisiblePosition )( vec3_t origin, int areanum, void *goal, int travelflags, vec3_t target ); - int ( *BotAllocMoveState )( void ); - void ( *BotFreeMoveState )( int handle ); - void ( *BotInitMoveState )( int handle, void *initmove ); - void ( *BotAddAvoidSpot )( int movestate, vec3_t origin, float radius, int type ); - - int ( *BotChooseBestFightWeapon )( int weaponstate, int *inventory ); - void ( *BotGetWeaponInfo )( int weaponstate, int weapon, void *weaponinfo ); - int ( *BotLoadWeaponWeights )( int weaponstate, char *filename ); - int ( *BotAllocWeaponState )( void ); - void ( *BotFreeWeaponState )( int weaponstate ); - void ( *BotResetWeaponState )( int weaponstate ); - - int ( *GeneticParentsAndChildSelection )( int numranks, float *ranks, int *parent1, int *parent2, int *child ); - - void ( *centerprintf )( gentity_t *ent, const char *format, ... ); - - int ( *imageindex )( const char *name ); - int ( *itemindex )( const char *name ); - int ( *soundindex )( const char *name, qboolean streamed ); - dtiki_t *( *modeltiki )( const char *name ); - - // ley0k: sky stuff - void ( *SetFarPlane )( int farPlane ); - void ( *SetSkyPortal )( qboolean skyPortal ); - - qboolean ( *Alias_Add )( dtiki_t *tiki, const char * alias, const char * name, const char *parameters ); - const char *( *Alias_FindRandom )( dtiki_t *tiki, const char * alias, aliasListNode_t **ret ); - void ( *Alias_Dump )( dtiki_t *tiki ); - void ( *Alias_Clear )( dtiki_t *tiki ); - void ( *Alias_UpdateDialog )( dtiki_t *tiki, const char *alias, int number_of_times_played, byte been_played_this_loop, int last_time_played ); - - // ANIM SPECIFIC STUFF - const char *( *Anim_NameForNum )( dtiki_t *tiki, int animnum ); - int ( *Anim_NumForName )( dtiki_t *tiki, const char * name ); - int ( *Anim_Random )( dtiki_t *tiki, const char * name ); - int ( *Anim_NumFrames )( dtiki_t *tiki, int animnum ); - float ( *Anim_Frametime )( dtiki_t *tiki, int animnum ); - float ( *Anim_CrossTime )( dtiki_t *tiki, int animNum ); - float ( *Anim_Time )( dtiki_t *tiki, int animnum ); - void ( *Anim_Delta )( dtiki_t *tiki, int animnum, vec3_t delta ); - void ( *Anim_AbsoluteDelta )( dtiki_t *tiki, int animnum, vec3_t delta ); - int ( *Anim_Flags )( dtiki_t *tiki, int animnum ); - qboolean ( *Anim_HasCommands ) ( dtiki_t *tiki, int animnum ); - - // Sound - void ( *Sound )( vec3_t *org, int entnum, int channel, const char *sound_name, float volume, float min_dist, float pitch, float maxDist, qboolean streamed ); - void ( *StopSound )( int entnum, int channel ); - float ( *SoundLength ) ( int channel, const char *path ); - byte *( *SoundAmplitudes )( int channel, const char * name ); - - // GLOBAL ALIAS SYSTEM - qboolean ( *GlobalAlias_Add )( const char * alias, const char * name, const char *parameters ); - const char *( *GlobalAlias_FindRandom )( const char * alias, aliasListNode_t **ret ); - void ( *GlobalAlias_Dump )( void ); - void ( *GlobalAlias_Clear )( void ); - - // su44 - dtiki_t* ( *TIKI_RegisterModel )( const char *fname ); - int ( *TIKI_NumAnims )( dtiki_t *tiki ); - - // SURFACE SPECIFIC STUFF - int ( *Surface_NameToNum )( dtiki_t *tiki, const char * name ); - const char *( *Surface_NumToName )( dtiki_t *tiki, int num ); - int ( *Surface_Flags )( dtiki_t *tiki, int num ); - int ( *Surface_NumSkins )( dtiki_t *tiki, int num ); - - // TAG SPECIFIC STUFF - int ( *Tag_NumForName )( dtiki_t *tiki, const char * name ); - const char *( *Tag_NameForNum )( dtiki_t *tiki, int num ); - orientation_t ( *Tag_Orientation )( dtiki_t *tiki, int anim, int frame, int num, float scale, int *bone_tag, vec4_t *bone_quat ); - orientation_t ( *Tag_OrientationEx )( dtiki_t *tiki, int anim, int frame, int num, float scale, int *bone_tag, vec4_t *bone_quat, - int crossblend_anim, int crossblend_frame, float crossblend_lerp, qboolean uselegs, qboolean usetorso, int torso_anim, int torso_frame, - int torso_crossblend_anim, int torso_crossblend_frame, float torso_crossblend_lerp ); - - // su44: these are for cg message writing - void ( *MSG_WriteBits )( int value, int bits ); - void ( *MSG_WriteChar )( int c ); - void ( *MSG_WriteByte )( int c ); - void ( *MSG_WriteSVC )( int c ); - void ( *MSG_WriteShort )( int c ); - void ( *MSG_WriteLong )( int c ); - void ( *MSG_WriteFloat )( float f ); - void ( *MSG_WriteString )( const char *s ); - void ( *MSG_WriteAngle8 )( float f ); - void ( *MSG_WriteAngle16 )( float f ); - void ( *MSG_WriteCoord )( float f ); - void ( *MSG_WriteDir )( const vec_t *dir ); - void ( *MSG_StartCGM )( int type ); - void ( *MSG_EndCGM )(); - void ( *MSG_SetClient )( int iClient ); - void ( *SetBroadcastAll )(); - void ( *SetBroadcastVisible )( const vec_t *vPos, const vec_t *vPosB ); - void ( *SetBroadcastHearable )( const vec_t *vPos, const vec_t *vPosB ); - - debugline_t** DebugLines; - int* numDebugLines; - debugstring_t** DebugStrings; - int* numDebugStrings; - -} gameImport_t; - -#endif typedef struct gameExport_s { int apiversion;