diff --git a/code/game/g_active.c b/code/game/g_active.c index fd6c915..957d73f 100644 --- a/code/game/g_active.c +++ b/code/game/g_active.c @@ -303,15 +303,6 @@ static void ClientImpacts( gentity_t *ent, pmove_t *pm ) { } -/* -============ -G_TouchTriggers -============ -*/ -/** -* Find all trigger entities that ent's current position touches. -* Spectators will only interact with teleporters. -*/ void G_TouchTriggers( gentity_t *ent ) { int i, num; int touch[MAX_GENTITIES]; @@ -931,10 +922,6 @@ static qhandle_t shieldDamageSound=0; static qhandle_t shieldMurderSound=0; static qhandle_t shieldDeactivateSound=0; - -/** -* Remove a forcefield -*/ void G_Active_ShieldRemove(gentity_t *self) { self->think = G_FreeEntity; @@ -2210,15 +2197,6 @@ static void ClientThink_real( gentity_t *ent ) { } -/* -================== -ClientThink - -================== -*/ -/** -* A new command has arrived from the client -*/ void ClientThink( int clientNum ) { gentity_t *ent; @@ -2290,16 +2268,6 @@ static void SpectatorClientEndFrame( gentity_t *ent ) { } } -/* -============== -ClientEndFrame -============== -*/ -/** -* Called at the end of each server frame for each connected client -* A fast client will have multiple ClientThink for each ClientEdFrame, -* while a slow client may have multiple ClientEndFrame between ClientThink. -*/ void ClientEndFrame( gentity_t *ent ) { int i; playerState_t *ps = &ent->client->ps; diff --git a/code/game/g_client.c b/code/game/g_client.c index 55eebcb..59bd07b 100644 --- a/code/game/g_client.c +++ b/code/game/g_client.c @@ -519,16 +519,6 @@ void G_Client_Respawn( gentity_t *ent ) { tent->s.clientNum = ent->s.clientNum; } -/* -================ -G_Client_TeamCount - -Returns number of players on a team -================ -*/ -/** -* Returns number of players on a team -*/ team_t G_Client_TeamCount( int ignoreClientNum, int team ) { int i; int count = 0; @@ -548,13 +538,6 @@ team_t G_Client_TeamCount( int ignoreClientNum, int team ) { return (team_t)count; } - -/* -================ -G_Client_PickTeam - -================ -*/ team_t G_Client_PickTeam( int ignoreClientNum ) { int counts[TEAM_NUM_TEAMS]; diff --git a/code/game/g_cmds.c b/code/game/g_cmds.c index f9f6d40..a8e7c43 100644 --- a/code/game/g_cmds.c +++ b/code/game/g_cmds.c @@ -17,12 +17,6 @@ extern int numKilled; extern clInitStatus_t clientInitialStatus[]; extern qboolean levelExiting; -/* -================== -DeathmatchScoreboardMessage - -================== -*/ void DeathmatchScoreboardMessage( gentity_t *ent ) { char entry[1024]; char string[1400]; @@ -75,14 +69,6 @@ void DeathmatchScoreboardMessage( gentity_t *ent ) { string ) ); } - -/* -================== -Cmd_Score_f - -Request current scoreboard information -================== -*/ void Cmd_Score_f( gentity_t *ent ) { DeathmatchScoreboardMessage( ent ); } @@ -106,12 +92,6 @@ static qboolean CheatsOk( gentity_t *ent ) { return qtrue; } - -/* -================== -ConcatArgs -================== -*/ char *ConcatArgs( int start ) { int i, c, tlen; static char line[MAX_STRING_CHARS]; @@ -625,13 +605,6 @@ static void Cmd_Kill_f( gentity_t *ent ) } } -/* -================= -BroadCastTeamChange - -Let everyone know about a team change -================= -*/ void BroadcastTeamChange( gclient_t *client, int oldTeam ) { clientSession_t *sess = &client->sess; @@ -681,11 +654,6 @@ void BroadcastClassChange( gclient_t *client, pclass_t oldPClass ) trap_SendServerCommand( -1, va("cp \"%.15s" S_COLOR_WHITE "%s\n\"", client->pers.netname, g_classData[client->sess.sessionClass].message) ); } -/* -================= -SetTeam -================= -*/ qboolean SetTeam( gentity_t *ent, char *s ) { int team, oldTeam; gclient_t *client; @@ -977,14 +945,7 @@ qboolean SetClass( gentity_t *ent, char *s, char *teamName, qboolean SaveToCvar return qtrue; } -/* -================= -StopFollowing -If the client being followed leaves the game, or you just want to drop -to free floating spectator mode -================= -*/ void StopFollowing( gentity_t *ent ) { playerState_t *ps = &ent->client->ps; clientSession_t *sess = &ent->client->sess; @@ -1285,11 +1246,6 @@ static void Cmd_Flight_f( gentity_t *ent ) trap_SendServerCommand( ent-g_entities, va("print \"%s\"", msg)); } -/* -================= -Cmd_FollowCycle_f -================= -*/ void Cmd_FollowCycle_f( gentity_t *ent, int dir ) { int clientnum; int original; diff --git a/code/game/g_combat.c b/code/game/g_combat.c index 3d39f7c..c230e01 100644 --- a/code/game/g_combat.c +++ b/code/game/g_combat.c @@ -72,13 +72,7 @@ void SetScore( gentity_t *ent, int score ) { //RPG-X: RedTechie - Lets enable score updating without this scores will not be updated ent->client->UpdateScore = qfalse; } -/* -================= -TossClientItems -Toss the weapon and powerups for the killed player -================= -*/ void TossClientItems( gentity_t *self, qboolean dis_con ) { gitem_t *item; float angle; @@ -171,13 +165,8 @@ static void GibEntity( gentity_t *self, int killer ) { self->r.contents = 0; } -/* -================== -body_die -================== -*/ void body_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int damage, int meansOfDeath ) { - int contents; + int contents; contents = trap_PointContents( self->r.currentOrigin, -1 ); if(rpg_medicsrevive.integer == 1 && !( contents & CONTENTS_NODROP ) && (meansOfDeath != MOD_TRIGGER_HURT)){ if ( self->health > GIB_HEALTH_IMPOSSIBLE ) { @@ -1050,30 +1039,6 @@ static int G_LocationDamage(vec3_t point, gentity_t* targ, gentity_t* attacker, return take; } -/* -============ -T_Damage - -targ entity that is being damaged -inflictor entity that is causing the damage -attacker entity that caused the inflictor to damage targ -example: targ=monster, inflictor=rocket, attacker=player - -dir direction of the attack for knockback -point point at which the damage is being inflicted, used for headshots -damage amount of damage being inflicted -knockback force to be applied against targ as a result of the damage - -inflictor, attacker, dir, and point can be NULL for environmental effects - -dflags these flags are used to control how T_Damage works -DAMAGE_RADIUS damage was indirect (from a nearby explosion) -DAMAGE_NO_ARMOR armor does not protect from this damage -DAMAGE_NO_KNOCKBACK do not affect velocity, just view angles -DAMAGE_NO_PROTECTION kills godmode, armor, everything -============ -*/ - void G_Damage( gentity_t *targ, gentity_t *inflictor, gentity_t *attacker, vec3_t dir, vec3_t point, int damage, int dflags, int mod ) { gclient_t *client; @@ -1360,15 +1325,6 @@ void G_Damage( gentity_t *targ, gentity_t *inflictor, gentity_t *attacker, } - -/* -============ -CanDamage - -Returns qtrue if the inflictor can directly damage the target. Used for -explosions and melee attacks. -============ -*/ qboolean CanDamage (gentity_t *targ, vec3_t origin) { vec3_t dest; trace_t tr; @@ -1418,12 +1374,6 @@ qboolean CanDamage (gentity_t *targ, vec3_t origin) { return qfalse; } - -/* -============ -G_RadiusDamage -============ -*/ extern void tripwireThink ( gentity_t *ent ); qboolean G_RadiusDamage ( vec3_t origin, gentity_t *attacker, float damage, float radius, gentity_t *ignore, int dflags, int mod) { @@ -1531,12 +1481,7 @@ qboolean IsBorg(gentity_t *ent) { extern void InitBBrush(gentity_t *ent); extern void SP_misc_model_breakable(gentity_t* self); -/* -============ -G_Repair -RPG-X | GSIO01 | 09/05/2009 -============ -*/ + void G_Repair(gentity_t *ent, gentity_t *tr_ent, float rate) { float distance; vec3_t help, forward; diff --git a/code/game/g_items.c b/code/game/g_items.c index 3c51a63..20bb6ab 100644 --- a/code/game/g_items.c +++ b/code/game/g_items.c @@ -111,13 +111,6 @@ int Min_Weapon(int num) } } - -/* -=============== -Padd_Add -RPG-X | Marcin | 06/12/2008 -=============== -*/ void Padd_Add( gentity_t *key, gentity_t *who, char *txt ) { int i = 0; @@ -158,12 +151,6 @@ void Padd_Add( gentity_t *key, gentity_t *who, char *txt ) ++paddDataNum; } -/* -=============== -Padd_Get -RPG-X | Marcin | 06/12/2008 -=============== -*/ char *Padd_Get( gentity_t *key, gentity_t *who ) { int i, j; @@ -188,12 +175,6 @@ char *Padd_Get( gentity_t *key, gentity_t *who ) return 0; } -/* -=============== -Padd_Remove -RPG-X | Marcin | 06/12/2008 -=============== -*/ void Padd_Remove( gentity_t *key ) { int i = 0; @@ -452,11 +433,6 @@ int Pickup_Armor( gentity_t *ent, gentity_t *other ) { //====================================================================== -/* -=============== -RespawnItem -=============== -*/ void RespawnItem( gentity_t *ent ) { if(!ent) return; @@ -503,11 +479,6 @@ void RespawnItem( gentity_t *ent ) { } -/* -=============== -Touch_Item -=============== -*/ void Touch_Item (gentity_t *ent, gentity_t *other, trace_t *trace) { int respawn; @@ -736,14 +707,6 @@ gentity_t *DropWeapon( gentity_t *ent, gitem_t *item, float angle, int flags, ch return LaunchItem( item, ent, origin, velocity, flags, txt ); } - -/* -================ -Drop_Item - -Spawns an item and tosses it forward -================ -*/ gentity_t *Drop_Item( gentity_t *ent, gitem_t *item, float angle ) { vec3_t velocity; vec3_t angles; @@ -773,14 +736,6 @@ void Use_Item( gentity_t *ent, gentity_t *other, gentity_t *activator ) { //====================================================================== -/* -================ -FinishSpawningItem - -Traces down to find where an item should rest, instead of letting them -free fall from their spawn points -================ -*/ void FinishSpawningItem( gentity_t *ent ) { trace_t tr; vec3_t dest; @@ -955,11 +910,6 @@ qboolean FinishSpawningDecoy( gentity_t *ent, int itemIndex ) qboolean itemRegistered[MAX_ITEMS]; -/* -============== -ClearRegisteredItems -============== -*/ void ClearRegisteredItems( void ) { memset( itemRegistered, 0, sizeof( itemRegistered ) ); // players always start with the base weapon @@ -979,13 +929,6 @@ void ClearRegisteredItems( void ) { RegisterItem( BG_FindItemForWeapon( WP_7 ) ); } -/* -=============== -RegisterItem - -The item will be added to the precache list -=============== -*/ void RegisterItem( gitem_t *item ) { if ( !item ) { G_Error( "RegisterItem: NULL" ); @@ -995,15 +938,6 @@ void RegisterItem( gitem_t *item ) { itemRegistered[ item - bg_itemlist ] = qtrue; } - -/* -=============== -SaveRegisteredItems - -Write the needed items to a config string -so the client will know which ones to precache -=============== -*/ void SaveRegisteredItems( void ) { char string[MAX_ITEMS+1]; int i; @@ -1062,16 +996,6 @@ qboolean G_ItemClassnameSuppressed( char *itemname ) return G_ItemSuppressed( itemType, itemTag ); } -/* -============ -G_SpawnItem - -Sets the clipping size and plants the object on the floor. - -Items can't be immediately dropped to floor, because they might -be on an entity that hasn't spawned yet. -============ -*/ void G_SpawnItem (gentity_t *ent, gitem_t *item) { if ( G_ItemSuppressed( item->giType, item->giTag ) ) { @@ -1130,13 +1054,6 @@ void G_BounceItem( gentity_t *ent, trace_t *trace ) { ent->s.pos.trTime = level.time; } - -/* -================ -G_RunItem - -================ -*/ void G_RunItem( gentity_t *ent ) { vec3_t origin; trace_t tr; diff --git a/code/game/g_local.h b/code/game/g_local.h index 192b437..9570859 100644 --- a/code/game/g_local.h +++ b/code/game/g_local.h @@ -370,9 +370,9 @@ struct gentity_s { * Various connection states a client can have. */ typedef enum { - CON_DISCONNECTED, - CON_CONNECTING, - CON_CONNECTED + CON_DISCONNECTED, /*!< client is disconnected */ + CON_CONNECTING, /*!< client is connecting */ + CON_CONNECTED /*!< client is connected */ } clientConnected_t; /** \enum spectatorState_t @@ -380,10 +380,10 @@ typedef enum { * Diffrent spectator modes. */ typedef enum { - SPECTATOR_NOT, - SPECTATOR_FREE, - SPECTATOR_FOLLOW, - SPECTATOR_SCOREBOARD + SPECTATOR_NOT, /*!< not spectating */ + SPECTATOR_FREE, /*!< free spectator mode */ + SPECTATOR_FOLLOW, /*!< follow spectator mode */ + SPECTATOR_SCOREBOARD /*!< spectator scoreboard */ } spectatorState_t; /** \enum playerTeamStateState_t @@ -397,14 +397,16 @@ typedef enum { /** * \brief Contains statistic information about players for team games. * +* \todo remove me +* * For example number of flag captures. */ typedef struct { - playerTeamStateState_t state; + playerTeamStateState_t state; /*!< players team state */ - int location; + int location; /*!< current location */ - int captures; + int captures; /*!< number of captured flags */ int basedefense; int carrierdefense; int flagrecovery; @@ -446,6 +448,12 @@ typedef struct { #define MAX_VOTE_COUNT 3 +/** + * Set the score for a client. + * + * \param ent The client. + * \param score New score for the client. + */ void SetScore( gentity_t *ent, int score ); /** @@ -733,37 +741,111 @@ typedef struct { // // g_spawn.c // -qboolean G_SpawnString( const char* key, const char* defaultString, char** out ); -// spawn string returns a temporary reference, you must CopyString() if you want to keep it -qboolean G_SpawnFloat( const char* key, const char* defaultString, float* out ); -qboolean G_SpawnInt( const char* key, const char* defaultString, int* out ); +/** + * \brief Get a string for a custom entity key. + * + * Spawn string returns a temporary reference, you must copy the string if you want to keep it. + * + * \param[in] key Key to get the value for. + * \param[in] defaultString Default value for this key. + * \param[out] out The result. + * \return Success or fail. + */ +qboolean G_SpawnString( const char* key, const char* defaultString, char** out ); + +/** + * \brief Get a float for a custom entity key. + * + * \param[in] key Key to get the value for. + * \param[in] defaultString Default value for this key. + * \param[out] out The result. + * \return Success or fail. + */ +qboolean G_SpawnFloat( const char* key, const char* defaultString, float* out ); + +/** + * \brief Get a int for a custom entity key. + * + * \param[in] key Key to get the value for. + * \param[in] defaultString Default value for this key. + * \param[out] out The result. + * \return Success or fail. + */ +qboolean G_SpawnInt( const char* key, const char* defaultString, int* out ); + +/** + * \brief Get a vector for a custom entity key. + * + * \param[in] key Key to get the value for. + * \param[in] defaultString Default value for this key. + * \param[out] out The result. + * \return Success or fail. + */ qboolean G_SpawnVector( const char* key, const char* defaultString, float* out ); + +/** + * \brief Spawn all entities from the entity string. + */ void G_SpawnEntitiesFromString( void ); + +/** + * \brief Creates a copy of the given string. Allocated on the memory pool. + * + * \param string String to copy. + * \return Copy of the string. + */ char* G_NewString( const char* string ); -// -// Flash Light / Laser -// -void Laser_Gen (gentity_t* ent, int type); -void Laser_Think( gentity_t* self ); - - // // g_cmds.c // -char* ConcatArgs( int start ); -void Cmd_Score_f (gentity_t* ent); -void StopFollowing( gentity_t* ent ); -void BroadcastTeamChange( gclient_t* client, int oldTeam ); -qboolean SetTeam( gentity_t* ent, char* s ); -void Cmd_FollowCycle_f( gentity_t* ent, int dir ); -void Cmd_Ready_f (gentity_t* ent); +/** + * Concatenate all arguments for this string. + * + * \param start start from the given argument + * \return String containing concatenated command arguments. + */ +char* ConcatArgs( int start ); -// -// g_roff.c -// -int G_LoadRoff( const char* fileName ); -void G_Roff( gentity_t* ent ); +/** + * Request current scoreboard information. + */ +void Cmd_Score_f (gentity_t* ent); + +/** + * If the client being followed leaves the game, or you just want to drop + * to free floating spectator mode + */ +void StopFollowing( gentity_t* ent ); + +/** + * Let everyone know about a team change. + * + * \param client The client that changed team. + * \param oldTeam The team the client was in. + */ +void BroadcastTeamChange( gclient_t* client, int oldTeam ); + +/** + * Set the team for a player. + * + * \param ent A player. + * \param s The new team. + * \return Success or fail. + */ +qboolean SetTeam( gentity_t* ent, char* s ); + +/** + * Cycle different players. + */ +void Cmd_FollowCycle_f( gentity_t* ent, int dir ); + +/** + * Command signaling player readiness. + * + * \param ent A player. + */ +void Cmd_Ready_f (gentity_t* ent); // // g_items.c @@ -782,71 +864,400 @@ typedef struct char value[256]; } paddData_t; -#define PADD_DATA_MAX 256 // max number of padds -#define MAX_DROPPED 255 // should be reasonable +#define PADD_DATA_MAX 256 //!< max number of padds +#define MAX_DROPPED 255 //!< should be reasonable extern paddData_t paddData[PADD_DATA_MAX]; extern int paddDataNum; extern int numTotalDropped; -void Padd_Add( gentity_t* key, gentity_t* who, char* txt); -char* Padd_Get( gentity_t* key, gentity_t* who ); -void Padd_Remove( gentity_t* key ); +/** + * Add a new padd. + * + * \param key entity + * \param who owner of the padd + * \param txt text of the padd + * \author Ubergames - Marcin + * \date 06/12/2008 + */ +void Padd_Add( gentity_t* key, gentity_t* who, char* txt); -void G_RunItem( gentity_t* ent ); -void RespawnItem( gentity_t* ent ); +/** + * Pickup padd. + * + * \param key entity + * \param who Who picked up the padd. + * \return Text of the padd. + * \author Ubergames - Marcin + * \date 06/12/2008 + */ +char* Padd_Get( gentity_t* key, gentity_t* who ); -void UseHoldableItem( gentity_t* ent ); -void PrecacheItem (gitem_t* it); -gentity_t* Drop_Item( gentity_t* ent, gitem_t* item, float angle ); -void SetRespawn (gentity_t* ent, float delay); -void G_SpawnItem (gentity_t* ent, gitem_t* item); -void FinishSpawningItem( gentity_t* ent ); -void Think_Weapon (gentity_t* ent); -int ArmorIndex (gentity_t* ent); -void Add_Ammo (gentity_t* ent, int weapon, int count); -void Touch_Item (gentity_t* ent, gentity_t* other, trace_t* trace); +/** + * Remove a padd. + * + * \param key entity + * \author Ubergames - Marcin + * \date 06/12/2008 + */ +void Padd_Remove( gentity_t* key ); -void ClearRegisteredItems( void ); -void RegisterItem( gitem_t* item ); -void SaveRegisteredItems( void ); +/** + * Run an item. + * + * \param ent The item. + */ +void G_RunItem( gentity_t* ent ); + +/** + * Repsawn an item. + * + * \param ent The item. + */ +void RespawnItem( gentity_t* ent ); + +/** + * Spawns an item and tosses it forward. + * + * \param ent An entity to toss from. + * \param item The item. + * \param angle Direction to toss to. + * \return The entity for the item. + */ +gentity_t* Drop_Item( gentity_t* ent, gitem_t* item, float angle ); + +/** + * Sets the clipping size and plants the object on the floor. + * Items can't be immediately dropped to floor, because they might + * be on an entity that hasn't spawned yet. + * + * \param ent Entity for item. + * \param item The item. + */ +void G_SpawnItem (gentity_t* ent, gitem_t* item); + +/** + * Traces down to find where an item should rest, instead of letting them + * free fall from their spawn points + * + * \param ent Entity for the item. + */ +void FinishSpawningItem( gentity_t* ent ); + +/** + * Add ammo for a weapon to a player. + * + * \param ent The player. + * \param weapon For which weapon. + * \param count Ammount of ammo. + */ +void Add_Ammo (gentity_t* ent, int weapon, int count); + +/** + * Touch function for items. + * + * \param ent The entity for the item. + * \param other The touching entity. + * \param trace A trace. + */ +void Touch_Item (gentity_t* ent, gentity_t* other, trace_t* trace); + +/** + * Clear all registered items. + */ +void ClearRegisteredItems( void ); + +/** + * Register a new item. The item will be added to the precache list. + * + * \param item Item to register. + */ +void RegisterItem( gitem_t* item ); + +/** + * Write the needed items to a config string so the client will know which ones to precache. + */ +void SaveRegisteredItems( void ); // // g_utils.c // -int G_ModelIndex( char* name ); -int G_SoundIndex( char* name ); -void G_TeamCommand( team_t team, char* cmd ); -int G_TricStringIndex( char* name ); //TiM -void G_KillBox (gentity_t* ent); -//RPG-X: J2J - Added to move enities out of a transporting player area. -qboolean G_MoveBox (gentity_t* ent); -gentity_t* G_Find (gentity_t* from, int fieldofs, const char* match); -gentity_t* G_PickTarget (char* targetname); -//TiM -//gentity_t *G_PickEntity ( char* className, int fieldofs, const char *match ); -void G_UseTargets (gentity_t* ent, gentity_t* activator); -void G_UseTargets2( gentity_t* ent, gentity_t* activator, char* target ); -void G_SetMovedir ( vec3_t angles, vec3_t movedir); +/** + * \brief Get the model index for a model. + * + * Get the model index for a model. + * + * \param name the model name + * + * \return the models index + */ +int G_ModelIndex( char* name ); -void G_InitGentity( gentity_t* ent ); -gentity_t* G_Spawn (void); -gentity_t* G_TempEntity( vec3_t origin, int event ); -void G_Sound( gentity_t* ent, int soundIndex ); -void G_FreeEntity( gentity_t* ent ); +/** + * \brief Get the sound index for a sound. + * + * Get the sound index for a sound. + * + * \param name the sound name + * + * \return the sounds index + */ +int G_SoundIndex( char* name ); -void G_TouchTriggers (gentity_t* ent); -void G_TouchSolids (gentity_t* ent); +/** + * \brief Issue a team command. + * + * Issue a team command. + * + * \param team the team + * \param cmd the command + */ +void G_TeamCommand( team_t team, char* cmd ); -float* tv (float x, float y, float z); -char* vtos( const vec3_t v ); +/** + * \brief Get the tric string index. + * + * Get the tric string index. + * + * \param name the tric string name + * + * \return the tric strings index + * + * \author Ubergames - TiM + */ +int G_TricStringIndex( char* name ); +/** + * \brief Kill all that would be inside a new one. + * + * Kills all entities that would touch the proposed new positioning + * of ent. Ent should be unlinked before calling this! + * + * \param ent the entity + */ +void G_KillBox (gentity_t* ent); + +/** + * \author Ubergames - J2J + * \brief Push all entities away that are inside a new entity. + * + * Basically does teh same as G_KillBox except it will + * push players and other entities away instead of killing them. + * + * \param ent the entity + * + * \return was an ent moved? + */ +qboolean G_MoveBox (gentity_t* ent); + +/** + * + * \brief Finds an entity. + * + * Searches all active entities for the next one that holds + * the matching string at fieldofs (use the FOFS() macro) in the structure. + * Searches beginning at the entity after from, or the beginning if NULL + * NULL will be returned if the end of the list is reached. + * + * \param from search from this entity on + * \param fieldofs in which field to look + * \param match string to match + * + * \return an matching entity or NULL + */ +gentity_t* G_Find (gentity_t* from, int fieldofs, const char* match); + +/** + * \brief Pick a target. + * + * Selects a random entity from among the targets. + * + * \param targetname the targets targetname + * + * \return an entity or NULL + */ +gentity_t* G_PickTarget (char* targetname); + +/** + * \brief Use all of the given entity's targets. + * + * Use all of the given entity's targets. + * + * \param ent the entity + * \param activator the initiator of the function call + */ +void G_UseTargets (gentity_t* ent, gentity_t* activator); + +/** + * \brief Use all targets of the given entity. + * + * Goes through all entities and calls ther use function if their + * targetname, swapname, truename, falsename, bluename are matching + * the target. activator should be set the the inflictor of this function + * call. + * + * \param ent the entity + * \param activator the activator + * \param target target to match + */ +void G_UseTargets2( gentity_t* ent, gentity_t* activator, char* target ); + +/** + * \brief Converts angles to move directions. + * + * The editor only specifies a single value for angles (yaw), + * but we have special constants to generate an up or down direction. + * Angles will be cleared, because it is being used to represent a direction + * instead of an orientation. + * + * \param angles the angles + * \param movedir the movedir + */ +void G_SetMovedir ( vec3_t angles, vec3_t movedir); + +/** + * \brief Init the entity. + * + * Inits a given game entity. + * + * \param e the entity + */ +void G_InitGentity( gentity_t* ent ); +/** + * \brief Spawns a new entity. + * + * Either finds a free entity, or allocates a new one. + * The slots from 0 to MAX_CLIENTS-1 are always reserved for clients, + * and will never be used by anything else. + * Try to avoid reusing an entity that was recently freed, because it + * can cause the client to think the entity morphed into something else + * instead of being removed and recreated, which can cause interpolated + * angles and bad trails. + * + * \return a new entity or NULL + */ +gentity_t* G_Spawn (void); + +/** + * \brief Spawn an temporary entity. + * + * Spawns an event entity that will be auto-removed + * The origin will be snapped to save net bandwidth, so care + * must be taken if the origin is right on a surface (snap towards start vector first) + * + * \param origin the origin + * \param event the event to use for this entity + * + * \return the temporary entity + */ +gentity_t* G_TempEntity( vec3_t origin, int event ); + +/** + * \brief Makes an entity to play a non looping sound. + * + * Makes an entity to play a non looping sound. + * + * \param ent the entity + * \param soundIndex the sounds index + */ +void G_Sound( gentity_t* ent, int soundIndex ); + +/** + * \brief Free an entity. + * + * Marks the entity as free. + * + * \param ed entity to free + */ +void G_FreeEntity( gentity_t* ent ); + +/** +* Find all trigger entities that ent's current position touches. +* Spectators will only interact with teleporters. +*/ +void G_TouchTriggers (gentity_t* ent); + +/** + * \brief Create a temporary vector. + * + * This is just a convenience function + * for making temporary vectors for function calls + * + * \param x x-value + * \param y y-value + * \param z z-value + * + * \return temporary vector + */ +float* tv(float x, float y, float z); + +/** + * \brief Converts a vector to a string to be printed. + * + * This is just a convenience function + * for printing vectors + * + * \param v the vector + * + * \return string representation of the vector + */ +char* vtos( const vec3_t v ); + +/** + * \brief Get the yaw from a vector. + * + * Get the yaw from a vector. + * + * \param vec the vector + * + * \return the yaw + */ float vectoyaw( const vec3_t vec ); -void G_AddPredictableEvent( gentity_t* ent, int event, int eventParm ); -void G_AddEvent( gentity_t* ent, int event, int eventParm ); -void G_SetOrigin( gentity_t* ent, vec3_t origin ); -void G_SetAngles( gentity_t* ent, vec3_t anlges ); //RPG-X | GSIO01 | 24.08.2009 +/** + * \brief Adds a new Predictable event. + * + * Use for non-pmove events that would also be predicted on the + * client side: jumppads and item pickups + * Adds an event+parm and twiddles the event counter + * + * \param ent the entity + * \param event the event + * \param eventParm any parameters for the event + */ +void G_AddPredictableEvent( gentity_t* ent, int event, int eventParm ); + +/** + * \brief Add a new event. + * + * Adds an event+parm and twiddles the event counter + * + * \param ent the entity + * \param event the event + * \param eventParm parameter for the event + */ +void G_AddEvent( gentity_t* ent, int event, int eventParm ); + +/** + * \brief Set the Origin of an entity. + * + * Sets the pos trajectory for a fixed position + * + * \param ent the entity + * \param origin the new origin + */ +void G_SetOrigin( gentity_t* ent, vec3_t origin ); + +/** + * \brief Set the angles of an entity. + * + * Sets the pos trajectory for a fixed angular position + * + * \param ent the entity + * \param angles the new angles + * \author Ubergames - GSIO01 + */ +void G_SetAngles( gentity_t* ent, vec3_t anlges ); //RPG-X | GSIO01 | 24.08.2009 /** * Get a list of entities in a specified radous around an origin. @@ -858,7 +1269,7 @@ void G_SetAngles( gentity_t* ent, vec3_t anlges ); //RPG-X | GSIO01 | 24.08.200 * \param ent_list List to store found entities in. * \return Count of entities found. */ -int G_RadiusList ( vec3_t origin, float radius, list_p ignore, qboolean takeDamage, list_p ent_list); +int G_RadiusList ( vec3_t origin, float radius, list_p ignore, qboolean takeDamage, list_p ent_list); /** * Get a list of specified entity classes in a specified radius. @@ -873,7 +1284,7 @@ int G_RadiusList ( vec3_t origin, float radius, list_p ignore, qboolean takeDa * \param ent_list list to store the results * \return count of found entities */ -int G_RadiusListOfTypes(list_p classnames, vec3_t origin, float radius, list_p ignore, list_p ent_list); +int G_RadiusListOfTypes(list_p classnames, vec3_t origin, float radius, list_p ignore, list_p ent_list); /** * Get the neares entity to an origin. @@ -885,7 +1296,7 @@ int G_RadiusListOfTypes(list_p classnames, vec3_t origin, float radius, list_p * \param takeDamage Only return entities that match this value for takeDamage. * \return Nearest entity found. */ -gentity_t* G_GetNearestEnt(char* classname, vec3_t origin, float radius, list_p ignore, qboolean takeDamage); +gentity_t* G_GetNearestEnt(char* classname, vec3_t origin, float radius, list_p ignore, qboolean takeDamage); /** * Get the nearest player orund an origin. @@ -895,25 +1306,137 @@ gentity_t* G_GetNearestEnt(char* classname, vec3_t origin, float radius, list_p * \param ignore List of entities to ignore. * \return Nearest player. */ -gentity_t* G_GetNearestPlayer(vec3_t origin, float radius, list_p ignore ); +gentity_t* G_GetNearestPlayer(vec3_t origin, float radius, list_p ignore ); -// GSIO - additional util funcs to make life easier with spawnfile +/** + * \author Ubergames - GSIO01 + * \brief Get all entities with the specified targetname. + * + * Get all entities with the specified targetname. + * + * \param targetname the targetname + * \param entities the result + * + * \return number of entities found + */ int G_GetEntityByTargetname(const char* targetname, list_p entities); + +/** + * \author Ubergames - GSIO01 + * \brief Get all entities with specified target. + * + * Get all entities matching the specifie target. + * + * \param target target the entities should have + * \param entities the result + * + * \return number of matches found + */ int G_GetEntityByTarget(const char* target, list_p entities); + +/** + * \author Ubergames - GSIO01 + * \brief Get all entities with specified brush model + * + * Get all entities matching the specified brush model. + * Normally this only shoud be one entity. + * + * \param bmodel brush model to match + * \param entities the result + * + * \return number of matches found + */ int G_GetEntityByBmodel(char* bmodel,list_p entities); -/* shader remapping */ +/** + * \brief Add a new shader remap. + * + * Remaps oldShader with newShader. + * + * \param oldShader shader to be remapped + * \param newShader replacement shader + * \param timeOffset time offset + */ void AddRemap(const char* oldShader, const char* newShader, float timeOffset); // // g_combat.c // -qboolean CanDamage (gentity_t* targ, vec3_t origin); -void G_Damage (gentity_t* targ, gentity_t* inflictor, gentity_t* attacker, vec3_t dir, vec3_t point, int damage, int dflags, int mod); -qboolean G_RadiusDamage (vec3_t origin, gentity_t* attacker, float damage, float radius, gentity_t* ignore, int dflags, int mod); -void body_die( gentity_t* self, gentity_t* inflictor, gentity_t* attacker, int damage, int meansOfDeath ); -void TossClientItems( gentity_t* self, qboolean dis_con ); -void G_Repair(gentity_t* ent, gentity_t* tr_ent, float rate); //RPG-X | GSIO01 | 09/05/2009 +/** + * Returns qtrue if the inflictor can directly damage the target. Used for + * explosions and melee attacks. + * + * \param targ the target + * \param origin the origin + * \return qtrue if the inflictor can directly damage the target. Used for explosions and melee attacks. + */ +qboolean CanDamage (gentity_t* targ, vec3_t origin); + +/** + * Damage an entity. + * + * \param targ entity that is being damaged + * \param inflictor entity that is causing the damage + * \param attacker entity that caused the inflictor to damage targ + * \param dir direction of the attack for knockback + * \param point point at which the damage is being inflicted, used for headshots + * \param damage amount of damage being inflicted + * \param knockback force to be applied against targ as a result of the damage + * \param dflags these flags are used to control how G_Damage works + * \param mod means of death + * + * Damage flags: + * DAMAGE_RADIUS damage was indirect (from a nearby explosion) + * DAMAGE_NO_ARMOR armor does not protect from this damage + * DAMAGE_NO_KNOCKBACK do not affect velocity, just view angles + * DAMAGE_NO_PROTECTION kills godmode, armor, everything + */ +void G_Damage (gentity_t* targ, gentity_t* inflictor, gentity_t* attacker, vec3_t dir, vec3_t point, int damage, int dflags, int mod); + +/** + * Damage all entities around an origin in a specified radius. + * + * \return Hit a client? + * \param origin Origin. + * \param attacker Attacker. + * \param damage Amount much damage. + * \param radius Radius. + * \param ignore Entity to ignore. + * \param dflags Damage flags. + * \param mod Means of death. + * \todo Replace ignore entity by list of entites. + */ +qboolean G_RadiusDamage (vec3_t origin, gentity_t* attacker, float damage, float radius, gentity_t* ignore, int dflags, int mod); + +/** + * Let a body die. + * + * \param self Self. + * \param inflictor entity that is causing the damage + * \param attacker entity that caused the inflictor to damage targ + * \param damage Amount of damage. + * \param meansOfDeath Means of death. + */ +void body_die( gentity_t* self, gentity_t* inflictor, gentity_t* attacker, int damage, int meansOfDeath ); + +/** + * Toss the weapon and powerups for the killed player. + * + * \param self the client. + * \param Caused by disconnect? + */ +void TossClientItems( gentity_t* self, qboolean dis_con ); + +/** + * Repairs repairable entities. + * + * \param ent The player. + * \param tr_ent Entity to repair. + * \param rate Rate to repair with. + * \author Ubergames - GSIO01 + * \date 09/05/2009 + */ +void G_Repair(gentity_t* ent, gentity_t* tr_ent, float rate); // damage flags #define DAMAGE_RADIUS 0x00000001 // damage was indirect @@ -929,164 +1452,399 @@ void G_Repair(gentity_t* ent, gentity_t* tr_ent, float rate); //RPG-X | GSIO01 // // g_missile.c // -void G_Missile_Run( gentity_t* ent ); -gentity_t* fire_blaster (gentity_t* self, vec3_t start, vec3_t aimdir); +/** + * Run a missile. + * + * \param ent the missile + */ +void G_Missile_Run( gentity_t* ent ); + +/** + * Fire alient plasma projectile. + * + * \param The shooter. + * \param start Start point. + * \param aimdir Direction. + */ gentity_t* fire_plasma (gentity_t* self, vec3_t start, vec3_t aimdir); + +/** + * Fire torpedo projectile. + * + * \param The shooter. + * \param start Start point. + * \param aimdir Direction. + */ gentity_t* fire_quantum (gentity_t* self, vec3_t start, vec3_t aimdir); + +/** + * Fire grenade. + * + * \param The shooter. + * \param start Start point. + * \param aimdir Direction. + */ gentity_t* fire_grenade (gentity_t* self, vec3_t start, vec3_t aimdir); + +/** + * Fire a rocket. + * + * \param The shooter. + * \param start Start point. + * \param dir Direction. + */ gentity_t* fire_rocket (gentity_t* self, vec3_t start, vec3_t dir); -gentity_t* fire_grapple (gentity_t* self, vec3_t start, vec3_t dir); + +/** + * Fire a compression rifle projectile. + * + * \param The shooter. + * \param start Start point. + * \param dir Direction. + */ gentity_t* fire_comprifle (gentity_t* self, vec3_t start, vec3_t dir); - - // // g_mover.c // +/** + * Run a mover. + * + * \param ent Mover to run. + */ void G_Mover_Run( gentity_t* ent ); + +/** + * Touch function for doors. + * + * \param ent The mover. + * \param other The touching entity. + * \param trace A trace. + */ void G_Mover_TouchDoorTrigger( gentity_t* ent, gentity_t* other, trace_t* trace ); + +/** + * Use function for binary movers. + * + * \param ent The mover. + * \param other Other entity. + * \param activator Activator. + */ void G_Mover_UseBinaryMover( gentity_t* ent, gentity_t* other, gentity_t* activator ); -// -// g_trigger.c -// -void trigger_teleporter_touch (gentity_t* self, gentity_t* other, trace_t* trace ); - - // // g_misc.c // +/** + * Teleport a player to an origin. + * + * \param player The player. + * \param origin Where to teleport. + * \param angles Angles of the player at destination. + * \param tyTpye Teleport type. + */ void TeleportPlayer( gentity_t* player, vec3_t origin, vec3_t angles, tpType_t tyType ); + +/** + * Transport a player to an origin. + * + * \param player The player. + * \param origin Destination. + * \param angles Angles at destination. + * \param speed Spit out speed at destination. + */ void TransportPlayer( gentity_t* player, vec3_t origin, vec3_t angles, int speed ); -//TiM - g_target.c +/** + * Start turbolist travel. + * + * \param ent The turbolift. + * \author Ubergames - TiM + */ void target_turbolift_start( gentity_t* ent ); // // g_weapon.c // -qboolean G_Weapon_LogAccuracyHit( gentity_t* target, gentity_t* attacker ); -void G_Weapon_CalcMuzzlePoint ( gentity_t* ent, vec3_t forward, vec3_t right, vec3_t up, vec3_t muzzlePoint, float projsize); -void G_Weapon_SnapVectorTowards( vec3_t v, vec3_t to ); +/** + * \brief Checks wether accuray for this hit should be logged. + * + * \param target the target entity + * \param attacker the attacker entity + */ +qboolean G_Weapon_LogAccuracyHit( gentity_t* target, gentity_t* attacker ); + +/** + * \brief Calculates the muzzle point. + * + * Calculates the muzzle point. + * + * \param ent the player + * \param fwd the forward vector + * \param rt the right vector + * \param vup the up vector + * \param muzzlePoint the muzzle point + * \param projsize projsize + */ +void G_Weapon_CalcMuzzlePoint ( gentity_t* ent, vec3_t forward, vec3_t right, vec3_t up, vec3_t muzzlePoint, float projsize); + +/** + * Round a vector to integers for more efficient network + * transmission, but make sure that it rounds towards a given point + * rather than blindly truncating. This prevents it from truncating + * into a wall. + * + * \param v vector to round + * \param to rounded vector + */ +void G_Weapon_SnapVectorTowards( vec3_t v, vec3_t to ); // // g_client.c // /** * Get number of clients in team. + * + * \param ignoreClientNum Client to ignore. + * \param team Team. + * \reutrn Number of clients in team. */ -team_t G_Client_TeamCount( int ignoreClientNum, int team ); +team_t G_Client_TeamCount( int ignoreClientNum, int team ); + /** * Pick a random team. + * + * \param ignoreClientNum Client to ignore. + * \return Random team. */ -team_t G_Client_PickTeam( int ignoreClientNum ); +team_t G_Client_PickTeam( int ignoreClientNum ); + /** * Set the clients view angle. + * + * \param ent Entity for which to set view angle. + * \param angle New view angle. */ -void G_Client_SetViewAngle( gentity_t* ent, vec3_t angle ); +void G_Client_SetViewAngle( gentity_t* ent, vec3_t angle ); + /** * Select a spawnpoint. + * + * \param avoidPoint Point to avoid. + * \param origin Origin. + * \param angles Angles. */ -gentity_t* G_Client_SelectSpawnPoint ( vec3_t avoidPoint, vec3_t origin, vec3_t angles ); +gentity_t* G_Client_SelectSpawnPoint ( vec3_t avoidPoint, vec3_t origin, vec3_t angles ); + /** * Respawn client. + * + * \param ent Client to respawn. */ -void G_Client_Respawn(gentity_t *ent); +void G_Client_Respawn(gentity_t *ent); + /** * Begin intermission. */ -void G_Client_BeginIntermission(void); +void G_Client_BeginIntermission(void); + /** * Init the body que. */ -void G_Client_InitBodyQue(void); +void G_Client_InitBodyQue(void); + /** * Spawn client. + * + * \param ent Client to spawn + * \param rpgx_spawn rpgx_spawn + * \param fromDeath Is this a spawn from death? */ -void G_Client_Spawn( gentity_t* ent, int rpgx_spawn, qboolean fromDeath ); +void G_Client_Spawn( gentity_t* ent, int rpgx_spawn, qboolean fromDeath ); + /** * Let the client die. + * + * \param self Client. + * \param inflictor Entity causing death. + * \param attacker Entity that made inflicotr cause death. + * \param damage ammount of demage + * \param mod means of death */ -void G_Client_Die (gentity_t* self, gentity_t* inflictor, gentity_t* attacker, int damage, int mod); +void G_Client_Die (gentity_t* self, gentity_t* inflictor, gentity_t* attacker, int damage, int mod); + /** * Add score for the client. + * + * \param ent The client. + * \param score Ammount of score to add. */ -void G_Client_AddScore( gentity_t* ent, int score ); +void G_Client_AddScore( gentity_t* ent, int score ); + /** * Calculate clients ranks. + * + * \param fromExit From exit? */ -void G_Client_CalculateRanks( qboolean fromExit ); +void G_Client_CalculateRanks( qboolean fromExit ); + /** * Determine whether spot would telefrag. + * + * \param spot Spot to check. + * \return Whether this spot would telefrag. */ -qboolean G_Client_SpotWouldTelefrag( gentity_t* spot ); +qboolean G_Client_SpotWouldTelefrag( gentity_t* spot ); + /** * Get weapons for a class. + * + * \param client The client. + * \param pclass Class to get weapons for. */ -void G_Client_WeaponsForClass( gclient_t* client, pclass_t pclass ); +void G_Client_WeaponsForClass( gclient_t* client, pclass_t pclass ); + /** * Get holdable items for a class. + * + * \param client The client. + * \param pclass Class for which to get holdables. */ -void G_Client_HoldablesForClass( gclient_t* client, pclass_t pclass ); +void G_Client_HoldablesForClass( gclient_t* client, pclass_t pclass ); + /** * Store the clients initial status. + * + * \param ent The client. */ -void G_Client_StoreClientInitialStatus( gentity_t* ent ); +void G_Client_StoreClientInitialStatus( gentity_t* ent ); + /** * Get location message for a client. + * + * \param ent The client. + * \param loc Location char. + * \param loclen Length of location char. + * \return Indicates success or fail. */ -qboolean G_Client_GetLocationMsg(gentity_t* ent, char* loc, int loclen); +qboolean G_Client_GetLocationMsg(gentity_t* ent, char* loc, int loclen); + /** * Check client statuses. */ -void G_Client_CheckClientStatus(void); +void G_Client_CheckClientStatus(void); + /** * Send client location information. + * + * \param ent The client. */ -void G_Client_LocationsMessage( gentity_t *ent ); +void G_Client_LocationsMessage( gentity_t *ent ); + /** * Client connect. + * + * \param clientNum Client num. + * \param firstTime Indicate whether this was the first connect. + * \param isBot Indicate if bot or player. */ char* G_Client_Connect( int clientNum, qboolean firstTime, qboolean isBot ); + /** * Clients user info changed. + * + * \param clientNum Client num. */ void G_Client_UserinfoChanged( int clientNum ); + /** * Disconnect client. + * + * \param clientNum Client num. */ void G_Client_Disconnect( int clientNum ); + /** * Initialize client. + * + * \param clientNum Client num. + * \param careAboutWarmup Indicate whether to care about warm up. + * \param isBot Bot or client? + * \param first First time? */ void G_Client_Begin( int clientNum, qboolean careAboutWarmup, qboolean isBot, qboolean first ); + /** * Client command. + * + * \param clientNum Client num. */ void G_Client_Command( int clientNum ); // // g_svcmds.c // -qboolean ConsoleCommand( void ); //void -void G_ProcessIPBans(void); -qboolean G_FilterPacket (char* from); -gclient_t* ClientForString( const char* s ); //RPG-X: RedTechie - Added so g_cmds could read the function -//TiM -void G_ProcessIDBans( void ); -qboolean CheckID( char* id ); +/** + * Check for server console command and run if it is. + * + * \return whether this was a server command. + */ +qboolean ConsoleCommand( void ); + +/** + * Process IP bans. + */ +void G_ProcessIPBans(void); + +/** + * Filter a packet. + */ +qboolean G_FilterPacket (char* from); + +/** + * Get a client for a string. + */ +gclient_t* ClientForString( const char* s ); //RPG-X: RedTechie - Added so g_cmds could read the function + +/** + * Process ID bans. + */ +void G_ProcessIDBans( void ); + +/** + * Check ID. + */ +qboolean CheckID( char* id ); // // g_weapon.c // +/** + * \brief Fire weapons. + * + * Handles weapon firing. + * + * \param ent the player + * \param alt_fire was this alt fire mode? + */ void FireWeapon( gentity_t* ent, qboolean alt_fire ); -void steam_think( gentity_t* ent ); // // p_hud.c // +/** + * When the intermission starts, this will be called for all players. + * If a new client connects, this will be called after the spawn function. + * + * \param client A client. + */ void MoveClientToIntermission (gentity_t* client); -void G_SetStats (gentity_t* ent); + +/** + * Send deathmatch scorebard message. + * + * \param client A client. + */ void DeathmatchScoreboardMessage (gentity_t* client); // @@ -1094,40 +1852,122 @@ void DeathmatchScoreboardMessage (gentity_t* client); // void SP_fx_spark( gentity_t* ent ); -// -// g_cmds.c -// -//static void G_SayTo( gentity_t *ent, gentity_t *other, int mode, int color, const char *name, const char *message ); - -// -// g_pweapon.c -// - - // // g_main.c // +/** + * Find the intermission point. This is also used for spectator spawns. + */ void FindIntermissionPoint( void ); + +/** + * Run think functions for entity. + */ void G_RunThink (gentity_t* ent); + +/** + * Send scorebard message to all clients. + */ void SendScoreboardMessageToAllClients( void ); + +/** + * Print function that prints to the server console. + */ void QDECL G_Printf( const char* fmt, ... ) __attribute__ ((format (printf, 1, 2))); + +/** + * Error function. Will result in any running map to be stoped and this way somewhat stops the server. + */ void QDECL G_Error( const char* fmt, ... ) __attribute__ ((format (printf, 1, 2))); + +/** + * Print a message in a specified clients console. + */ void QDECL G_PrintfClient( gentity_t* ent, const char* fmt, ...) __attribute__ ((format (printf, 2, 3))); + +/** + * Print a message in all clients consoles. + */ void QDECL G_PrintfClientAll(const char* fmt, ...) __attribute__ ((format (printf, 1, 2))); // // g_sql.c // -extern qboolean sql_ready; -qboolean G_Sql_Init(void); -void G_Sql_Shutdown(void); -qboolean G_Sql_UserDB_Add(const char* uName, const char* password); -qboolean G_Sql_UserDB_CheckRight(int uid, int right); -qboolean G_Sql_UserDB_AddRight(int uid, int right); -qboolean G_Sql_UserDB_RemoveRight(int uid, int right); -qboolean G_Sql_UserDB_Del(const char* uName); -qboolean G_Sql_UserDB_Login(const char* uName, const char* pwd, int clientnum); -int G_Sql_UserDB_GetUID(const char* uName); +extern qboolean sql_ready; /*s; playerState_t *ps = &ent->client->ps; @@ -2356,13 +2344,6 @@ void MoveClientToIntermission( gentity_t *ent ) { ent->r.contents = 0; } -/* -================== -FindIntermissionPoint - -This is also used for spectator spawns -================== -*/ void FindIntermissionPoint( void ) { gentity_t *ent, *target; vec3_t dir; diff --git a/code/game/g_missile.c b/code/game/g_missile.c index 2391653..72b3f0d 100644 --- a/code/game/g_missile.c +++ b/code/game/g_missile.c @@ -365,12 +365,6 @@ static void G_RunStuckMissile( gentity_t *ent ) G_RunThink( ent ); } -/* -================ -G_Missile_Run - -================ -*/ void G_Missile_Run( gentity_t *ent ) { vec3_t origin; trace_t tr; @@ -416,12 +410,6 @@ void G_Missile_Run( gentity_t *ent ) { //============================================================================= -/* -================= -fire_plasma - -================= -*/ gentity_t *fire_plasma (gentity_t *self, vec3_t start, vec3_t dir) { gentity_t *bolt; @@ -492,13 +480,6 @@ gentity_t *fire_comprifle(gentity_t *self, vec3_t start, vec3_t dir) { //============================================================================= - -/* -================= -fire_quantum - -================= -*/ gentity_t *fire_quantum (gentity_t *self, vec3_t start, vec3_t dir) { gentity_t *bolt; @@ -536,11 +517,6 @@ gentity_t *fire_quantum (gentity_t *self, vec3_t start, vec3_t dir) { //============================================================================= -/* -================= -fire_grenade -================= -*/ gentity_t *fire_grenade (gentity_t *self, vec3_t start, vec3_t dir) { gentity_t *bolt; @@ -580,12 +556,6 @@ gentity_t *fire_grenade (gentity_t *self, vec3_t start, vec3_t dir) { //============================================================================= - -/* -================= -fire_rocket -================= -*/ gentity_t *fire_rocket (gentity_t *self, vec3_t start, vec3_t dir) { gentity_t *bolt; diff --git a/code/game/g_mover.c b/code/game/g_mover.c index 5692fe3..aa1d056 100644 --- a/code/game/g_mover.c +++ b/code/game/g_mover.c @@ -358,12 +358,6 @@ static void G_MoverTeam( gentity_t *ent ) { } } -/* -================ -G_Mover_Run - -================ -*/ void G_Mover_Run( gentity_t *ent ) { // if not a team captain, don't do anything, because // the captain will handle everything @@ -775,12 +769,6 @@ void Reached_BinaryMover( gentity_t *ent ) { } } - -/* -================ -G_Mover_UseBinaryMover -================ -*/ void G_Mover_UseBinaryMover( gentity_t *ent, gentity_t *other, gentity_t *activator ) { int total; int partial; @@ -1218,11 +1206,6 @@ static void Touch_DoorTriggerSpectator( gentity_t *ent, gentity_t *other, trace_ void DoorTriggerReactivate(gentity_t *ent); -/* -================ -G_Mover_TouchDoorTrigger -================ -*/ void G_Mover_TouchDoorTrigger( gentity_t *ent, gentity_t *other, trace_t *trace ) { #if 0 vec3_t vec, doorcenter, movedir; diff --git a/code/game/g_sql.c b/code/game/g_sql.c index d30ff50..b79aee1 100644 --- a/code/game/g_sql.c +++ b/code/game/g_sql.c @@ -13,11 +13,6 @@ sqlite3 *user_db; qboolean sql_ready = qfalse; -/* -=============== -G_Sql_Check_StepReturn -=============== -*/ static qboolean G_Sql_Check_StepReturn(int r) { switch(r) { case SQLITE_ROW: @@ -30,11 +25,6 @@ static qboolean G_Sql_Check_StepReturn(int r) { return qtrue; } -/* -=============== -G_Sql_Check_PrepareReturn -=============== -*/ static qboolean G_Sql_Check_PrepareReturn(int r) { switch(r) { case SQLITE_OK: @@ -46,11 +36,6 @@ static qboolean G_Sql_Check_PrepareReturn(int r) { return qtrue; } -/* -=============== -G_Sql_Check_BindReturn -=============== -*/ static qboolean G_Sql_Check_BindReturn(int r) { switch(r) { case SQLITE_OK: @@ -62,11 +47,6 @@ static qboolean G_Sql_Check_BindReturn(int r) { return qtrue; } -/* -=============== -G_Sql_Md5 -=============== -*/ static char *G_Sql_Md5(const char *s) { char *res; unsigned char sig[16]; @@ -89,11 +69,6 @@ static char *G_Sql_Md5(const char *s) { return res; } -/* -=============== -G_SqlInit -=============== -*/ qboolean G_Sql_Init(void) { int res; sqlite3_stmt *stmt; @@ -152,11 +127,6 @@ qboolean G_Sql_Init(void) { return qtrue; } -/* -=============== -G_Sql_Shutdown -=============== -*/ void G_Sql_Shutdown(void) { if(!sql_use.integer) return; @@ -166,11 +136,6 @@ void G_Sql_Shutdown(void) { sqlite3_close(user_db); } -/* -=============== -G_Sql_UserDB_Del -=============== -*/ qboolean G_Sql_UserDB_Del(const char *uName) { sqlite3_stmt *stmt; int res, id = -1; @@ -241,11 +206,6 @@ qboolean G_Sql_UserDB_Del(const char *uName) { return qtrue; } -/* -=============== -G_Sql_UserAdd -=============== -*/ qboolean G_Sql_UserDB_Add(const char *uName, const char *password) { sqlite3_stmt *stmt; int res, id; @@ -334,11 +294,6 @@ qboolean G_Sql_UserDB_Add(const char *uName, const char *password) { return qtrue; } -/* -=============== -G_Sql_UserDB_login -=============== -*/ qboolean G_Sql_UserDB_Login(const char *uName, const char *pwd, int clientnum) { sqlite3_stmt *stmt; int res, id; @@ -406,11 +361,6 @@ qboolean G_Sql_UserDB_Login(const char *uName, const char *pwd, int clientnum) { return qtrue; } -/* -=============== -G_Sql_UserDB_CheckRight -=============== -*/ qboolean G_Sql_UserDB_CheckRight(int uid, int right) { sqlite3_stmt *stmt; int res; @@ -454,11 +404,6 @@ qboolean G_Sql_UserDB_CheckRight(int uid, int right) { return qfalse; } -/* -=============== -G_Sql_UserDB_AddRight -=============== -*/ qboolean G_Sql_UserDB_AddRight(int uid, int right) { sqlite3_stmt *stmt; int res; @@ -512,11 +457,6 @@ qboolean G_Sql_UserDB_AddRight(int uid, int right) { return qtrue; } -/* -=============== -G_Sql_UserDB_RemoveRight -=============== -*/ qboolean G_Sql_UserDB_RemoveRight(int uid, int right) { sqlite3_stmt *stmt; int res; @@ -570,11 +510,6 @@ qboolean G_Sql_UserDB_RemoveRight(int uid, int right) { return qtrue; } -/* -=============== -G_Sql_UserDB_GetUID -=============== -*/ int G_Sql_UserDB_GetUID(const char *uName) { sqlite3_stmt *stmt; int res; diff --git a/code/game/g_svcmds.c b/code/game/g_svcmds.c index b685b85..74e813f 100644 --- a/code/game/g_svcmds.c +++ b/code/game/g_svcmds.c @@ -128,11 +128,6 @@ static void UpdateIPBans (void) trap_Cvar_Set( "g_banIPs", iplist ); } -/* -================= -G_FilterPacket -================= -*/ qboolean G_FilterPacket (char *from) { int i; @@ -790,12 +785,6 @@ static void Svcmd_LuaRestart_f(void) } #endif -/* -================= -ConsoleCommand - -================= -*/ qboolean ConsoleCommand( void ) { //void char cmd[MAX_TOKEN_CHARS]; diff --git a/code/game/g_trigger.c b/code/game/g_trigger.c index 6574564..ee6ff03 100644 --- a/code/game/g_trigger.c +++ b/code/game/g_trigger.c @@ -431,13 +431,6 @@ trigger_teleport #define MAX_TRANSPORTER_POINTS 16 -/** - * \brief Select a random spawn point. - * - * Select a random spawn point. - * - * @return a random spawn point - */ gentity_t *SelectRandomSpawnPoint( void ) { gentity_t *spot = NULL; diff --git a/code/game/g_utils.c b/code/game/g_utils.c index b3740ff..11f9d65 100644 --- a/code/game/g_utils.c +++ b/code/game/g_utils.c @@ -31,15 +31,6 @@ static int remapCount = 0; /** List of shader remaps */ static shaderRemap_t remappedShaders[MAX_SHADER_REMAPS]; -/** - * \brief Add a new shader remap. - * - * Remaps oldShader with newShader. - * - * @param oldShader shader to be remapped - * @param newShader replacement shader - * @param timeOffset time offset - */ void AddRemap(const char *oldShader, const char *newShader, float timeOffset) { int i; @@ -131,56 +122,20 @@ int G_FindConfigstringIndex( char *name, int start, int max, qboolean create ) { return i; } -/** - * \brief Get the model index for a model. - * - * Get the model index for a model. - * - * @param name the model name - * - * @return the models index - */ int G_ModelIndex( char *name ) { return G_FindConfigstringIndex (name, CS_MODELS, MAX_MODELS, qtrue); } -/** - * \brief Get the sound index for a sound. - * - * Get the sound index for a sound. - * - * @param name the sound name - * - * @return the sounds index - */ int G_SoundIndex( char *name ) { return G_FindConfigstringIndex (name, CS_SOUNDS, MAX_SOUNDS, qtrue); } -/** - * \brief Get the tric string index. - * - * Get the tric string index. - * - * @param name the tric string name - * - * @return the tric strings index - */ int G_TricStringIndex( char *name ) { return G_FindConfigstringIndex (name, CS_TRIC_STRINGS, MAX_TRIC_STRINGS, qtrue); } //===================================================================== - -/** - * \brief Issue a team command. - * - * Issue a team command. - * - * @param team the team - * @param cmd the command - */ void G_TeamCommand( team_t team, char *cmd ) { int i; @@ -193,22 +148,6 @@ void G_TeamCommand( team_t team, char *cmd ) { } } - -/** - * - * \brief Finds an entity. - * - * Searches all active entities for the next one that holds - * the matching string at fieldofs (use the FOFS() macro) in the structure. - * Searches beginning at the entity after from, or the beginning if NULL - * NULL will be returned if the end of the list is reached. - * - * @param from search from this entity on - * @param fieldofs in which field to look - * @param match string to match - * - * @return an matching entity or NULL - */ gentity_t *G_Find (gentity_t *from, int fieldofs, const char *match) { char *s; @@ -236,15 +175,6 @@ gentity_t *G_Find (gentity_t *from, int fieldofs, const char *match) /** Maximum number of possible choices for G_PickTarget. */ #define MAXCHOICES 32 -/** - * \brief Pick a target. - * - * Selects a random entity from among the targets. - * - * @param targetname the targets targetname - * - * @return an entity or NULL - */ gentity_t *G_PickTarget (char *targetname) { gentity_t *ent = NULL; @@ -325,18 +255,6 @@ gentity_t *G_PickTarget (char *targetname) return choice[rand() % num_choices]; } -/** - * \brief Use all targets of the given entity. - * - * Goes through all entities and calls ther use function if their - * targetname, swapname, truename, falsename, bluename are matching - * the target. activator should be set the the inflictor of this function - * call. - * - * @param ent the entity - * @param activator the activator - * @param target target to match - */ void G_UseTargets2( gentity_t *ent, gentity_t *activator, char *target ) { gentity_t *t; @@ -507,14 +425,6 @@ void G_UseTargets2( gentity_t *ent, gentity_t *activator, char *target ) { } } -/** - * \brief Use all of the given entity's targets. - * - * Use all of the given entity's targets. - * - * @param ent the entity - * @param activator the initiator of the function call - */ void G_UseTargets( gentity_t *ent, gentity_t *activator ) { if ( !ent ) { return; @@ -522,19 +432,6 @@ void G_UseTargets( gentity_t *ent, gentity_t *activator ) { G_UseTargets2( ent, activator, ent->target ); } - -/** - * \brief Create a temporary vector. - * - * This is just a convenience function - * for making temporary vectors for function calls - * - * @param x x-value - * @param y y-value - * @param z z-value - * - * @return temporary vector - */ float *tv( float x, float y, float z ) { static int index; static vec3_t vecs[8]; @@ -554,18 +451,7 @@ float *tv( float x, float y, float z ) { return v; } - -/** - * \brief Converts a vector to a string to be printed. - * - * This is just a convenience function - * for printing vectors - * - * @param v the vector - * - * @return string representation of the vector - */ -char *vtos( const vec3_t v ) { +char *vtos( const vec3_t v ) { static int index; static char str[8][32]; char *s; @@ -579,19 +465,6 @@ char *vtos( const vec3_t v ) { return s; } - - -/** - * \brief Converts angles to move directions. - * - * The editor only specifies a single value for angles (yaw), - * but we have special constants to generate an up or down direction. - * Angles will be cleared, because it is being used to represent a direction - * instead of an orientation. - * - * @param angles the angles - * @param movedir the movedir - */ void G_SetMovedir( vec3_t angles, vec3_t movedir ) { static vec3_t VEC_UP = {0, -1, 0}; static vec3_t MOVEDIR_UP = {0, 0, 1}; @@ -608,15 +481,6 @@ void G_SetMovedir( vec3_t angles, vec3_t movedir ) { VectorClear( angles ); } -/** - * \brief Get the yaw from a vector. - * - * Get the yaw from a vector. - * - * @param vec the vector - * - * @return the yaw - */ float vectoyaw( const vec3_t vec ) { float yaw; @@ -638,13 +502,6 @@ float vectoyaw( const vec3_t vec ) { return yaw; } -/** - * \brief Init the entity. - * - * Inits a given game entity. - * - * @param e the entity - */ void G_InitGentity( gentity_t *e ) { e->inuse = qtrue; e->classname = "noclass"; @@ -652,19 +509,6 @@ void G_InitGentity( gentity_t *e ) { e->r.ownerNum = ENTITYNUM_NONE; } -/** - * \brief Spawns a new entity. - * - * Either finds a free entity, or allocates a new one. - * The slots from 0 to MAX_CLIENTS-1 are always reserved for clients, - * and will never be used by anything else. - * Try to avoid reusing an entity that was recently freed, because it - * can cause the client to think the entity morphed into something else - * instead of being removed and recreated, which can cause interpolated - * angles and bad trails. - * - * @return a new entity or NULL - */ gentity_t *G_Spawn( void ) { int i, force; gentity_t *e; @@ -745,14 +589,6 @@ gentity_t *G_Spawn( void ) { return e; } - -/** - * \brief Free an entity. - * - * Marks the entity as free. - * - * @param ed entity to free - */ void G_FreeEntity( gentity_t *ed ) { trap_UnlinkEntity (ed); /* unlink from world */ @@ -774,18 +610,6 @@ void G_FreeEntity( gentity_t *ed ) { ed->inuse = qfalse; } -/** - * \brief Spawn an temporary entity. - * - * Spawns an event entity that will be auto-removed - * The origin will be snapped to save net bandwidth, so care - * must be taken if the origin is right on a surface (snap towards start vector first) - * - * @param origin the origin - * @param event the event to use for this entity - * - * @return the temporary entity - */ gentity_t *G_TempEntity( vec3_t origin, int event ) { gentity_t *e; vec3_t snapped; @@ -817,14 +641,6 @@ Kill box ============================================================================== */ -/** - * \brief Kill all that would be inside a new one. - * - * Kills all entities that would touch the proposed new positioning - * of ent. Ent should be unlinked before calling this! - * - * @param ent the entity - */ void G_KillBox (gentity_t *ent) { int i, num; int touch[MAX_GENTITIES]; @@ -848,17 +664,6 @@ void G_KillBox (gentity_t *ent) { } -/** - * \author J2J - * \brief Push all entities away that are inside a new entity. - * - * Basically does teh same as G_KillBox except it will - * push players and other entities away instead of killing them. - * - * @param ent the entity - * - * @return was an ent moved? - */ qboolean G_MoveBox (gentity_t *ent ) { int i, num; @@ -895,17 +700,6 @@ qboolean G_MoveBox (gentity_t *ent ) //============================================================================== -/** - * \brief Adds a new Predictable event. - * - * Use for non-pmove events that would also be predicted on the - * client side: jumppads and item pickups - * Adds an event+parm and twiddles the event counter - * - * @param ent the entity - * @param event the event - * @param eventParm any parameters for the event - */ void G_AddPredictableEvent( gentity_t *ent, int event, int eventParm ) { if ( !ent->client ) { return; @@ -913,16 +707,6 @@ void G_AddPredictableEvent( gentity_t *ent, int event, int eventParm ) { BG_AddPredictableEventToPlayerstate( event, eventParm, &ent->client->ps ); } - -/** - * \brief Add a new event. - * - * Adds an event+parm and twiddles the event counter - * - * @param ent the entity - * @param event the event - * @param eventParm parameter for the event - */ void G_AddEvent( gentity_t *ent, int event, int eventParm ) { int bits; playerState_t *ps = &ent->client->ps; @@ -948,15 +732,6 @@ void G_AddEvent( gentity_t *ent, int event, int eventParm ) { ent->eventTime = level.time; } - -/** - * \brief Makes an entity to play a non looping sound. - * - * Makes an entity to play a non looping sound. - * - * @param ent the entity - * @param soundIndex the sounds index - */ void G_Sound( gentity_t *ent, int soundIndex ) { gentity_t *te; @@ -967,15 +742,6 @@ void G_Sound( gentity_t *ent, int soundIndex ) { //============================================================================== - -/** - * \brief Set the Origin of an entity. - * - * Sets the pos trajectory for a fixed position - * - * @param ent the entity - * @param origin the new origin - */ void G_SetOrigin( gentity_t *ent, vec3_t origin ) { // lets try this to fix setting origins for brush ents without origin brush VectorCopy(origin, ent->pos1); // needs testing @@ -990,14 +756,6 @@ void G_SetOrigin( gentity_t *ent, vec3_t origin ) { VectorCopy( origin, ent->s.origin); /* RPG-X | GSIO01 | 24.08.2009 */ } -/** - * \brief Set the angles of an entity. - * - * Sets the pos trajectory for a fixed angular position - * - * @param ent the entity - * @param angles the new angles - */ void G_SetAngles(gentity_t *ent, vec3_t angles) { VectorCopy(angles, ent->s.apos.trBase); ent->s.apos.trType = TR_STATIONARY; @@ -1339,17 +1097,6 @@ gentity_t *G_GetNearestPlayer(vec3_t origin, float radius, list_p ignore ) { return nearest; } -/** - * \author GSIO01 - * \brief Get all entities with the specified targetname. - * - * Get all entities with the specified targetname. - * - * @param targetname the targetname - * @param entities the result - * - * @return number of entities found - */ int G_GetEntityByTargetname(const char *targetname, list_p entities) { int i; gentity_t *t; @@ -1369,17 +1116,6 @@ int G_GetEntityByTargetname(const char *targetname, list_p entities) { return entities->length; } -/** - * \author GSIO01 - * \brief Get all entities with specified target. - * - * Get all entities matching the specifie target. - * - * @param target target the entities should have - * @param entities the result - * - * @return number of matches found - */ int G_GetEntityByTarget(const char *target, list_p entities) { int i; gentity_t *t; @@ -1399,18 +1135,6 @@ int G_GetEntityByTarget(const char *target, list_p entities) { return entities->length; } -/** - * \author GSIO01 - * \brief Get all entities with specified brush model - * - * Get all entities matching the specified brush model. - * Normally this only shoud be one entity. - * - * @param bmodel brush model to match - * @param entities the result - * - * @return number of matches found - */ int G_GetEntityByBmodel(char *bmodel, list_p entities) { int i; gentity_t *t; diff --git a/code/game/g_weapon.c b/code/game/g_weapon.c index e836fe4..cd221f6 100644 --- a/code/game/g_weapon.c +++ b/code/game/g_weapon.c @@ -61,15 +61,6 @@ extern vmCvar_t rpg_photonAltDamage; #define QUANTUM_ALT_SPLASH_DAM rpg_photonAltDamage.integer #define QUANTUM_ALT_SPLASH_RAD 80 -/** -Round a vector to integers for more efficient network -transmission, but make sure that it rounds towards a given point -rather than blindly truncating. This prevents it from truncating -into a wall. - -@param v vector to round -@param to rounded vector -*/ void G_Weapon_SnapVectorTowards( vec3_t v, vec3_t to ) { int i; @@ -1328,13 +1319,6 @@ static void WP_FireQuantumBurst( gentity_t *ent, qboolean alt_fire ) G_LogWeaponFire(ent->s.number, WP_9); } - -/** - * \brief Checks wether accuray for this hit should be logged. - * - * @param target the target entity - * @param attacker the attacker entity - */ qboolean G_Weapon_LogAccuracyHit( gentity_t *target, gentity_t *attacker ) { if( !target->takedamage ) { return qfalse; @@ -1496,20 +1480,6 @@ static float WP_ShotAltSize[WP_NUM_WEAPONS] = /* 0,*/ /* WP_7 */ }; - - -/** - * \brief Calculates the muzzle point. - * - * Calculates the muzzle point. - * - * @param ent the player - * @param fwd the forward vector - * @param rt the right vector - * @param vup the up vector - * @param muzzlePoint the muzzle point - * @param projsize projsize - */ void G_Weapon_CalcMuzzlePoint ( gentity_t *ent, vec3_t fwd, vec3_t rt, vec3_t vup, vec3_t muzzlePoint, float projsize) { int weapontype; @@ -1734,14 +1704,6 @@ FireWeapon #define ACCURACY_TRACKING_DELAY 100 /* in ms */ #define NUM_FAST_WEAPONS 3 -/** - * \brief Fire weapons. - * - * Handles weapon firing. - * - * @param ent the player - * @param alt_fire was this alt fire mode? - */ void FireWeapon( gentity_t *ent, qboolean alt_fire ) { float projsize;