mirror of
https://github.com/UberGames/rpgxEF.git
synced 2024-11-13 00:24:06 +00:00
Moved some functions from g_local.h into new headers
This commit is contained in:
parent
14f7daa522
commit
a6c7f7582e
14 changed files with 184 additions and 190 deletions
|
@ -4,6 +4,8 @@
|
|||
#include "g_local.h"
|
||||
#include "g_client.h"
|
||||
#include "g_spawn.h"
|
||||
#include "g_cmds.h"
|
||||
#include "g_items.h"
|
||||
|
||||
extern void SP_misc_ammo_station( gentity_t *ent );
|
||||
extern void ammo_station_finish_spawning ( gentity_t *self );
|
||||
|
|
|
@ -1048,6 +1048,7 @@ Cmd_Ready_f
|
|||
* (see ClientIntermissionThink())
|
||||
*
|
||||
* when all clients have signaled ready, the game continues to the next match.
|
||||
* \param ent A player.
|
||||
*/
|
||||
void Cmd_Ready_f (gentity_t *ent)
|
||||
{
|
||||
|
|
|
@ -8,4 +8,46 @@ void DragCheck( void );
|
|||
pclass_t ValueNameForClass ( char* s );
|
||||
void BroadcastClassChange( gclient_t *client, pclass_t oldPClass );
|
||||
|
||||
/**
|
||||
* Concatenate all arguments for this string.
|
||||
*
|
||||
* \param start start from the given argument
|
||||
* \return String containing concatenated command arguments.
|
||||
*/
|
||||
char* ConcatArgs( int start );
|
||||
|
||||
/**
|
||||
* 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 );
|
||||
|
||||
|
||||
#endif
|
|
@ -7,6 +7,7 @@
|
|||
#include "g_main.h"
|
||||
#include "g_cmds.h"
|
||||
#include "g_client.h"
|
||||
#include "g_items.h"
|
||||
|
||||
/*
|
||||
============
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
// Copyright (C) 1999-2000 Id Software, Inc.
|
||||
//
|
||||
|
||||
#include "g_items.h"
|
||||
#include "g_local.h"
|
||||
#include "g_client.h"
|
||||
#include "g_spawn.h"
|
||||
|
@ -113,7 +115,16 @@ int Min_Weapon(int num)
|
|||
}
|
||||
}
|
||||
|
||||
void Padd_Add( gentity_t *key, gentity_t *who, char *txt )
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
static void Padd_Add( gentity_t *key, gentity_t *who, char *txt )
|
||||
{
|
||||
int i = 0;
|
||||
char *txtp;
|
||||
|
@ -153,7 +164,16 @@ void Padd_Add( gentity_t *key, gentity_t *who, char *txt )
|
|||
++paddDataNum;
|
||||
}
|
||||
|
||||
char *Padd_Get( gentity_t *key, gentity_t *who )
|
||||
/**
|
||||
* Pickup padd.
|
||||
*
|
||||
* \param key entity
|
||||
* \param who Who picked up the padd.
|
||||
* \return Text of the padd.
|
||||
* \author Ubergames - Marcin
|
||||
* \date 06/12/2008
|
||||
*/
|
||||
static char *Padd_Get( gentity_t *key, gentity_t *who )
|
||||
{
|
||||
int i, j;
|
||||
for ( i = 0; i < PADD_DATA_MAX; ++i ) {
|
||||
|
@ -177,7 +197,14 @@ char *Padd_Get( gentity_t *key, gentity_t *who )
|
|||
return 0;
|
||||
}
|
||||
|
||||
void Padd_Remove( gentity_t *key )
|
||||
/**
|
||||
* Remove a padd.
|
||||
*
|
||||
* \param key entity
|
||||
* \author Ubergames - Marcin
|
||||
* \date 06/12/2008
|
||||
*/
|
||||
static void Padd_Remove( gentity_t *key )
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
|
@ -330,6 +357,13 @@ int Pickup_Holdable( gentity_t *ent, gentity_t *other )
|
|||
|
||||
//======================================================================
|
||||
|
||||
/**
|
||||
* 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)
|
||||
{
|
||||
playerState_t *ps = &ent->client->ps;
|
||||
|
@ -435,7 +469,12 @@ int Pickup_Armor( gentity_t *ent, gentity_t *other ) {
|
|||
|
||||
//======================================================================
|
||||
|
||||
void RespawnItem( gentity_t *ent ) {
|
||||
/**
|
||||
* Repsawn an item.
|
||||
*
|
||||
* \param ent The item.
|
||||
*/
|
||||
static void RespawnItem( gentity_t *ent ) {
|
||||
if(!ent) return;
|
||||
|
||||
// randomly select from teamed entities
|
||||
|
@ -481,7 +520,14 @@ void RespawnItem( gentity_t *ent ) {
|
|||
}
|
||||
|
||||
|
||||
void Touch_Item (gentity_t *ent, gentity_t *other, trace_t *trace) {
|
||||
/**
|
||||
* Touch function for items.
|
||||
*
|
||||
* \param ent The entity for the item.
|
||||
* \param other The touching entity.
|
||||
* \param trace A trace.
|
||||
*/
|
||||
static void Touch_Item (gentity_t *ent, gentity_t *other, trace_t *trace) {
|
||||
int respawn;
|
||||
|
||||
if (!other->client)
|
||||
|
@ -738,7 +784,13 @@ void Use_Item( gentity_t *ent, gentity_t *other, gentity_t *activator ) {
|
|||
|
||||
//======================================================================
|
||||
|
||||
void FinishSpawningItem( gentity_t *ent ) {
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
static void FinishSpawningItem( gentity_t *ent ) {
|
||||
trace_t tr;
|
||||
vec3_t dest;
|
||||
|
||||
|
|
70
code/game/g_items.h
Normal file
70
code/game/g_items.h
Normal file
|
@ -0,0 +1,70 @@
|
|||
#ifndef _G_ITEMS_H
|
||||
#define _G_ITEMS_H
|
||||
|
||||
#include "g_local.h"
|
||||
|
||||
/**
|
||||
* Data structures + functions for the PADD messaging system.
|
||||
*
|
||||
* \author Ubergames - Marcin
|
||||
* \date 06/12/2008
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
gentity_t* key; //!< PADD item entity pointer
|
||||
char owner[64];
|
||||
char value[256];
|
||||
} paddData_t;
|
||||
|
||||
#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;
|
||||
|
||||
/**
|
||||
* Run an item.
|
||||
*
|
||||
* \param ent The item.
|
||||
*/
|
||||
void G_RunItem( gentity_t* ent );
|
||||
|
||||
/**
|
||||
* 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);
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
/*@shared@*/ /*@null@*/ gentity_t* Drop_Item( gentity_t* ent, gitem_t* item, float angle );
|
||||
|
||||
/**
|
||||
* 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 );
|
||||
|
||||
#endif /* _G_ITEMS_H */
|
|
@ -750,189 +750,6 @@ typedef struct {
|
|||
*/
|
||||
/*@shared@*/ /*@null@*/ char* G_NewString( /*@null@*/ const char* string );
|
||||
|
||||
//
|
||||
// g_cmds.c
|
||||
//
|
||||
/**
|
||||
* Concatenate all arguments for this string.
|
||||
*
|
||||
* \param start start from the given argument
|
||||
* \return String containing concatenated command arguments.
|
||||
*/
|
||||
char* ConcatArgs( int start );
|
||||
|
||||
/**
|
||||
* 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
|
||||
//
|
||||
|
||||
/**
|
||||
* Data structures + functions for the PADD messaging system.
|
||||
*
|
||||
* \author Ubergames - Marcin
|
||||
* \date 06/12/2008
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
gentity_t* key; //!< PADD item entity pointer
|
||||
char owner[64];
|
||||
char value[256];
|
||||
} paddData_t;
|
||||
|
||||
#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;
|
||||
|
||||
/**
|
||||
* 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);
|
||||
|
||||
/**
|
||||
* 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 );
|
||||
|
||||
/**
|
||||
* Remove a padd.
|
||||
*
|
||||
* \param key entity
|
||||
* \author Ubergames - Marcin
|
||||
* \date 06/12/2008
|
||||
*/
|
||||
void Padd_Remove( gentity_t* key );
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
/*@shared@*/ /*@null@*/ 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
|
||||
//
|
||||
|
|
|
@ -6,8 +6,9 @@
|
|||
#include "g_groups.h"
|
||||
#include "g_client.h"
|
||||
#include "g_spawn.h"
|
||||
#include "bg_lex.h"
|
||||
#include "g_cmds.h"
|
||||
#include "g_items.h"
|
||||
#include "bg_lex.h"
|
||||
#include "bg_misc.h"
|
||||
|
||||
extern void BG_LoadItemNames(void);
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include "g_local.h"
|
||||
#include "g_client.h"
|
||||
#include "g_spawn.h"
|
||||
#include "g_items.h"
|
||||
|
||||
|
||||
/*QUAKED func_group (0 0 0) ?
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
#include "g_local.h"
|
||||
#include "g_spawn.h"
|
||||
#include "g_items.h"
|
||||
|
||||
field_t fields[] = {
|
||||
{"classname", FOFS(classname), F_LSTRING},
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
// this file holds commands that can be executed by the server console, but not remote clients
|
||||
|
||||
#include "g_local.h"
|
||||
#include "g_cmds.h"
|
||||
|
||||
/*
|
||||
==============================================================================
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#include "g_local.h"
|
||||
#include "g_spawn.h"
|
||||
#include "g_items.h"
|
||||
|
||||
#define ARM_ANGLE_RANGE 60
|
||||
#define HEAD_ANGLE_RANGE 90
|
||||
|
|
|
@ -503,6 +503,7 @@
|
|||
<ClInclude Include="g_client.h" />
|
||||
<ClInclude Include="g_cmds.h" />
|
||||
<ClInclude Include="g_groups.h" />
|
||||
<ClInclude Include="g_items.h" />
|
||||
<ClInclude Include="g_local.h" />
|
||||
<ClInclude Include="g_lua.h" />
|
||||
<ClInclude Include="g_main.h" />
|
||||
|
|
|
@ -485,6 +485,9 @@
|
|||
<ClInclude Include="g_client.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="g_items.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="game.def">
|
||||
|
|
Loading…
Reference in a new issue