Fixed a possible problem with hostages being rescued... multiple times in one frame.
This commit is contained in:
parent
581190b98f
commit
b76d39796c
17 changed files with 278 additions and 7 deletions
BIN
Source/Client/.Overview.c.un~
Executable file
BIN
Source/Client/.Overview.c.un~
Executable file
Binary file not shown.
|
@ -45,6 +45,8 @@ var int autocvar_v_lefthanded = FALSE;
|
|||
var int autocvar_cl_thirdperson = FALSE;
|
||||
var int autocvar_cl_radar = 1;
|
||||
|
||||
var string autocvar_cl_logofile = "lambda";
|
||||
|
||||
// Particle stuff
|
||||
var float PARTICLE_SPARK;
|
||||
var float PARTICLE_PIECES_BLACK;
|
||||
|
|
|
@ -80,8 +80,20 @@ void CSQC_Ent_Update( float flIsNew ) {
|
|||
self.origin_z = readcoord();
|
||||
|
||||
Effect_AnimatedSprite( self.origin, readfloat(), readfloat(), readfloat(), readfloat(), readfloat() );
|
||||
} else if ( fEntType == ENT_SPRAY ) {
|
||||
self.origin_x = readcoord();
|
||||
self.origin_y = readcoord();
|
||||
self.origin_z = readcoord();
|
||||
|
||||
self.angles_x = readcoord();
|
||||
self.angles_y = readcoord();
|
||||
self.angles_z = readcoord();
|
||||
|
||||
self.model = sprintf( "logos/%s.bmp" ,getplayerkeyvalue( readbyte() - 1, "logo" ) );
|
||||
shaderforname( self.model, sprintf("{\npolygonOffset\n{\nmap %s\n}\n}\n", self.model ) );
|
||||
self.predraw = Effect_Spraypaint;
|
||||
self.drawmask = MASK_ENGINE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -69,6 +69,8 @@ void CSQC_Init(float apilevel, string enginename, float engineversion) {
|
|||
precache_sound( "debris/bustconcrete1.wav" );
|
||||
precache_sound( "debris/bustconcrete2.wav" );
|
||||
precache_sound( "debris/bustceiling.wav" );
|
||||
precache_model( "sprites/iplayerred.spr" );
|
||||
precache_model( "sprites/iplayerblue.spr" );
|
||||
precache_model( "sprites/iplayervip.spr" );
|
||||
precache_model( "sprites/ihostage.spr" );
|
||||
|
||||
|
@ -80,6 +82,8 @@ void CSQC_Init(float apilevel, string enginename, float engineversion) {
|
|||
precache_pic( "gfx/vgui/icntlk_sv" );
|
||||
precache_pic( sprintf( "overviews/%s.bmp", mapname ) );
|
||||
|
||||
precache_pic( "logos/lambda.bmp" );
|
||||
|
||||
for ( int i = 0; i < ( CS_WEAPON_COUNT - 1 ); i++ ) {
|
||||
precache_model( sViewModels[ i ] );
|
||||
}
|
||||
|
@ -96,6 +100,8 @@ void CSQC_Init(float apilevel, string enginename, float engineversion) {
|
|||
FONT_16 = loadfont( "16", "gfx/conchars_16", "16", -1 );
|
||||
|
||||
SHADER_CULLED = shaderforname( "mirror_cull" );
|
||||
|
||||
localcmd( sprintf( "setinfo logo %s\n", autocvar_cl_logofile ) );
|
||||
|
||||
Radio_InitSounds();
|
||||
|
||||
|
|
172
Source/Client/Overview.c~
Executable file
172
Source/Client/Overview.c~
Executable file
|
@ -0,0 +1,172 @@
|
|||
/*
|
||||
FreeCS Project
|
||||
Copyright (C) 2016, 2017 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
The overview system was meant to support
|
||||
more layers and so on. Never actually used.
|
||||
Probably seemed impractical, feel free to make this
|
||||
parse layers etc. properly though.
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
float fZoom;
|
||||
vector vOrigin;
|
||||
int iRotated;
|
||||
float fHeight;
|
||||
string sImagePath;
|
||||
float fCameraHeight;
|
||||
vector vVert1;
|
||||
vector vVert2;
|
||||
vector vVert3;
|
||||
vector vVert4;
|
||||
} overview_t;
|
||||
|
||||
overview_t ovMap;
|
||||
|
||||
/*
|
||||
=================
|
||||
Overview_Init
|
||||
|
||||
Initializes the globals and whatnot
|
||||
=================
|
||||
*/
|
||||
void Overview_Init( void ) {
|
||||
int *iImageSrc;
|
||||
int iImageWidth = 0;
|
||||
int iImageHeight = 0;
|
||||
int iImageCount = 0;
|
||||
string sTemp;
|
||||
|
||||
ovMap.fZoom = 1.0f;
|
||||
ovMap.vOrigin = '0 0 0';
|
||||
ovMap.iRotated = FALSE;
|
||||
|
||||
filestream fOverview = fopen( sprintf( "overviews/%s.txt", mapname ), FILE_READ );
|
||||
if ( fOverview != -1 ) {
|
||||
for ( int i = 0;; i++ ) {
|
||||
sTemp = fgets( fOverview );
|
||||
if not ( sTemp ) {
|
||||
break;
|
||||
}
|
||||
|
||||
tokenize( sTemp );
|
||||
if ( strtolower( argv( 0 ) ) == "zoom" ) {
|
||||
ovMap.fZoom = stof( argv( 1 ) );
|
||||
} else if ( strtolower( argv( 0 ) ) == "origin" ) {
|
||||
ovMap.vOrigin = [ stof( argv( 1 ) ), stof( argv( 2 ) ), stof( argv( 3 ) ) ];
|
||||
} else if ( strtolower( argv( 0 ) ) == "rotated" ) {
|
||||
ovMap.iRotated = (int)stof( argv( 1 ) );
|
||||
} else if ( strtolower( argv( 0 ) ) == "height" ) {
|
||||
ovMap.fHeight = stof( argv( 1 ) );
|
||||
}
|
||||
}
|
||||
fclose( fOverview );
|
||||
} else {
|
||||
print( sprintf( "[OVERVIEW] Couldn't load overviews/%s.txt\n", mapname ) );
|
||||
ovMap.sImagePath = __NULL__;
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ovMap.iRotated == TRUE ) {
|
||||
ovMap.vVert1 = ovMap.vOrigin -( ( 4096/ovMap.fZoom ) * '1 0.75 0' );
|
||||
ovMap.vVert4 = ovMap.vOrigin + ( 4096/ovMap.fZoom ) * '1 0.75 0';
|
||||
ovMap.vVert2 = [ ovMap.vVert1[0], ovMap.vVert4[1] ] ;
|
||||
ovMap.vVert3 = [ ovMap.vVert4[0], ovMap.vVert1[1] ] ;
|
||||
} else {
|
||||
ovMap.vVert1 = ovMap.vOrigin -( ( 4096/ovMap.fZoom ) * '0.75 1 0' );
|
||||
ovMap.vVert4 = ovMap.vOrigin + ( 4096/ovMap.fZoom ) * '0.75 1 0';
|
||||
ovMap.vVert2 = [ ovMap.vVert1[0], ovMap.vVert4[1] ] ;
|
||||
ovMap.vVert3 = [ ovMap.vVert4[0], ovMap.vVert1[1] ] ;
|
||||
}
|
||||
|
||||
ovMap.fCameraHeight = fabs( 4096/ovMap.fZoom );
|
||||
|
||||
ovMap.sImagePath = "overview";
|
||||
shaderforname( ovMap.sImagePath, sprintf("{\n{\nprogram default2d\nmap $rt:%s\n}\n}\n", ovMap.sImagePath ) );
|
||||
|
||||
// Read the image and get rid of the burning green
|
||||
iImageSrc = r_readimage( sprintf( "overviews/%s.bmp", mapname ), iImageWidth, iImageHeight );
|
||||
if ( iImageSrc != __NULL__ ) {
|
||||
for ( int i = 0; i < ( iImageWidth * iImageHeight ); i++ ) {
|
||||
if ( iImageSrc[ i ] == 0xff00ff00i ) {
|
||||
iImageSrc[ i ] = 0x00000000i;
|
||||
}
|
||||
}
|
||||
r_uploadimage( ovMap.sImagePath, iImageWidth, iImageHeight, iImageSrc );
|
||||
memfree( iImageSrc );
|
||||
}
|
||||
}
|
||||
|
||||
void Overview_DrawLayer( void ) {
|
||||
if ( ovMap.iRotated == TRUE ) {
|
||||
R_BeginPolygon( ovMap.sImagePath );
|
||||
R_PolygonVertex( [ ovMap.vVert4[0], ovMap.vVert4[1], ovMap.fHeight ], '1 0', '1 1 1', 1.0f ); // Top Left
|
||||
R_PolygonVertex( [ ovMap.vVert3[0], ovMap.vVert3[1], ovMap.fHeight ], '1 1', '1 1 1', 1.0f ); // Top Right
|
||||
R_PolygonVertex( [ ovMap.vVert1[0], ovMap.vVert1[1], ovMap.fHeight ], '0 1', '1 1 1', 1.0f ); // Bottom right
|
||||
R_PolygonVertex( [ ovMap.vVert2[0], ovMap.vVert2[1], ovMap.fHeight ], '0 0', '1 1 1', 1.0f ); // Bottom left
|
||||
R_EndPolygon();
|
||||
} else {
|
||||
R_BeginPolygon( ovMap.sImagePath );
|
||||
R_PolygonVertex( [ ovMap.vVert4[0], ovMap.vVert4[1], ovMap.fHeight ], '0 0', '1 1 1', 1.0f ); // Top Left
|
||||
R_PolygonVertex( [ ovMap.vVert3[0], ovMap.vVert3[1], ovMap.fHeight ], '1 0', '1 1 1', 1.0f ); // Top Right
|
||||
R_PolygonVertex( [ ovMap.vVert1[0], ovMap.vVert1[1], ovMap.fHeight ], '1 1', '1 1 1', 1.0f ); // Bottom right
|
||||
R_PolygonVertex( [ ovMap.vVert2[0], ovMap.vVert2[1], ovMap.fHeight ], '0 1', '1 1 1', 1.0f ); // Bottom left
|
||||
R_EndPolygon();
|
||||
}
|
||||
|
||||
for ( entity eFind = world; ( eFind = find( eFind, classname, "player" ) ); ) {
|
||||
if ( getplayerkeyvalue( eFind.entnum - 1, "*team" ) == "1" ) {
|
||||
R_BeginPolygon( "sprites/iplayerred.spr_0.tga" );
|
||||
} else {
|
||||
if ( getplayerkeyvalue( eFind.entnum - 1, "*dead" ) == "2" ) {
|
||||
R_BeginPolygon( "sprites/iplayervip.spr_0.tga" );
|
||||
} else {
|
||||
R_BeginPolygon( "sprites/iplayerblue.spr_0.tga" );
|
||||
}
|
||||
}
|
||||
R_PolygonVertex( [ eFind.absmax_x + 16, eFind.absmin_y - 16, ovMap.fHeight + 16 ], '1 0', '1 1 1', 1.0f ); // Top Right
|
||||
R_PolygonVertex( [ eFind.absmin_x - 16, eFind.absmin_y - 16, ovMap.fHeight + 16 ], '0 0', '1 1 1', 1.0f ); // Top left
|
||||
R_PolygonVertex( [ eFind.absmin_x - 16, eFind.absmax_y + 16, ovMap.fHeight + 16 ], '0 1', '1 1 1', 1.0f ); // Bottom left
|
||||
R_PolygonVertex( [ eFind.absmax_x + 16, eFind.absmax_y + 16, ovMap.fHeight + 16 ], '1 1', '1 1 1', 1.0f ); // Bottom right
|
||||
R_EndPolygon();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
Overview_Draw
|
||||
|
||||
Draw one of two types of overviews.
|
||||
This is for spectators.
|
||||
=================
|
||||
*/
|
||||
void Overview_Draw( void ) {
|
||||
if ( ovMap.sImagePath == __NULL__ ) {
|
||||
return;
|
||||
}
|
||||
|
||||
drawfill( vVideoMins, vVideoResolution, '0 0 0', 1.0f, 0 );
|
||||
|
||||
Overview_DrawLayer();
|
||||
|
||||
makevectors( view_angles );
|
||||
setproperty( VF_ORIGIN, ovMap.vOrigin + ( v_forward * -ovMap.fCameraHeight ) ) ;
|
||||
}
|
|
@ -44,7 +44,7 @@ vector VGUI_Scores_DrawTeam( vector vPos, float fTeam ) {
|
|||
|
||||
// Player loop, this one goes through ALL players but only prints the one from fTeam
|
||||
for ( int i = -1; i > -32; i-- ) {
|
||||
if ( stof( getplayerkeyvalue( i, "*team" ) ) == fTeam ) {
|
||||
if ( stof( getplayerkeyvalue( i, "*team" ) ) == fTeam ) {
|
||||
if ( getplayerkeyvalue( i, "name" ) ) {
|
||||
vColor = HUD_GetChatColor( fTeam );
|
||||
|
||||
|
|
7
Source/FreeCS-CE.prj
Normal file → Executable file
7
Source/FreeCS-CE.prj
Normal file → Executable file
|
@ -26,7 +26,7 @@
|
|||
<localfile path="C:\cygwin\home\User\FreeCS\Source\Client\VGUITeamSelect.c" />
|
||||
<localfile path="C:\cygwin\home\User\FreeCS\Source\Client\View.c" />
|
||||
</category>
|
||||
<category name="Server" expanded="no">
|
||||
<category name="Server" expanded="yes">
|
||||
<localfile path="C:\cygwin\home\User\FreeCS\Source\Server\AmbientSound.c" />
|
||||
<localfile path="C:\cygwin\home\User\FreeCS\Source\Server\Ammo.c" />
|
||||
<localfile path="C:\cygwin\home\User\FreeCS\Source\Server\ArmouryEntity.c" />
|
||||
|
@ -75,7 +75,7 @@
|
|||
<localfile path="C:\cygwin\home\User\FreeCS\Source\Menu\Objects.c" />
|
||||
<localfile path="C:\cygwin\home\User\FreeCS\Source\Menu\progs.src" />
|
||||
</category>
|
||||
<category name="Shared" expanded="no">
|
||||
<category name="Shared" expanded="yes">
|
||||
<localfile path="C:\cygwin\home\User\FreeCS\Source\Shared\Animations.c" />
|
||||
<localfile path="C:\cygwin\home\User\FreeCS\Source\Shared\BaseGun.c" />
|
||||
<localfile path="C:\cygwin\home\User\FreeCS\Source\Shared\BaseMelee.c" />
|
||||
|
@ -117,6 +117,7 @@
|
|||
</project>
|
||||
|
||||
<workspace version="Crimson Editor 3.60">
|
||||
<localfile path="C:\cygwin\home\User\FreeCS\Source\Client\Defs.h" linenum="46" placement="2:3:-1:-1:-4:-23:22:22:894:458" />
|
||||
<localfile path="C:\cygwin\home\User\FreeCS\Source\Shared\Effects.c" linenum="1" placement="0:1:-1:-1:-4:-23:22:22:894:458" />
|
||||
<localfile path="C:\Users\User\Dropbox\The Wastes Build\wastes\scripts\weapons.shader" linenum="499" placement="2:3:-1:-1:-4:-23:22:22:894:458" />
|
||||
</workspace>
|
||||
|
||||
|
|
|
@ -77,7 +77,8 @@ enum {
|
|||
enum {
|
||||
ENT_PLAYER = 1,
|
||||
ENT_AMBIENTSOUND,
|
||||
ENT_SPRITE
|
||||
ENT_SPRITE,
|
||||
ENT_SPRAY
|
||||
};
|
||||
|
||||
enum {
|
||||
|
|
|
@ -31,6 +31,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
var vector vVideoSize;
|
||||
var vector vMenuOffset;
|
||||
var vector autocvar_menu_fgcolor = '1 0.59 0.19';
|
||||
var string autocvar_cl_logofile = "lambda";
|
||||
|
||||
var vector vMousePos;
|
||||
var float fInputKeyCode;
|
||||
|
|
|
@ -71,7 +71,7 @@ Called when a spectator leaves the game
|
|||
=================
|
||||
*/
|
||||
void SpectatorDisconnect( void ) {
|
||||
|
||||
Effect_RemoveSpray( self );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -94,6 +94,8 @@ void ClientDisconnect( void ) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
Effect_RemoveSpray( self );
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -27,6 +27,9 @@ void func_hostage_rescue_touch( void ) {
|
|||
if ( ( other.classname == "player" ) && ( other.team == TEAM_CT ) ) {
|
||||
other.fInHostageZone = TRUE; // Note: this will be cleared every frame inside SV_RunClientCommand
|
||||
} else if ( other.classname == "hostage_entity" ) {
|
||||
if ( self.solid == SOLID_NOT ) {
|
||||
return;
|
||||
}
|
||||
|
||||
Radio_BroadcastMessage( RADIO_RESCUED );
|
||||
iHostagesRescued++;
|
||||
|
|
|
@ -67,5 +67,9 @@ void Input_Handle( void ) {
|
|||
Weapon_Release();
|
||||
}
|
||||
|
||||
if ( self.impulse == 201 ) {
|
||||
Effect_Spraypaint();
|
||||
}
|
||||
|
||||
self.impulse = 0;
|
||||
}
|
||||
|
|
|
@ -269,6 +269,7 @@ void worldspawn( void ) {
|
|||
precache_sound( "player/headshot1.wav" );
|
||||
precache_sound( "player/headshot2.wav" );
|
||||
precache_sound( "player/headshot3.wav" );
|
||||
precache_sound( "player/sprayer.wav" );
|
||||
|
||||
precache_sound( "items/9mmclip1.wav" );
|
||||
precache_sound( "items/tr_kevlar.wav" );
|
||||
|
|
|
@ -18,6 +18,72 @@ along with this program; if not, write to the Free Software
|
|||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
|
||||
#ifdef SSQC
|
||||
void Effect_RemoveSpray( entity eOwner ) {
|
||||
for ( entity eFind = world; ( eFind = find( eFind, classname, "spray" ) ); ) {
|
||||
if ( eFind.owner == self ) {
|
||||
remove( eFind );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Effect_Spraypaint( void ) {
|
||||
static float Effect_Spraypaint_Send( entity ePVSEnt, float fChanged ) {
|
||||
WriteByte( MSG_ENTITY, ENT_SPRAY );
|
||||
WriteCoord( MSG_ENTITY, self.origin_x );
|
||||
WriteCoord( MSG_ENTITY, self.origin_y );
|
||||
WriteCoord( MSG_ENTITY, self.origin_z );
|
||||
WriteCoord( MSG_ENTITY, self.angles_x );
|
||||
WriteCoord( MSG_ENTITY, self.angles_y );
|
||||
WriteCoord( MSG_ENTITY, self.angles_z );
|
||||
WriteByte( MSG_ENTITY, num_for_edict( self.owner ) );
|
||||
return TRUE;
|
||||
}
|
||||
vector vSrc;
|
||||
vector vEnd;
|
||||
makevectors( self.v_angle );
|
||||
|
||||
if ( self.health <= 0 ) {
|
||||
return;
|
||||
}
|
||||
|
||||
Effect_RemoveSpray( self );
|
||||
|
||||
vSrc = self.origin + self.view_ofs;
|
||||
vEnd = vSrc + v_forward * 128;
|
||||
traceline( vSrc, vEnd, 0, self );
|
||||
|
||||
// Found a wall
|
||||
if ( trace_fraction != 1.0f ) {
|
||||
entity eSpray = spawn();
|
||||
eSpray.classname = "spray";
|
||||
eSpray.owner = self;
|
||||
eSpray.solid = SOLID_NOT;
|
||||
setorigin( eSpray, trace_endpos );
|
||||
|
||||
// Align it
|
||||
vector vSprayAngles = self.angles;
|
||||
vSprayAngles_x *= -1;
|
||||
makevectors( vSprayAngles );
|
||||
vector vCoplanar = v_forward - ( v_forward * trace_plane_normal ) * trace_plane_normal;
|
||||
eSpray.angles = vectoangles( vCoplanar, trace_plane_normal );
|
||||
|
||||
eSpray.SendEntity = Effect_Spraypaint_Send;
|
||||
eSpray.SendFlags = 1;
|
||||
sound( self, CHAN_VOICE, "player/sprayer.wav", 1.0, ATTN_NORM );
|
||||
}
|
||||
#else
|
||||
float Effect_Spraypaint( void ) {
|
||||
makevectors( self.angles );
|
||||
// Temporary string, will getinfo from player later
|
||||
adddecal( self.model, self.origin, v_up / 64, v_right / 64, '1 1 1', 1.0f );
|
||||
addentity( self );
|
||||
return PREDRAW_NEXT;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void Effect_CreateExplosion( vector vPos ) {
|
||||
#ifdef SSQC
|
||||
vPos_z += 48;
|
||||
|
|
0
freecs/default.cfg
Normal file → Executable file
0
freecs/default.cfg
Normal file → Executable file
BIN
freecs/menu.dat
BIN
freecs/menu.dat
Binary file not shown.
BIN
freecs/progs.dat
Normal file → Executable file
BIN
freecs/progs.dat
Normal file → Executable file
Binary file not shown.
Loading…
Reference in a new issue