mirror of
https://github.com/UberGames/RPG-X2-rpgxEF.git
synced 2025-02-12 15:15:42 +00:00
Made function static in g_breakable.c where possible
This commit is contained in:
parent
5c1777541d
commit
3dceb25e0b
2 changed files with 8 additions and 86 deletions
|
@ -7,7 +7,7 @@
|
||||||
* Removes entity entirely blow chunks.
|
* Removes entity entirely blow chunks.
|
||||||
* If it is repairable it's not removed but made invisible.
|
* If it is repairable it's not removed but made invisible.
|
||||||
*/
|
*/
|
||||||
void breakable_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int damage, int meansOfDeath )
|
static void breakable_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int damage, int meansOfDeath )
|
||||||
{
|
{
|
||||||
vec3_t size, org, dir;
|
vec3_t size, org, dir;
|
||||||
gentity_t *te = NULL;
|
gentity_t *te = NULL;
|
||||||
|
@ -187,74 +187,6 @@ void InitBBrush ( gentity_t *ent )
|
||||||
//VectorCopy( ent->pos1, eState->pos.trBase );
|
//VectorCopy( ent->pos1, eState->pos.trBase );
|
||||||
}
|
}
|
||||||
|
|
||||||
//RPG-X | GSIO01 | 09/05/2009 SOE
|
|
||||||
/**
|
|
||||||
* Gets called if someone is inside a breakables trigger.
|
|
||||||
* Breables only have trigges if they are repairable
|
|
||||||
* This function sets the touched gentity_t pointer to the tirgger
|
|
||||||
* so it is possible to check if the player is inside the trigger
|
|
||||||
* and there fore can repair the breakable.
|
|
||||||
*
|
|
||||||
* \author Ubergames - GSIO01
|
|
||||||
* \date 09/05/2009
|
|
||||||
*/
|
|
||||||
void Touch_breakable_trigger(gentity_t *ent, gentity_t *other, trace_t *trace) {
|
|
||||||
other->touched = ent;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Spawns a trigger for a breakable.
|
|
||||||
* Only gets called if the breakable is repairable.
|
|
||||||
*/
|
|
||||||
void breakable_spawn_trigger(gentity_t *ent) {
|
|
||||||
vec3_t maxs, mins;
|
|
||||||
gentity_t *other;
|
|
||||||
int best, i;
|
|
||||||
entityShared_t *eShared;
|
|
||||||
|
|
||||||
VectorCopy(ent->r.absmin, mins);
|
|
||||||
VectorCopy(ent->r.absmax, maxs);
|
|
||||||
|
|
||||||
for(other = ent->teamchain; other; other=other->teamchain) {
|
|
||||||
eShared = &other->r;
|
|
||||||
AddPointToBounds(eShared->absmin, mins, maxs);
|
|
||||||
AddPointToBounds(eShared->absmax, mins, maxs);
|
|
||||||
}
|
|
||||||
|
|
||||||
best = 0;
|
|
||||||
|
|
||||||
for(i = 1; i < 3; i++) {
|
|
||||||
if(maxs[i] - mins[i] < maxs[best] - mins[best])
|
|
||||||
best = i;
|
|
||||||
}
|
|
||||||
|
|
||||||
maxs[best] += 48;
|
|
||||||
mins[best] -= 48;
|
|
||||||
|
|
||||||
other = G_Spawn();
|
|
||||||
|
|
||||||
if(!other) {
|
|
||||||
DEVELOPER(G_Printf(S_COLOR_YELLOW "[Entity-Error] Unable to spawn trigger for func_breakable at %s!\n", vtos(ent->s.origin)););
|
|
||||||
G_FreeEntity(ent);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
eShared = &other->r;
|
|
||||||
|
|
||||||
VectorCopy(maxs, eShared->maxs);
|
|
||||||
VectorCopy(mins, eShared->mins);
|
|
||||||
|
|
||||||
eShared->contents = CONTENTS_TRIGGER;
|
|
||||||
other->touch = Touch_breakable_trigger;
|
|
||||||
other->count = best;
|
|
||||||
other->touched = ent;
|
|
||||||
other->target = ent->target;
|
|
||||||
ent->touched = other;
|
|
||||||
|
|
||||||
trap_LinkEntity(other);
|
|
||||||
}
|
|
||||||
|
|
||||||
//RPG-X | GSIO01 | 09/05/2009 EOE
|
|
||||||
|
|
||||||
/*QUAKED func_breakable (0 .8 .5) ? x x x x INVINCIBLE x x x REPAIRABLE
|
/*QUAKED func_breakable (0 .8 .5) ? x x x x INVINCIBLE x x x REPAIRABLE
|
||||||
INVINCIBLE - can only be broken by being used
|
INVINCIBLE - can only be broken by being used
|
||||||
|
@ -437,7 +369,7 @@ void SP_misc_model_breakable( gentity_t *ent )
|
||||||
void ammo_use( gentity_t *self, gentity_t *other, gentity_t *activator);
|
void ammo_use( gentity_t *self, gentity_t *other, gentity_t *activator);
|
||||||
|
|
||||||
//!give a player ammo for a weapon
|
//!give a player ammo for a weapon
|
||||||
int Add_Ammo2 (gentity_t *ent, int weapon, int count)
|
static int Add_Ammo2 (gentity_t *ent, int weapon, int count)
|
||||||
{
|
{
|
||||||
playerState_t *ps = &ent->client->ps;
|
playerState_t *ps = &ent->client->ps;
|
||||||
|
|
||||||
|
@ -452,7 +384,7 @@ int Add_Ammo2 (gentity_t *ent, int weapon, int count)
|
||||||
}
|
}
|
||||||
|
|
||||||
//!Shuts down a ammo station
|
//!Shuts down a ammo station
|
||||||
void ammo_shutdown( gentity_t *self )
|
static void ammo_shutdown( gentity_t *self )
|
||||||
{
|
{
|
||||||
if (!(self->s.eFlags & EF_ANIM_ONCE))
|
if (!(self->s.eFlags & EF_ANIM_ONCE))
|
||||||
{
|
{
|
||||||
|
@ -464,7 +396,7 @@ void ammo_shutdown( gentity_t *self )
|
||||||
}
|
}
|
||||||
|
|
||||||
//!Fades out a ammo station
|
//!Fades out a ammo station
|
||||||
void ammo_fade_out( gentity_t *ent )
|
static void ammo_fade_out( gentity_t *ent )
|
||||||
{
|
{
|
||||||
G_Sound( ent, G_SoundIndex( "sound/items/respawn1.wav" ) );
|
G_Sound( ent, G_SoundIndex( "sound/items/respawn1.wav" ) );
|
||||||
ent->s.eFlags |= EF_ITEMPLACEHOLDER;
|
ent->s.eFlags |= EF_ITEMPLACEHOLDER;
|
||||||
|
@ -474,7 +406,7 @@ void ammo_fade_out( gentity_t *ent )
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Think function for the ammo station
|
//! Think function for the ammo station
|
||||||
void ammo_think( gentity_t *ent )
|
static void ammo_think( gentity_t *ent )
|
||||||
{
|
{
|
||||||
int dif = 0;
|
int dif = 0;
|
||||||
int i;
|
int i;
|
||||||
|
@ -593,16 +525,6 @@ void ammo_use( gentity_t *self, gentity_t *other, gentity_t *activator)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Finishs off the spawning of an ammo station.
|
|
||||||
*/
|
|
||||||
void ammo_station_finish_spawning ( gentity_t *self )
|
|
||||||
{
|
|
||||||
self->s.eFlags &= ~EF_ITEMPLACEHOLDER;
|
|
||||||
self->think = 0; /*NULL*/
|
|
||||||
self->nextthink = -1;
|
|
||||||
self->use = ammo_use;
|
|
||||||
}
|
|
||||||
//------------------------------------------------------------
|
//------------------------------------------------------------
|
||||||
/*QUAKED misc_ammo_station (1 0 0) (-16 -16 -16) (16 16 16)
|
/*QUAKED misc_ammo_station (1 0 0) (-16 -16 -16) (16 16 16)
|
||||||
|
|
||||||
|
@ -672,7 +594,7 @@ Repairs a func_breakable.
|
||||||
* Repairs it's target entity (stored in ent->lastEnemy)
|
* Repairs it's target entity (stored in ent->lastEnemy)
|
||||||
* if it is damaged.
|
* if it is damaged.
|
||||||
*/
|
*/
|
||||||
void target_repair_use(gentity_t *ent, gentity_t *other, gentity_t *activator) {
|
static void target_repair_use(gentity_t *ent, gentity_t *other, gentity_t *activator) {
|
||||||
gentity_t *target;
|
gentity_t *target;
|
||||||
|
|
||||||
target = ent->lastEnemy;
|
target = ent->lastEnemy;
|
||||||
|
@ -706,7 +628,7 @@ void target_repair_use(gentity_t *ent, gentity_t *other, gentity_t *activator) {
|
||||||
/**
|
/**
|
||||||
* Link function finishes off spawning of the entity.
|
* Link function finishes off spawning of the entity.
|
||||||
*/
|
*/
|
||||||
void target_repair_link(gentity_t *ent) {
|
static void target_repair_link(gentity_t *ent) {
|
||||||
gentity_t *target;
|
gentity_t *target;
|
||||||
|
|
||||||
ent->nextthink = -1;
|
ent->nextthink = -1;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
|
|
||||||
void breakable_use(gentity_t *self, gentity_t *other, gentity_t *activator);
|
void breakable_use(gentity_t *self, gentity_t *other, gentity_t *activator);
|
||||||
void breakable_pain( gentity_t *self, gentity_t *attacker, int damage );
|
void breakable_pain( gentity_t *self, gentity_t *attacker, int damage );
|
||||||
void breakable_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int damage, int meansOfDeath );
|
//void breakable_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int damage, int meansOfDeath );
|
||||||
//static void InitBBrush ( gentity_t *ent );
|
//static void InitBBrush ( gentity_t *ent );
|
||||||
|
|
Loading…
Reference in a new issue