Implemented info_hostage_rescue and Game_CreateRescueZone

This commit is contained in:
Marco Hladik 2016-12-04 15:56:41 +01:00
parent 3bd3b7c95f
commit 2acddc369d
6 changed files with 62 additions and 6 deletions

View file

@ -140,13 +140,13 @@ void HUD_DrawIcons( void ) {
// Hostage-Rescue Area Icon
if( getstatf( STAT_HOSTAGEZONE ) == TRUE ) {
vector vRIconPos = [ 16, ( vVideoResolution_y / 2 ) + 48 ];
vector vRIconPos = [ 16, ( vVideoResolution_y / 2 ) + 24 ];
drawsubpic( vRIconPos, '32 32 0', HUD_NUMFILE_LAYER, [ 0.125 * 2, 0.125 * 5 - 0.046875], [ 0.125, 0.125 ], '0 1 0', 1, DRAWFLAG_ADDITIVE );
}
// Bomb-Area
if( getstatf( STAT_BOMBZONE ) == TRUE ) {
vector vBIconPos = [ 16, ( vVideoResolution_y / 2 ) + 48 ];
vector vBIconPos = [ 16, ( vVideoResolution_y / 2 ) + 24 ];
drawsubpic( vBIconPos, '32 32 0', HUD_NUMFILE_LAYER, [ 0, 0.125 * 5 - 0.046875], [ 0.125, 0.125 ], '0 1 0', 1, DRAWFLAG_ADDITIVE );
}
}
@ -181,7 +181,15 @@ void HUD_DrawTimer( void ) {
// Flashing red numbers
if ( ( iMinutes == 0 ) && ( iTens <= 1 ) ) {
float fAlpha = fabs( sin( time * 20 ) );
float fAlpha;
// 0:00 is fully red
if ( ( iTens == 0 ) && ( iUnits == 0 ) ) {
fAlpha = 1;
} else {
fAlpha = fabs( sin( time * 20 ) );
}
HUD_DrawRedNumber( iMinutes, vTimePos + '48 0 0', fAlpha);
HUD_DrawRedNumber( iTens, vTimePos + '70 0 0', fAlpha);
HUD_DrawRedNumber( iUnits, vTimePos + '94 0 0',fAlpha );

View file

@ -58,6 +58,7 @@ int iHostagesMax;
int iHostagesRescued;
int iBombZones;
int iRescueZones;
// Generic entity fields
.int iUsable;

View file

@ -36,6 +36,10 @@ void func_hostage_rescue_touch( void ) {
remove( other.eTargetPoint );
}
remove( other );
if ( iHostagesRescued >= iHostagesMax ) {
Rules_RoundOver( TEAM_CT );
}
}
}
@ -50,7 +54,43 @@ void func_hostage_rescue( void ) {
self.angles = '0 0 0';
self.movetype = MOVETYPE_NONE;
self.solid = SOLID_TRIGGER;
setmodel( self, self.model );
if ( self.model ) {
setmodel( self, self.model );
} else {
setsize( self, self.mins, self.maxs );
}
self.model = 0;
self.touch = func_hostage_rescue_touch;
iRescueZones++;
}
void info_hostage_rescue( void ) {
self.mins = '-128 -128 -36';
self.maxs = '128 128 36';
func_hostage_rescue();
}
/*
=================
Game_CreateRescueZones
Called by StartFrame if we somehow got no rescue zones
=================
*/
void Game_CreateRescueZones( void ) {
entity eFind = findchain( classname, "info_player_start" );
while ( eFind ) {
entity eRescueZone = spawn();
setorigin( eRescueZone, eFind.origin );
entity eOldSelf = self;
self = eRescueZone;
info_hostage_rescue();
self = eOldSelf;
eFind = eFind.chain;
}
}

View file

@ -25,6 +25,11 @@ void SetChangeParms( void ) {}
// Run every frame... by world?
void StartFrame( void ) {
// We've got hostages, but no rescue zones, create some
if ( !iRescueZones && iHostagesMax > 0 ) {
Game_CreateRescueZones();
}
// Global amount of players etc.
int iInGamePlayers = ( iInGamePlayers_T + iInGamePlayers_CT );

View file

@ -20,7 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// Loop through all players and respawn them
void Rules_Restart( void ) {
//localcmd( "restart_ents" );
localcmd( "restart_ents" );
entity eFind = findchain( classname, "player" );

View file

@ -38,7 +38,7 @@ Damage.c
TraceAttack.c
Rules.c
Timer.c
Main.c
EntHostage.c
Entities.c
Triggers.c
@ -49,6 +49,8 @@ FuncLadder.c
FuncHostageRescue.c
FuncBombTarget.c
FuncBuyZone.c
Main.c
Player.c
Spawn.c
Footsteps.c