diff --git a/Source/Client/HUD.c b/Source/Client/HUD.c index 035ac47f..1df26fce 100644 --- a/Source/Client/HUD.c +++ b/Source/Client/HUD.c @@ -147,7 +147,16 @@ void HUD_DrawIcons( void ) { // Bomb-Area if( getstatf( STAT_BOMBZONE ) == TRUE ) { 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 ); + + if ( getstatf( STAT_ACTIVEWEAPON ) == WEAPON_C4BOMB ) { + float fAlpha = fabs( sin( time * 20 ) ); + drawsubpic( vBIconPos, '32 32 0', HUD_NUMFILE_LAYER, [ 0, 0.125 * 5 - 0.046875], [ 0.125, 0.125 ], '1 0 0', fAlpha, DRAWFLAG_ADDITIVE ); + drawsubpic( vBIconPos, '32 32 0', HUD_NUMFILE_LAYER, [ 0, 0.125 * 5 - 0.046875], [ 0.125, 0.125 ], '0 1 0', 1 - fAlpha, DRAWFLAG_ADDITIVE ); + } else { + drawsubpic( vBIconPos, '32 32 0', HUD_NUMFILE_LAYER, [ 0, 0.125 * 5 - 0.046875], [ 0.125, 0.125 ], '0 1 0', 1, DRAWFLAG_ADDITIVE ); + } + + } } diff --git a/Source/Client/progs.src b/Source/Client/progs.src index 8fe45ceb..bd267ac3 100644 --- a/Source/Client/progs.src +++ b/Source/Client/progs.src @@ -1,6 +1,6 @@ #pragma target fte -#pragma progs_dat "../../Main/csprogs.dat" +#pragma progs_dat "../../cstrike/csprogs.dat" #define CSQC diff --git a/Source/Server/AmbientSound.c b/Source/Server/AmbientSound.c index 97f45ab7..8db8483f 100644 --- a/Source/Server/AmbientSound.c +++ b/Source/Server/AmbientSound.c @@ -56,14 +56,27 @@ void ambient_generic( void ) { sound( self, CHAN_VOICE, self.message, self.health, self.style ); } static void ambient_generic_useloop( void ) { - //self.message = "common/null.wav"; - self.SendFlags = 128; + if ( self.state == TRUE ) { + self.message = "common/null.wav"; + self.SendFlags = 128; + self.state = FALSE; + } else { + self.message = self.noise; + self.SendFlags = 128; + self.state = TRUE; + } + } + static void ambient_generic_respawn( void ) { + // If we are supposed to be looping, but have stopped playing... make sure we do again + if( !( self.spawnflags & 32 ) && ( self.state == FALSE ) ) { + ambient_generic_useloop(); + } } precache_sound( self.message ); setorigin( self, self.origin ); self.health = self.health / 10; - + if ( self.spawnflags & 1 ) { self.style = ATTN_NONE; } else if ( self.spawnflags & 2 ) { @@ -79,12 +92,14 @@ void ambient_generic( void ) { if( self.spawnflags & 32 ) { self.vUse = ambient_generic_use; } else { + self.noise = self.message; // Needed later for resuming self.pvsflags = PVSF_NOREMOVE | PVSF_IGNOREPVS; self.vUse = ambient_generic_useloop; self.SendEntity = ambient_generic_send; + self.state = TRUE; } - + Entities_InitRespawnable( ambient_generic_respawn ); } #else void CSQC_ambient_generic( string sSample, float fVolume, float fAttenuation ) { diff --git a/Source/Server/Damage.c b/Source/Server/Damage.c index 2043fa4b..11d5d403 100644 --- a/Source/Server/Damage.c +++ b/Source/Server/Damage.c @@ -27,14 +27,14 @@ void Damage_Apply( entity eTarget, entity eAttacker, int iDamage, vector vHitPos pointparticles( EFFECT_BLOOD, vHitPos, v_forward * -1, 1 ); } - eOld = self; + entity eOld = self; self = eTarget; - if ( eTarget.health <= 0 ) { - eTarget.health = 0; - eTarget.vDeath(); + if ( self.health <= 0 ) { + self.health = 0; + self.vDeath(); } else { - eTarget.vPain(); + self.vPain(); } self = eOld; diff --git a/Source/Server/Defs.h b/Source/Server/Defs.h index dd17d121..e7e79356 100644 --- a/Source/Server/Defs.h +++ b/Source/Server/Defs.h @@ -20,7 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define VEC_HULL_MIN '-16 -16 -36' #define VEC_HULL_MAX '16 16 36' -#define VEC_PLAYER_VIEWPOS '0 0 24' +#define VEC_PLAYER_VIEWPOS '0 0 20' #define VEC_CHULL_MIN '-16 -16 -18' #define VEC_CHULL_MAX '16 16 18' @@ -61,12 +61,14 @@ float fGameTime; // Game specific fields int iHostagesMax; -int iHostagesRescued; int iBombZones; int iRescueZones; int iBuyZones; int iBuyRestriction; // For info_map_parameters +int iHostagesRescued; +int iBombPlanted; + // Generic entity fields .int iUsable; .int iBleeds; @@ -119,7 +121,5 @@ void Damage_Radius( vector vOrigin, entity eAttacker, float fDamage, float fRadi void Entities_InitRespawnable( void() vRespawnFunc ); void Entities_Respawn( void ); -entity eOld; - // WIP string __fullspawndata; diff --git a/Source/Server/EntHostage.c b/Source/Server/EntHostage.c index efa097be..c19881a0 100644 --- a/Source/Server/EntHostage.c +++ b/Source/Server/EntHostage.c @@ -181,6 +181,7 @@ void hostage_entity( void ) { self.frame = 13; // Idle frame self.health = 100; + self.velocity = '0 0 0'; } precache_model( self.model ); diff --git a/Source/Server/Entities.c b/Source/Server/Entities.c index 03a96174..34c3b76c 100644 --- a/Source/Server/Entities.c +++ b/Source/Server/Entities.c @@ -18,6 +18,38 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +/* +==================== +GOLDSRC-RENDERMODE STUFF +==================== +*/ +enum { + RENDERMODE_NORMAL = 0, + RENDERMODE_COLOR, + RENDERMODE_TEXTURE, + RENDERMODE_GLOW, + RENDERMODE_SOLID, + RENDERMODE_ADDITIVE +}; + +void Entities_RenderSetup( void ) { + // GoldSrc-Rendermode support + if ( self.rendermode != RENDERMODE_NORMAL ) { + self.alpha = ( self.renderamt / 255 ); + self.colormod = self.rendercolor; + + if( self.alpha == 0 ) { + self.alpha = 0.0001; + } + + if ( self.rendermode == RENDERMODE_ADDITIVE ) { + self.effects = EF_ADDITIVE; + } else if ( self.rendermode == RENDERMODE_GLOW ) { + self.effects = EF_ADDITIVE | EF_FULLBRIGHT; + } + } +} + /* ==================== Entities_UseTargets @@ -26,16 +58,15 @@ Entities_UseTargets void Entities_UseTargets( void ) { entity eFind = findchain( targetname, self.target ); + entity eOld = self; while ( eFind ) { - eOld = self; self = eFind; - eFind.vUse(); - self = eOld; + self.vUse(); eFind = eFind.chain; } + self = eOld; } - /* ==================== Entities_UseTargets_Delay @@ -43,7 +74,7 @@ Entities_UseTargets_Delay */ void Entities_UseTargets_Delay( float fDelay ) { static void Entities_UseTargets_Delay_Think( void ) { - eOld = self; + entity eOld = self; self = self.owner; Entities_UseTargets(); remove( eOld ); @@ -53,7 +84,6 @@ void Entities_UseTargets_Delay( float fDelay ) { eTimer.owner = self; eTimer.think = Entities_UseTargets_Delay_Think; eTimer.nextthink = time + fDelay; - } /* @@ -68,9 +98,6 @@ Called .float fOldHealth; .vector vOldOrigin; .vector vOldAngle; -.float fOldAlpha; -.vector vOldColorMod; -.float fOldEffects; .void() vRespawn; void Entities_InitRespawnable( void() vRespawnFunc ) { self.sOldModel = self.model; @@ -78,9 +105,6 @@ void Entities_InitRespawnable( void() vRespawnFunc ) { self.fOldHealth = self.health; self.vOldOrigin = self.origin; self.vOldAngle = self.angles; - self.fOldAlpha = self.alpha; - self.vOldColorMod = self.colormod; - self.fOldEffects = self.effects; self.vRespawn = vRespawnFunc; self.fRespawns = TRUE; } @@ -91,9 +115,7 @@ void Entities_Respawn( void ) { self.health = self.fOldHealth; self.origin = self.vOldOrigin; self.angles = self.vOldAngle; - self.alpha = self.fOldAlpha; - self.colormod = self.vOldColorMod; - self.effects = self.fOldEffects; + Entities_RenderSetup(); self.vRespawn(); } @@ -241,39 +263,6 @@ void Entities_RotateToDestination( vector vDestinationAngle, float fTravelSpeed, self.think = Entities_RotateToDestination_End; } - -/* -==================== -GOLDSRC-RENDERMODE STUFF -==================== -*/ -enum { - RENDERMODE_NORMAL = 0, - RENDERMODE_COLOR, - RENDERMODE_TEXTURE, - RENDERMODE_GLOW, - RENDERMODE_SOLID, - RENDERMODE_ADDITIVE -}; - -void Entities_RenderSetup( void ) { - // GoldSrc-Rendermode support - if ( self.rendermode != RENDERMODE_NORMAL ) { - self.alpha = ( self.renderamt / 255 ); - self.colormod = self.rendercolor; - - if( self.alpha == 0 ) { - self.alpha = 0.0001; - } - - if ( self.rendermode == RENDERMODE_ADDITIVE ) { - self.effects = EF_ADDITIVE; - } else if ( self.rendermode == RENDERMODE_GLOW ) { - self.effects = EF_ADDITIVE | EF_FULLBRIGHT; - } - } -} - void func_wall( void ) { static void func_wall_use( void ) { self.skin = 1 - self.skin; diff --git a/Source/Server/EnvObjects.c b/Source/Server/EnvObjects.c index 780a4c08..d7ba4829 100644 --- a/Source/Server/EnvObjects.c +++ b/Source/Server/EnvObjects.c @@ -33,10 +33,15 @@ Frames per second (framerate) - Framerate the sprite will run at if animated. ================= */ void cycler_sprite( void ) { + static void cycler_sprite_respawn( void ) { + // Find something to do here... + } + precache_model( self.model ); setmodel( self, self.model ); Entities_RenderSetup(); + Entities_InitRespawnable( cycler_sprite_respawn ); } void env_glow( void ) { diff --git a/Source/Server/FuncBombTarget.c b/Source/Server/FuncBombTarget.c index 21aa4aae..2f1c7c75 100644 --- a/Source/Server/FuncBombTarget.c +++ b/Source/Server/FuncBombTarget.c @@ -24,6 +24,9 @@ func_bomb_target_touch ================= */ void func_bomb_target_touch( void ) { + if ( iBombPlanted == TRUE ) { + return; + } if ( ( other.classname == "player" ) && ( other.team == TEAM_T ) ) { other.fInBombZone = TRUE; // Note: this will be cleared every frame inside SV_RunClientCommand } diff --git a/Source/Server/FuncBreakable.c b/Source/Server/FuncBreakable.c index 493fd0fd..af2b60f5 100644 --- a/Source/Server/FuncBreakable.c +++ b/Source/Server/FuncBreakable.c @@ -170,9 +170,11 @@ void func_breakable( void ) { self.touch = func_breakable_touch; } + self.health = 100; + self.vUse = func_breakable_die; } - + func_wall(); func_breakable_respawn(); diff --git a/Source/Server/FuncBuyZone.c b/Source/Server/FuncBuyZone.c index bcf6dc00..357a217e 100644 --- a/Source/Server/FuncBuyZone.c +++ b/Source/Server/FuncBuyZone.c @@ -63,35 +63,36 @@ Called by StartFrame if we somehow got no buy zones */ void Game_CreateBuyZones( void ) { entity eFind; + entity eOld; if ( iBuyRestriction == BUY_T || iBuyRestriction == BUY_BOTH ) { eFind = findchain( classname, "info_player_deathmatch" ); - + eOld = self; while ( eFind ) { entity eBuyZoneT = spawn(); setorigin( eBuyZoneT, eFind.origin ); - eOld = self; self = eBuyZoneT; func_buyzone(); self.team = TEAM_T; - self = eOld; + eFind = eFind.chain; } + self = eOld; } if ( iBuyRestriction == BUY_CT || iBuyRestriction == BUY_BOTH ) { eFind = findchain( classname, "info_player_start" ); + eOld = self; while ( eFind ) { entity eBuyZoneCT = spawn(); setorigin( eBuyZoneCT, eFind.origin ); - - eOld = self; self = eBuyZoneCT; func_buyzone(); self.team = TEAM_CT; - self = eOld; + eFind = eFind.chain; } + self = eOld; } } diff --git a/Source/Server/FuncDoor.c b/Source/Server/FuncDoor.c index 5b3304b6..c5b0a258 100644 --- a/Source/Server/FuncDoor.c +++ b/Source/Server/FuncDoor.c @@ -160,7 +160,6 @@ void FuncDoor_MoveAway( void ) { self.state = STATE_UP; Entities_MoveToDestination ( self.pos2, self.speed, FuncDoor_Arrived ); - Entities_UseTargets(); } /* @@ -169,17 +168,20 @@ FuncDoor_Trigger ==================== */ void FuncDoor_Trigger( void ) { + // Only trigger stuff when we are done moving + if ( ( self.state == STATE_RAISED ) || ( self.state == STATE_LOWERED ) ) { + if ( self.delay > 0 ) { + Entities_UseTargets_Delay( self.delay ); + } else { + Entities_UseTargets(); + } + } + if ( ( self.state == STATE_UP ) || ( self.state == STATE_RAISED ) ){ FuncDoor_MoveBack(); return; } - if ( self.delay ) { - Entities_UseTargets_Delay( self.delay ); - } else { - Entities_UseTargets(); - } - FuncDoor_MoveAway(); } diff --git a/Source/Server/FuncHostageRescue.c b/Source/Server/FuncHostageRescue.c index 0188c89a..c9f9b464 100644 --- a/Source/Server/FuncHostageRescue.c +++ b/Source/Server/FuncHostageRescue.c @@ -36,7 +36,7 @@ void func_hostage_rescue_touch( void ) { remove( other.eTargetPoint ); } - eOld = self; + entity eOld = self; self = other; Entities_Remove(); self = eOld; @@ -44,6 +44,7 @@ void func_hostage_rescue_touch( void ) { if ( iHostagesRescued >= iHostagesMax ) { // TODO: Broadcast_Print: All Hostages have been rescued! Rules_RoundOver( TEAM_CT ); + iHostagesRescued = 0; } } } @@ -92,7 +93,7 @@ void Game_CreateRescueZones( void ) { entity eRescueZone = spawn(); setorigin( eRescueZone, eFind.origin ); - eOld = self; + entity eOld = self; self = eRescueZone; info_hostage_rescue(); self = eOld; diff --git a/Source/Server/Light.c b/Source/Server/Light.c index b4b1d363..5728dd47 100644 --- a/Source/Server/Light.c +++ b/Source/Server/Light.c @@ -18,17 +18,38 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +/* +================= +light + +Only thing this ent does, is allow the change of lightstyles. +You can use custom patterns, too. +================= +*/ +.string pattern; void light( void ) { static void light_toggle( void ) { if ( self.health == TRUE ) { lightstyle( self.style, "a" ); self.health = FALSE; } else { - lightstyle( self.style, "m" ); + lightstyle( self.style, self.pattern ); self.health = TRUE; } } + if ( !self.pattern ) { + self.pattern = "m"; + } + + if ( self.spawnflags & 1 ) { + lightstyle( self.style, "a" ); + self.health = FALSE; + } else { + lightstyle( self.style, self.pattern ); + self.health = TRUE; + } + self.vUse = light_toggle; - self.health = TRUE; + } diff --git a/Source/Server/Player.c b/Source/Server/Player.c index 360e0a79..9d373957 100644 --- a/Source/Server/Player.c +++ b/Source/Server/Player.c @@ -38,7 +38,8 @@ void Player_Death( void ) { if ( self.team == TEAM_T ) { iAlivePlayers_T--; - if ( iAlivePlayers_T == 0 ) { + // If the bomb has been planted, T deaths don't matter anymore + if ( iAlivePlayers_T == 0 && iBombPlanted == FALSE ) { Rules_RoundOver( TEAM_CT ); } } else if ( self.team == TEAM_CT ) { diff --git a/Source/Server/Rules.c b/Source/Server/Rules.c index 7759553a..1da948da 100644 --- a/Source/Server/Rules.c +++ b/Source/Server/Rules.c @@ -59,9 +59,10 @@ float Rules_BuyingPossible( void ) { // Loop through all players and respawn them void Rules_Restart( void ) { entity eFind = findchain( classname, "player" ); + entity eOld = self; while ( eFind ) { - eOld = self; + self = eFind; if ( self.health > 0 ) { @@ -70,10 +71,11 @@ void Rules_Restart( void ) { Spawn_CreateClient( self.fCharModel ); } - self = eOld; eFind = eFind.chain; } + self = eOld; + // Select a random Terrorist for the bomb thing if ( iBombZones > 0 ) { int iRandomT = ceil( random() * iAlivePlayers_T ); @@ -100,13 +102,15 @@ void Rules_Restart( void ) { // Respawn all the entities eFind = findchainfloat( fRespawns , TRUE ); + eOld = self; while ( eFind ) { - eOld = self; + self = eFind; Entities_Respawn(); - self = eOld; + eFind = eFind.chain; } + self = eOld; Timer_Begin( cvar( "mp_freezetime" ), GAME_FREEZE ); } diff --git a/Source/Server/Triggers.c b/Source/Server/Triggers.c index e8f7df18..a43b0924 100644 --- a/Source/Server/Triggers.c +++ b/Source/Server/Triggers.c @@ -32,14 +32,15 @@ void trigger_multiple( void ) { if ( self.killtarget ) { entity eFind = findchain( killtarget, self.target ); + entity eOld = self; while ( eFind ) { entity eRemoveMe = eFind; - eOld = self; self = eRemoveMe; Entities_Remove(); - self = eOld; + eFind = eFind.chain; } + self = eOld; } } diff --git a/Source/Server/progs.src b/Source/Server/progs.src index 643bd135..ca2c542f 100644 --- a/Source/Server/progs.src +++ b/Source/Server/progs.src @@ -1,6 +1,6 @@ #pragma target fte -#pragma progs_dat "../../Main/progs.dat" +#pragma progs_dat "../../cstrike/progs.dat" #includelist ../Builtins.h @@ -46,7 +46,6 @@ Timer.c EntHostage.c Entities.c Triggers.c -AmbientSound.c EnvObjects.c FuncBreakable.c FuncLadder.c @@ -56,6 +55,7 @@ FuncBuyZone.c FuncButton.c FuncDoor.c FuncDoorRotating.c +AmbientSound.c Light.c Main.c diff --git a/Source/Shared/WeaponC4Bomb.c b/Source/Shared/WeaponC4Bomb.c index 32a4f280..51f85edd 100644 --- a/Source/Shared/WeaponC4Bomb.c +++ b/Source/Shared/WeaponC4Bomb.c @@ -64,6 +64,7 @@ void WeaponC4BOMB_Drop( vector vBombPos ) { sound( self, CHAN_VOICE, "weapons/c4_explode1.wav", 1.0, ATTN_NONE ); Damage_Radius( self.origin, self.owner, 500, 1024 ); remove( self ); + iBombPlanted = FALSE; return; } @@ -90,7 +91,7 @@ void WeaponC4BOMB_Drop( vector vBombPos ) { sound( eBomb, CHAN_WEAPON, "weapons/c4_plant.wav", 1.0, ATTN_IDLE ); Radio_BroadcastMessage( RADIO_BOMBPL ); - + iBombPlanted = TRUE; Weapon_SwitchBest(); } #endif diff --git a/Source/Shared/WeaponUSP45.c b/Source/Shared/WeaponUSP45.c index 9d1fe5a4..0ec0e6e5 100644 --- a/Source/Shared/WeaponUSP45.c +++ b/Source/Shared/WeaponUSP45.c @@ -79,7 +79,6 @@ void WeaponUSP45_Draw( void ) { } Sound_Delayed( "weapons/usp_slideback.wav", 1.0, 0.5 ); - print( "EXECUTED TWICE?????\n" ); #endif }