summaryrefslogtreecommitdiff
path: root/src/game
diff options
context:
space:
mode:
authorTim Angus <tim@ngus.net>2002-08-08 21:40:19 +0000
committerTim Angus <tim@ngus.net>2002-08-08 21:40:19 +0000
commitb209c6138bfa97f8d427611f19a5e128d1a134e0 (patch)
tree86941a427e060b2b9b12b5386418f044c9ea223f /src/game
parentf58a14bc26cd5356f7ddd97f6481ddf8fc079223 (diff)
* Display of buildable health and power status
Diffstat (limited to 'src/game')
-rw-r--r--src/game/bg_public.h4
-rw-r--r--src/game/g_buildable.c12
2 files changed, 16 insertions, 0 deletions
diff --git a/src/game/bg_public.h b/src/game/bg_public.h
index c4517a57..95ec9feb 100644
--- a/src/game/bg_public.h
+++ b/src/game/bg_public.h
@@ -444,6 +444,10 @@ typedef enum
BIT_NUM_TEAMS
} buildableTeam_t;
+#define B_POWERED_TOGGLEBIT 0x00000040
+#define B_DCCED_TOGGLEBIT 0x00000080
+
+
// reward sounds (stored in ps->persistant[PERS_PLAYEREVENTS])
#define PLAYEREVENT_DENIEDREWARD 0x0001
#define PLAYEREVENT_GAUNTLETREWARD 0x0002
diff --git a/src/game/g_buildable.c b/src/game/g_buildable.c
index a6cf9492..b636c650 100644
--- a/src/game/g_buildable.c
+++ b/src/game/g_buildable.c
@@ -2175,6 +2175,18 @@ gentity_t *G_buildItem( gentity_t *builder, buildable_t buildable, vec3_t origin
else
VectorSet( normal, 0.0f, 0.0f, 1.0f );
+ built->s.generic1 = (int)( ( (float)built->health /
+ (float)BG_FindHealthForBuildable( buildable ) ) * 63.0f );
+
+ if( built->s.generic1 < 0 )
+ built->s.generic1 = 0;
+
+ if( built->powered )
+ built->s.generic1 |= B_POWERED_TOGGLEBIT;
+
+ if( built->dcced )
+ built->s.generic1 |= B_DCCED_TOGGLEBIT;
+
VectorCopy( normal, built->s.origin2 );
G_AddEvent( built, EV_BUILD_CONSTRUCT, BANIM_CONSTRUCT1 );