summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTim Angus <tim@ngus.net>2002-09-18 17:58:24 +0000
committerTim Angus <tim@ngus.net>2002-09-18 17:58:24 +0000
commit97e8072f96320ff755b2a3df74ff186df4e31d93 (patch)
tree2065903725211221913d0c73dfa9f6dd971fdaa6 /src
parent8ecf6d9e5d2a03e965647ac264940f8cd34eef0a (diff)
* Added damage particle effects for the buildables
* Snarfed some info about trap_FS_Seek from TTimo and updated .asm files * Rewrote wav writer in mp3 decoder to use file seeking - massive improvement * Changed a few bounding box sizes * Fiddled with tremulous.h
Diffstat (limited to 'src')
-rw-r--r--src/cgame/cg_buildable.c118
-rw-r--r--src/cgame/cg_local.h6
-rw-r--r--src/cgame/cg_syscalls.asm1
-rw-r--r--src/game/bg_misc.c94
-rw-r--r--src/game/g_syscalls.asm1
-rw-r--r--src/game/tremulous.h4
-rw-r--r--src/ui/ui_syscalls.asm1
7 files changed, 173 insertions, 52 deletions
diff --git a/src/cgame/cg_buildable.c b/src/cgame/cg_buildable.c
index 90cb2e76..837c0f3f 100644
--- a/src/cgame/cg_buildable.c
+++ b/src/cgame/cg_buildable.c
@@ -519,6 +519,117 @@ void CG_GhostBuildable( buildable_t buildable )
trap_R_AddRefEntityToScene( &ent );
}
+#define MAX_SMOKE_TIME 500
+#define MIN_SMOKE_TIME 100
+#define SMOKE_SPREAD 89.0f
+#define SMOKE_LIFETIME 1000
+
+#define MAX_SPARK_TIME 5000
+#define MIN_SPARK_TIME 800
+#define SPARK_SPREAD 80.0f
+#define SPARK_LIFETIME 1500
+
+#define BLEED_TIME 1500
+#define BLEED_SPREAD 80.0f
+#define BLEED_LIFETIME 1000
+#define MAX_BLEED_BLOBS 6
+
+/*
+==================
+CG_BuildableParticleEffects
+==================
+*/
+static void CG_BuildableParticleEffects( centity_t *cent )
+{
+ entityState_t *es = &cent->currentState;
+ buildableTeam_t team = BG_FindTeamForBuildable( es->modelindex );
+ int health = es->generic1 & ~( B_POWERED_TOGGLEBIT | B_DCCED_TOGGLEBIT );
+ float healthFrac = (float)health / 63.0f;
+ int smokeTime, sparkTime, i, bleedBlobs;
+ vec3_t origin;
+ vec3_t acc = { 0.0f, 0.0f, 50.0f };
+ vec3_t grav = { 0.0f, 0.0f, -DEFAULT_GRAVITY };
+ vec3_t vel = { 0.0f, 0.0f, 0.0f };
+
+ VectorCopy( cent->lerpOrigin, origin );
+
+ if( team == BIT_HUMANS )
+ {
+ //hack to move particle origin away from ground
+ origin[ 2 ] += 8.0f;
+
+ if( healthFrac < 0.33f && cent->buildableSmokeTime < cg.time )
+ {
+ //smoke
+ smokeTime = healthFrac * 3 * MAX_SMOKE_TIME;
+ if( smokeTime < MIN_SMOKE_TIME )
+ smokeTime = MIN_SMOKE_TIME;
+
+ VectorSet( vel, 0.0f, 0.0f, 50.0f );
+
+ CG_LaunchSprite( origin, vel, acc, SMOKE_SPREAD,
+ 0.5f, 10.0f, 50.0f, 128.0f, 0.0f,
+ rand( ) % 360, cg.time, cg.time,
+ SMOKE_LIFETIME + ( crandom( ) * ( SMOKE_LIFETIME / 2 ) ),
+ cgs.media.smokePuffShader, qfalse, qfalse );
+
+ cent->buildableSmokeTime = cg.time + smokeTime;
+ }
+
+ if( healthFrac < 0.2f && cent->buildableSparkTime < cg.time )
+ {
+ //sparks
+ sparkTime = healthFrac * 5 * MAX_SPARK_TIME;
+ if( sparkTime < MIN_SPARK_TIME )
+ sparkTime = MIN_SPARK_TIME;
+
+ for( i = 0; i < 3; i++ )
+ {
+ qhandle_t spark;
+
+ if( rand( ) % 1 )
+ spark = cgs.media.gibSpark1;
+ else
+ spark = cgs.media.gibSpark2;
+
+ VectorSet( vel, 0.0f, 0.0f, 200.0f );
+ VectorSet( grav, 0.0f, 0.0f, DEFAULT_GRAVITY );
+
+ CG_LaunchSprite( origin, vel, grav, SPARK_SPREAD,
+ 0.6f, 4.0f, 2.0f, 255.0f, 0.0f,
+ rand( ) % 360, cg.time, cg.time,
+ SPARK_LIFETIME + ( crandom( ) * ( SPARK_LIFETIME / 2 ) ),
+ spark, qfalse, qfalse );
+ }
+
+ cent->buildableSparkTime = cg.time + sparkTime;
+ }
+ }
+ else if( team == BIT_ALIENS )
+ {
+ //bleed a bit if damaged
+ if( healthFrac < 0.33f && cent->buildableBleedTime < cg.time )
+ {
+ VectorScale( es->origin2, 100.0f, vel );
+ VectorSet( grav, 0.0f, 0.0f, -DEFAULT_GRAVITY/4 );
+
+ bleedBlobs = ( 1.0f - ( healthFrac * 3 ) ) * MAX_BLEED_BLOBS + 1;
+
+ for( i = 0; i < bleedBlobs; i++ )
+ {
+ CG_LaunchSprite( origin, vel, grav, BLEED_SPREAD,
+ 0.0f, 4.0f, 20.0f, 255.0f, 0.0f,
+ rand( ) % 360, cg.time, cg.time,
+ BLEED_LIFETIME + ( crandom( ) * ( BLEED_LIFETIME / 2 ) ),
+ cgs.media.greenBloodTrailShader, qfalse, qfalse );
+ }
+
+ cent->buildableBleedTime = cg.time + BLEED_TIME;
+ }
+ }
+}
+
+
#define HEALTH_BAR_WIDTH 50.0f
#define HEALTH_BAR_HEIGHT 15.0f
@@ -527,7 +638,7 @@ void CG_GhostBuildable( buildable_t buildable )
CG_BuildableHealthBar
==================
*/
-void CG_BuildableHealthBar( centity_t *cent )
+static void CG_BuildableHealthBar( centity_t *cent )
{
vec3_t origin, origin2, down, right, back, downLength, rightLength;
float rimWidth = HEALTH_BAR_HEIGHT / 15.0f;
@@ -590,7 +701,7 @@ void CG_BuildableHealthBar( centity_t *cent )
CG_DrawPlane( origin2, downLength, rightLength, shader );
if( !( es->generic1 & B_POWERED_TOGGLEBIT ) &&
- BG_FindTeamForBuildable( es->modelindex ) == WUT_HUMANS )
+ BG_FindTeamForBuildable( es->modelindex ) == BIT_HUMANS )
{
VectorMA( origin, 15.0f, right, origin2 );
VectorMA( origin2, HEALTH_BAR_HEIGHT + 5.0f, down, origin2 );
@@ -744,4 +855,7 @@ void CG_Buildable( centity_t *cent )
default:
break;
}
+
+ //smoke etc for damaged buildables
+ CG_BuildableParticleEffects( cent );
}
diff --git a/src/cgame/cg_local.h b/src/cgame/cg_local.h
index 7f8efc83..99bb91cf 100644
--- a/src/cgame/cg_local.h
+++ b/src/cgame/cg_local.h
@@ -208,11 +208,15 @@ typedef struct centity_s
lerpFrame_t lerpFrame;
//TA:
- buildableAnimNumber_t buildableAnim; //persistant anim number
int flamerTime; //limit flameball count
int poisonTime; //limit poison count
int firstPoisonTime; //when poison cloud starts
int jetTime; //limit jet count
+
+ buildableAnimNumber_t buildableAnim; //persistant anim number
+ int buildableSmokeTime;
+ int buildableSparkTime;
+ int buildableBleedTime;
} centity_t;
diff --git a/src/cgame/cg_syscalls.asm b/src/cgame/cg_syscalls.asm
index 6cc032f8..9da1dade 100644
--- a/src/cgame/cg_syscalls.asm
+++ b/src/cgame/cg_syscalls.asm
@@ -89,6 +89,7 @@ equ trap_R_AddAdditiveLightToScene -86
equ trap_GetEntityToken -87
equ trap_R_AddPolysToScene -88
equ trap_R_inPVS -89
+equ trap_FS_Seek -90
equ memset -101
equ memcpy -102
diff --git a/src/game/bg_misc.c b/src/game/bg_misc.c
index 94e3a217..40a34e3e 100644
--- a/src/game/bg_misc.c
+++ b/src/game/bg_misc.c
@@ -28,7 +28,7 @@ buildableAttributes_t bg_buildableList[ ] =
{ "models/buildables/bioegg/bioegg.md3", 0, 0, 0 },
{ -15, -15, -15 }, //vec3_t mins;
{ 15, 15, 15 }, //vec3_t maxs;
- TR_GRAVITY, //trType_t traj;
+ TR_GRAVITY, //trType_t traj;
0.0, //float bounce;
ASPAWN_BP, //int buildPoints;
( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int stages
@@ -57,9 +57,9 @@ buildableAttributes_t bg_buildableList[ ] =
"Barricade", //char *humanName;
"team_alien_barricade",//char *entityName;
{ "models/buildables/barricade/barricade.md3", 0, 0, 0 },
- { -15, -15, -15 }, //vec3_t mins;
- { 15, 15, 15 }, //vec3_t maxs;
- TR_GRAVITY, //trType_t traj;
+ { -35, -35, -15 }, //vec3_t mins;
+ { 35, 35, 15 }, //vec3_t maxs;
+ TR_GRAVITY, //trType_t traj;
0.0, //float bounce;
BARRICADE_BP, //int buildPoints;
( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int stages
@@ -88,10 +88,10 @@ buildableAttributes_t bg_buildableList[ ] =
"Booster", //char *humanName;
"team_alien_booster", //char *entityName;
{ "models/buildables/booster/booster.md3", 0, 0, 0 },
- { -26, -26, -9 }, //vec3_t mins;
- { 26, 26, 9 }, //vec3_t maxs;
- TR_GRAVITY, //trType_t traj;
- 0.0, //float bounce;
+ { -26, -26, -9 }, //vec3_t mins;
+ { 26, 26, 9 }, //vec3_t maxs;
+ TR_GRAVITY, //trType_t traj;
+ 0.0, //float bounce;
BOOSTER_BP, //int buildPoints;
( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int stages
BOOSTER_HEALTH, //int health;
@@ -121,8 +121,8 @@ buildableAttributes_t bg_buildableList[ ] =
{ "models/buildables/acid_tube/acid_tube.md3", 0, 0, 0 },
{ -15, -15, -15 }, //vec3_t mins;
{ 15, 15, 15 }, //vec3_t maxs;
- TR_GRAVITY, //trType_t traj;
- 0.0, //float bounce;
+ TR_GRAVITY, //trType_t traj;
+ 0.0, //float bounce;
ACIDTUBE_BP, //int buildPoints;
( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int stages
ACIDTUBE_HEALTH, //int health;
@@ -152,8 +152,8 @@ buildableAttributes_t bg_buildableList[ ] =
{ "models/buildables/trapper/trapper.md3", 0, 0, 0 },
{ -15, -15, -15 }, //vec3_t mins;
{ 15, 15, 15 }, //vec3_t maxs;
- TR_GRAVITY, //trType_t traj;
- 0.0, //float bounce;
+ TR_GRAVITY, //trType_t traj;
+ 0.0, //float bounce;
TRAPPER_BP, //int buildPoints;
( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int stages
TRAPPER_HEALTH, //int health;
@@ -181,9 +181,9 @@ buildableAttributes_t bg_buildableList[ ] =
"Overmind", //char *humanName;
"team_alien_hivemind", //char *entityName;
{ "models/buildables/hivemind/hivemind.md3", 0, 0, 0 },
- { -15, -15, -15 }, //vec3_t mins;
- { 15, 15, 15 }, //vec3_t maxs;
- TR_GRAVITY, //trType_t traj;
+ { -45, -45, -15 }, //vec3_t mins;
+ { 45, 45, 15 }, //vec3_t maxs;
+ TR_GRAVITY, //trType_t traj;
0.0, //float bounce;
OVERMIND_BP, //int buildPoints;
( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int stages
@@ -245,7 +245,7 @@ buildableAttributes_t bg_buildableList[ ] =
{ "models/buildables/obank/obank.md3", 0, 0, 0 },
{ -15, -15, -15 }, //vec3_t mins;
{ 15, 15, 15 }, //vec3_t maxs;
- TR_GRAVITY, //trType_t traj;
+ TR_GRAVITY, //trType_t traj;
0.0, //float bounce;
OBANK_BP, //int buildPoints;
( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int stages
@@ -276,7 +276,7 @@ buildableAttributes_t bg_buildableList[ ] =
{ "models/buildables/replicator/replicator.md3", 0, 0, 0 },
{ -40, -40, -4 }, //vec3_t mins;
{ 40, 40, 4 }, //vec3_t maxs;
- TR_GRAVITY, //trType_t traj;
+ TR_GRAVITY, //trType_t traj;
0.0, //float bounce;
HSPAWN_BP, //int buildPoints;
( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int stages
@@ -307,7 +307,7 @@ buildableAttributes_t bg_buildableList[ ] =
{ "models/buildables/medistat/medistat.md3", 0, 0, 0 },
{ -35, -35, -7 }, //vec3_t mins;
{ 35, 35, 7 }, //vec3_t maxs;
- TR_GRAVITY, //trType_t traj;
+ TR_GRAVITY, //trType_t traj;
0.0, //float bounce;
MEDISTAT_BP, //int buildPoints;
( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int stages
@@ -338,10 +338,10 @@ buildableAttributes_t bg_buildableList[ ] =
{ "models/buildables/medistat/medistat2.md3", 0, 0, 0 },
{ -65, -65, -7 }, //vec3_t mins;
{ 65, 65, 7 }, //vec3_t maxs;
- TR_GRAVITY, //trType_t traj;
- 0.0, //float bounce;
+ TR_GRAVITY, //trType_t traj;
+ 0.0, //float bounce;
ADVMEDISTAT_BP, //int buildPoints;
- ( 1 << S3 ), //int stages
+ ( 1 << S3 ), //int stages
ADVMEDISTAT_HEALTH, //int health;
0, //int regenRate;
ADVMEDISTAT_SPLASHDAMAGE, //int splashDamage;
@@ -371,8 +371,8 @@ buildableAttributes_t bg_buildableList[ ] =
"models/buildables/mgturret/turret_top.md3", 0 },
{ -25, -25, -20 }, //vec3_t mins;
{ 25, 25, 20 }, //vec3_t maxs;
- TR_GRAVITY, //trType_t traj;
- 0.0, //float bounce;
+ TR_GRAVITY, //trType_t traj;
+ 0.0, //float bounce;
MGTURRET_BP, //int buildPoints;
( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int stages
MGTURRET_HEALTH, //int health;
@@ -402,10 +402,10 @@ buildableAttributes_t bg_buildableList[ ] =
{ "models/buildables/tesla/tesla.md3", 0, 0, 0 },
{ -22, -22, -40 }, //vec3_t mins;
{ 22, 22, 40 }, //vec3_t maxs;
- TR_GRAVITY, //trType_t traj;
- 0.0, //float bounce;
+ TR_GRAVITY, //trType_t traj;
+ 0.0, //float bounce;
TESLAGEN_BP, //int buildPoints;
- ( 1 << S3 ), //int stages
+ ( 1 << S3 ), //int stages
TESLAGEN_HEALTH, //int health;
0, //int regenRate;
TESLAGEN_SPLASHDAMAGE, //int splashDamage;
@@ -431,12 +431,12 @@ buildableAttributes_t bg_buildableList[ ] =
"Defence Computer", //char *humanName;
"team_human_dcc", //char *entityName;
{ "models/buildables/dcc/dcc.md3", 0, 0, 0 },
- { -15, -15, -15 }, //vec3_t mins;
- { 15, 15, 15 }, //vec3_t maxs;
- TR_GRAVITY, //trType_t traj;
- 0.0, //float bounce;
+ { -35, -35, -15 }, //vec3_t mins;
+ { 35, 35, 15 }, //vec3_t maxs;
+ TR_GRAVITY, //trType_t traj;
+ 0.0, //float bounce;
DC_BP, //int buildPoints;
- ( 1 << S3 ), //int stages
+ ( 1 << S3 ), //int stages
DC_HEALTH, //int health;
0, //int regenRate;
DC_SPLASHDAMAGE, //int splashDamage;
@@ -462,10 +462,10 @@ buildableAttributes_t bg_buildableList[ ] =
"Bank", //char *humanName;
"team_human_bank", //char *entityName;
{ "models/buildables/bank/bank.md3", 0, 0, 0 },
- { -15, -15, -15 }, //vec3_t mins;
- { 15, 15, 15 }, //vec3_t maxs;
- TR_GRAVITY, //trType_t traj;
- 0.0, //float bounce;
+ { -25, -25, -15 }, //vec3_t mins;
+ { 25, 25, 15 }, //vec3_t maxs;
+ TR_GRAVITY, //trType_t traj;
+ 0.0, //float bounce;
BANK_BP, //int buildPoints;
( 1 << S2 )|( 1 << S3 ), //int stages
BANK_HEALTH, //int health;
@@ -493,10 +493,10 @@ buildableAttributes_t bg_buildableList[ ] =
"Armoury", //char *humanName;
"team_human_mcu", //char *entityName;
{ "models/buildables/mcu/mcu.md3", 0, 0, 0 },
- { -15, -15, -15 }, //vec3_t mins;
- { 15, 15, 15 }, //vec3_t maxs;
- TR_GRAVITY, //trType_t traj;
- 0.0, //float bounce;
+ { -40, -40, -15 }, //vec3_t mins;
+ { 40, 40, 15 }, //vec3_t maxs;
+ TR_GRAVITY, //trType_t traj;
+ 0.0, //float bounce;
ARMOURY_BP, //int buildPoints;
( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int stages
ARMOURY_HEALTH, //int health;
@@ -524,10 +524,10 @@ buildableAttributes_t bg_buildableList[ ] =
"Reactor", //char *humanName;
"team_human_reactor", //char *entityName;
{ "models/buildables/reactor/reactor.md3", 0, 0, 0 },
- { -15, -15, -15 }, //vec3_t mins;
- { 15, 15, 15 }, //vec3_t maxs;
- TR_GRAVITY, //trType_t traj;
- 0.0, //float bounce;
+ { -50, -50, -15 }, //vec3_t mins;
+ { 50, 50, 15 }, //vec3_t maxs;
+ TR_GRAVITY, //trType_t traj;
+ 0.0, //float bounce;
REACTOR_BP, //int buildPoints;
( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int stages
REACTOR_HEALTH, //int health;
@@ -557,8 +557,8 @@ buildableAttributes_t bg_buildableList[ ] =
{ "models/buildables/repeater/repeater.md3", 0, 0, 0 },
{ -15, -15, -15 }, //vec3_t mins;
{ 15, 15, 15 }, //vec3_t maxs;
- TR_GRAVITY, //trType_t traj;
- 0.0, //float bounce;
+ TR_GRAVITY, //trType_t traj;
+ 0.0, //float bounce;
REPEATER_BP, //int buildPoints;
( 1 << S2 )|( 1 << S3 ), //int stages
REPEATER_HEALTH, //int health;
@@ -588,8 +588,8 @@ buildableAttributes_t bg_buildableList[ ] =
{ "models/buildables/floatmine/floatmine.md3", 0, 0, 0 },
{ -25, -25, -25 }, //vec3_t mins;
{ 25, 25, 25 }, //vec3_t maxs;
- TR_BUOYANCY, //trType_t traj;
- 0.2, //float bounce;
+ TR_BUOYANCY, //trType_t traj;
+ 0.2, //float bounce;
FLOATMINE_BP, //int buildPoints;
( 1 << S2 )|( 1 << S3 ), //int stages
FLOATMINE_HEALTH, //int health;
diff --git a/src/game/g_syscalls.asm b/src/game/g_syscalls.asm
index 4fe395d4..8035c349 100644
--- a/src/game/g_syscalls.asm
+++ b/src/game/g_syscalls.asm
@@ -45,6 +45,7 @@ equ trap_RealTime -42
equ trap_SnapVector -43
equ trap_TraceCapsule -44
equ trap_EntityContactCapsule -45
+equ trap_FS_Seek -46
equ memset -101
diff --git a/src/game/tremulous.h b/src/game/tremulous.h
index 83f1c5ec..29c5b8e2 100644
--- a/src/game/tremulous.h
+++ b/src/game/tremulous.h
@@ -289,7 +289,7 @@
#define FLAMER_PRICE 300
#define FLAMER_DMG HDM(25)
#define FLAMER_RADIUS 50
-#define FLAMER_LIFETIME 1000
+#define FLAMER_LIFETIME 1000.0f
#define FLAMER_SPEED 200.0f
#define FLAMER_LAG 0.5f //the amount of player velocity that is added to the fireball
@@ -413,7 +413,7 @@
#define MGTURRET_SPLASHDAMAGE 50
#define MGTURRET_SPLASHRADIUS 100
#define MGTURRET_ANGULARSPEED 20 //degrees/think ~= 200deg/sec
-#define MGTURRET_ACCURACYTOLERANCE MGTURRET_ANGULARSPEED / 2 //angular difference for turret to fire
+#define MGTURRET_ACCURACYTOLERANCE MGTURRET_ANGULARSPEED / 2 //angular difference for turret to fire
#define MGTURRET_VERTICALCAP 30 // +/- maximum pitch
#define MGTURRET_REPEAT 50
#define MGTURRET_RANGE 300
diff --git a/src/ui/ui_syscalls.asm b/src/ui/ui_syscalls.asm
index 2fdb200e..4b00201a 100644
--- a/src/ui/ui_syscalls.asm
+++ b/src/ui/ui_syscalls.asm
@@ -86,6 +86,7 @@ equ trap_LAN_ServerStatus -83
equ trap_LAN_GetServerPing -84
equ trap_LAN_ServerIsVisible -85
equ trap_LAN_CompareServers -86
+equ trap_FS_Seek -87
equ memset -101