Fixed camera angle when spawning as observer the first time
Fixed behaviour of the camera being forced to the next trigger_camera upon death
This commit is contained in:
parent
a15b5f606f
commit
f89fb231d3
5 changed files with 59 additions and 18 deletions
|
@ -50,6 +50,7 @@ void PutClientInServer( void ) {
|
|||
entity eTarget = world;
|
||||
|
||||
Spawn_MakeSpectator();
|
||||
Spawn_ObserverCam();
|
||||
|
||||
// Because we don't want to reset these when we die
|
||||
self.fMoney = cvar( "mp_startmoney" );
|
||||
|
|
|
@ -29,6 +29,7 @@ void Player_Death( void ) {
|
|||
setorigin( eCorpse, self.origin );
|
||||
setmodel( eCorpse, self.model );
|
||||
eCorpse.angles = self.angles;
|
||||
eCorpse.movetype = MOVETYPE_BOUNCE;
|
||||
eCorpse.frame = 93; // TODO: Pick the right frame
|
||||
|
||||
Spawn_MakeSpectator();
|
||||
|
|
|
@ -57,6 +57,25 @@ entity Spawn_FindSpawnPoint( float fTeam ) {
|
|||
return eSpot;
|
||||
}
|
||||
|
||||
void Spawn_ObserverCam( void ) {
|
||||
// Go find a camera if we aren't dead
|
||||
entity eCamera = find ( world, classname, "trigger_camera" );
|
||||
|
||||
if ( eCamera ) {
|
||||
self.origin = eCamera.origin;
|
||||
|
||||
if ( eCamera.target ) {
|
||||
entity eTarget = find( world, targetname, eCamera.target );
|
||||
if ( eTarget ) {
|
||||
self.angles = vectoangles( eTarget.origin - eCamera.origin );
|
||||
self.angles_x *= -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
self.fixangle = TRUE;
|
||||
}
|
||||
|
||||
void Spawn_RespawnClient( float fTeam ) {
|
||||
entity eSpawn;
|
||||
forceinfokey( self, "*spectator", "0" ); // Make sure we are known as a spectator
|
||||
|
@ -90,6 +109,7 @@ void Spawn_CreateClient( float fCharModel ) {
|
|||
// What team are we on - 0= Spectator, < 5 Terrorists, CT rest
|
||||
if( fCharModel == 0 ) {
|
||||
PutClientInServer();
|
||||
Spawn_ObserverCam();
|
||||
return;
|
||||
} else if( fCharModel < 5 ) {
|
||||
self.team = TEAM_T;
|
||||
|
@ -119,7 +139,6 @@ void Spawn_CreateClient( float fCharModel ) {
|
|||
|
||||
// This is called on connect and whenever a player dies
|
||||
void Spawn_MakeSpectator( void ) {
|
||||
entity eSpawn;
|
||||
self.classname = "spectator";
|
||||
|
||||
self.health = 0;
|
||||
|
@ -136,15 +155,6 @@ void Spawn_MakeSpectator( void ) {
|
|||
|
||||
forceinfokey( self, "*spectator", "1" ); // Make sure we are known as a spectator
|
||||
|
||||
// Go find a camera if we aren't dead
|
||||
eSpawn = find (world, classname, "trigger_camera");
|
||||
|
||||
if ( eSpawn ) {
|
||||
self.origin = eSpawn.origin + '0 0 1';
|
||||
self.angles = eSpawn.angles;
|
||||
//self.angles_x = eSpawn.angles_x * -1;
|
||||
}
|
||||
|
||||
self.fixangle = TRUE;
|
||||
|
||||
// Clear all the ammo stuff
|
||||
|
@ -195,4 +205,6 @@ void info_player_start( void ) {
|
|||
void info_player_deathmatch( void ) {
|
||||
}
|
||||
|
||||
void info_target( void ) { }
|
||||
void info_target( void ) {
|
||||
setorigin( self, self.origin );
|
||||
}
|
||||
|
|
|
@ -1,3 +1,23 @@
|
|||
/*
|
||||
OpenCS Project
|
||||
Copyright (C) 2015 Marco "eukara" Hladik
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
// This is what they use...
|
||||
.string killtarget;
|
||||
.float wait;
|
||||
|
@ -81,16 +101,16 @@ trigger_camera
|
|||
*/
|
||||
void trigger_camera( void ) {
|
||||
static void trigger_camera_use( void ) {
|
||||
if ( self.target ) {
|
||||
entity eTarget = find( world, targetname, self.target );
|
||||
if ( eTarget ) {
|
||||
self.angles = vectoangles( eTarget.origin - self.origin );
|
||||
self.angles_x *= -1;
|
||||
}
|
||||
}
|
||||
Client_TriggerCamera( eActivator, self.origin, self.angles, self.wait );
|
||||
}
|
||||
|
||||
entity eTarget;
|
||||
eTarget = find( world, targetname, self.target );
|
||||
if( self.target ) {
|
||||
self.angles = vectoangles( eTarget.origin - self.origin );
|
||||
self.angles_x *= -1;
|
||||
}
|
||||
|
||||
self.vUse = trigger_camera_use;
|
||||
}
|
||||
|
||||
|
|
|
@ -138,5 +138,12 @@ void WeaponC4BOMB_PrimaryFire( void ) {
|
|||
}
|
||||
#else
|
||||
View_PlayAnimation( ANIM_C4_ENTERCODE );
|
||||
Sound_Delayed( "weapons/c4_click.wav", 1.0, 1.18 );
|
||||
Sound_Delayed( "weapons/c4_click.wav", 1.0, 1.42 );
|
||||
Sound_Delayed( "weapons/c4_click.wav", 1.0, 1.63 );
|
||||
Sound_Delayed( "weapons/c4_click.wav", 1.0, 1.88 );
|
||||
Sound_Delayed( "weapons/c4_click.wav", 1.0, 2.12 );
|
||||
Sound_Delayed( "weapons/c4_click.wav", 1.0, 2.36 );
|
||||
Sound_Delayed( "weapons/c4_click.wav", 1.0, 2.55 );
|
||||
#endif
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue