From b209c6138bfa97f8d427611f19a5e128d1a134e0 Mon Sep 17 00:00:00 2001 From: Tim Angus Date: Thu, 8 Aug 2002 21:40:19 +0000 Subject: * Display of buildable health and power status --- src/game/bg_public.h | 4 ++++ src/game/g_buildable.c | 12 ++++++++++++ 2 files changed, 16 insertions(+) (limited to 'src/game') 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 ); -- cgit