diff options
author | Tim Angus <tim@ngus.net> | 2001-09-07 15:11:46 +0000 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2001-09-07 15:11:46 +0000 |
commit | 03091e5b87d1d0aa5f153ccda8a0316733cf01f4 (patch) | |
tree | 61cd0d896d888bf5718f12653b82aefb0f295de2 /src/game | |
parent | fa0922d0e311a68daf24aa1ae48dd35c29d894bf (diff) |
Destroy anims for alien stuff
Diffstat (limited to 'src/game')
-rw-r--r-- | src/game/g_buildable.c | 75 | ||||
-rw-r--r-- | src/game/g_client.c | 2 | ||||
-rw-r--r-- | src/game/g_local.h | 2 |
3 files changed, 60 insertions, 19 deletions
diff --git a/src/game/g_buildable.c b/src/game/g_buildable.c index f7769613..8256b1cf 100644 --- a/src/game/g_buildable.c +++ b/src/game/g_buildable.c @@ -33,9 +33,14 @@ G_setBuildableAnim Triggers an animation client side ================ */ -void G_setBuildableAnim( gentity_t *ent, buildableAnimNumber_t anim ) +void G_setBuildableAnim( gentity_t *ent, buildableAnimNumber_t anim, qboolean force ) { - G_AddEvent( ent, EV_BUILD_ANIM, anim ); + int localAnim = anim; + + if( force ) + localAnim |= ANIM_TOGGLEBIT; + + G_AddEvent( ent, EV_BUILD_ANIM, localAnim ); } /* @@ -265,12 +270,12 @@ void DSpawn_Melt( gentity_t *self ) /* ================ -DSpawn_Die +DSpawn_Blast Called when an droid spawn dies ================ */ -void DSpawn_Die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int damage, int mod ) +void DSpawn_Blast( gentity_t *self ) { vec3_t dir; @@ -287,7 +292,6 @@ void DSpawn_Die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int G_AddEvent( self, EV_GIB_DROID, DirToByte( dir ) ); self->r.contents = CONTENTS_TRIGGER; self->timestamp = level.time; - self->die = nullDieFunction; self->think = DSpawn_Melt; self->nextthink = level.time + 500; //wait .5 seconds before damaging others @@ -296,6 +300,25 @@ void DSpawn_Die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int /* ================ +DSpawn_Die + +Called when an droid spawn dies +================ +*/ +void DSpawn_Die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int damage, int mod ) +{ + G_setBuildableAnim( self, BANIM_DESTROY1, qtrue ); + G_setIdleBuildableAnim( self, BANIM_DESTROYED ); + + self->die = nullDieFunction; + self->think = DSpawn_Blast; + self->nextthink = level.time + 1500; //wait .5 seconds before damaging others + + trap_LinkEntity( self ); +} + +/* +================ DSpawn_Think think function for Droid Spawn @@ -314,7 +337,7 @@ pain function for Droid Spawn */ void DSpawn_Pain( gentity_t *self, gentity_t *attacker, int damage ) { - G_setBuildableAnim( self, BANIM_PAIN1 ); + G_setBuildableAnim( self, BANIM_PAIN1, qfalse ); } @@ -333,22 +356,22 @@ pain function for Droid Spawn void DBarricade_Pain( gentity_t *self, gentity_t *attacker, int damage ) { if( random() > 0.5f ) - G_setBuildableAnim( self, BANIM_PAIN1 ); + G_setBuildableAnim( self, BANIM_PAIN1, qfalse ); else - G_setBuildableAnim( self, BANIM_PAIN2 ); + G_setBuildableAnim( self, BANIM_PAIN2, qfalse ); } /* ================ -DBarricade_Die +DBarricade_Blast Called when an droid spawn dies ================ */ -void DBarricade_Die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int damage, int mod ) +void DBarricade_Blast( gentity_t *self ) { vec3_t dir; - + // we don't have a valid direction, so just point straight up dir[0] = dir[1] = 0; dir[2] = 1; @@ -362,9 +385,27 @@ void DBarricade_Die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, G_AddEvent( self, EV_GIB_DROID, DirToByte( dir ) ); self->r.contents = CONTENTS_TRIGGER; self->timestamp = level.time; - self->die = nullDieFunction; self->think = D_CreepRecede; - self->nextthink = level.time + 100; + self->nextthink = level.time + 500; //wait .5 seconds before damaging others + + trap_LinkEntity( self ); +} + +/* +================ +DBarricade_Die + +Called when an droid spawn dies +================ +*/ +void DBarricade_Die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int damage, int mod ) +{ + G_setBuildableAnim( self, BANIM_DESTROY1, qtrue ); + G_setIdleBuildableAnim( self, BANIM_DESTROYED ); + + self->die = nullDieFunction; + self->think = DBarricade_Blast; + self->nextthink = level.time + 1500; trap_LinkEntity( self ); } @@ -464,7 +505,7 @@ void DAcidTube_Think( gentity_t *self ) self->timestamp = level.time; self->think = DAcidTube_Damage; self->nextthink = level.time + 100; - G_setBuildableAnim( self, BANIM_ATTACK1 ); + G_setBuildableAnim( self, BANIM_ATTACK1, qfalse ); } } @@ -495,7 +536,7 @@ void ddef_fireonenemy( gentity_t *self, int firespeed ) //fire at target FireWeapon( self ); - G_setBuildableAnim( self, BANIM_ATTACK1 ); + G_setBuildableAnim( self, BANIM_ATTACK1, qfalse ); self->count = level.time + firespeed; } @@ -993,7 +1034,7 @@ void hdef_fireonenemy( gentity_t *self, int firespeed ) { //fire at target FireWeapon( self ); - G_setBuildableAnim( self, BANIM_ATTACK1 ); + G_setBuildableAnim( self, BANIM_ATTACK1, qfalse ); self->count = level.time + firespeed; } @@ -1172,7 +1213,7 @@ Called when a human spawn dies void HSpawn_Die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int damage, int mod ) { //pretty events and cleanup - G_setBuildableAnim( self, BANIM_DESTROY1 ); + G_setBuildableAnim( self, BANIM_DESTROY1, qtrue ); G_setIdleBuildableAnim( self, BANIM_DESTROYED ); self->die = nullDieFunction; diff --git a/src/game/g_client.c b/src/game/g_client.c index 739529ec..32940b87 100644 --- a/src/game/g_client.c +++ b/src/game/g_client.c @@ -1302,7 +1302,7 @@ void ClientSpawn( gentity_t *ent, gentity_t *spawn ) { } //start spawn animation on egg - G_setBuildableAnim( spawnPoint, BANIM_SPAWN1 ); + G_setBuildableAnim( spawnPoint, BANIM_SPAWN1, qtrue ); } } client->pers.teamState.state = TEAM_ACTIVE; diff --git a/src/game/g_local.h b/src/game/g_local.h index 0fcfdc75..633c29e9 100644 --- a/src/game/g_local.h +++ b/src/game/g_local.h @@ -542,7 +542,7 @@ typedef enum itemBuildError_t G_itemFits( gentity_t *ent, buildable_t buildable, int distance ); gentity_t *G_buildItem( gentity_t *ent, buildable_t buildable, int distance, float speed ); -void G_setBuildableAnim( gentity_t *ent, buildableAnimNumber_t anim ); +void G_setBuildableAnim( gentity_t *ent, buildableAnimNumber_t anim, qboolean force ); void G_setIdleBuildableAnim( gentity_t *ent, buildableAnimNumber_t anim ); // |