VoIP 3D-Ingame Indicator added
This commit is contained in:
parent
59c637c6ea
commit
6678a562ae
3 changed files with 22 additions and 299 deletions
|
@ -91,11 +91,9 @@ void CSQC_Init(float apilevel, string enginename, float engineversion) {
|
|||
precache_model("models/rshell_big.mdl");
|
||||
precache_model("models/shotgunshell.mdl");
|
||||
|
||||
precache_pic( "gfx/vgui/icntlk_sv");
|
||||
precache_pic("gfx/vgui/icntlk_sv");
|
||||
precache_pic("gfx/vgui/icntlk_pl");
|
||||
precache_pic( sprintf( "overviews/%s.bmp", mapname ) );
|
||||
|
||||
precache_pic( "lambda.bmp");
|
||||
precache_pic( "logos/doug.bmp");
|
||||
|
||||
PARTICLE_SPARK = particleeffectnum("part_spark");
|
||||
PARTICLE_PIECES_BLACK = particleeffectnum("part_pieces_black");
|
||||
|
|
|
@ -173,6 +173,25 @@ void Player_Draw (void)
|
|||
self.angles[1] -= a;
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
Player_PreDraw
|
||||
=================
|
||||
*/
|
||||
void Player_DrawVoice(void)
|
||||
{
|
||||
if (getplayerkeyfloat(self.entnum - 1, INFOKEY_P_VOIPSPEAKING)) {
|
||||
vector vpos = self.origin + [0,0,48];
|
||||
makevectors(view_angles);
|
||||
R_BeginPolygon("gfx/vgui/icntlk_pl");
|
||||
R_PolygonVertex(vpos + v_right*16 - v_up*16, '1 1', [1,1,1], 1);
|
||||
R_PolygonVertex(vpos - v_right*16 - v_up*16, '0 1', [1,1,1], 1);
|
||||
R_PolygonVertex(vpos - v_right*16 + v_up*16, '0 0', [1,1,1], 1);
|
||||
R_PolygonVertex(vpos + v_right*16 + v_up*16, '1 0', [1,1,1], 1);
|
||||
R_EndPolygon();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
Player_PreDraw
|
||||
|
@ -188,6 +207,7 @@ float Player_PreDraw(void)
|
|||
Player_Gun_Offset();
|
||||
|
||||
if (autocvar_cl_thirdperson == TRUE || self.entnum != player_localentnum) {
|
||||
Player_DrawVoice();
|
||||
addentity(self);
|
||||
addentity(self.eGunModel);
|
||||
} else {
|
||||
|
|
|
@ -1,295 +0,0 @@
|
|||
/*
|
||||
Copyright 2016-2018 Marco "eukara" Hladik
|
||||
|
||||
MIT LICENSE
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation
|
||||
files (the "Software"), to deal in the Software without
|
||||
restriction, including without limitation the rights to use,
|
||||
copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
sell copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
enum {
|
||||
BUY_BOTH,
|
||||
BUY_CT,
|
||||
BUY_T,
|
||||
BUY_NEITHER
|
||||
};
|
||||
|
||||
/*
|
||||
=================
|
||||
Rules_BuyingPossible
|
||||
|
||||
Checks if it is possible for players to buy anything
|
||||
=================
|
||||
*/
|
||||
float Rules_BuyingPossible( void ) {
|
||||
if ( self.health <= 0 ) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if ( fGameState == GAME_ACTIVE ) {
|
||||
if ( ( ( autocvar_mp_roundtime * 60 ) - fGameTime ) > autocvar_mp_buytime ) {
|
||||
centerprint( self, sprintf( "%d seconds have passed...\nYou can't buy anything now!", autocvar_mp_buytime ) );
|
||||
self.fAttackFinished = time + 1.0;
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
if ( self.team == TEAM_VIP ) {
|
||||
centerprint( self, "You are the VIP...\nYou can't buy anything!\n" );
|
||||
self.fAttackFinished = time + 1.0;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if ( iBuyRestriction == BUY_NEITHER ) {
|
||||
centerprint( self, "Sorry, you aren't meant\nto be buying anything.\n" );
|
||||
self.fAttackFinished = time + 1.0;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if ( iBuyRestriction != BUY_BOTH ) {
|
||||
if ( iBuyRestriction == BUY_CT && self.team == TEAM_T ) {
|
||||
centerprint( self, "Terrorists aren't allowed to\nbuy anything on this map!\n" );
|
||||
self.fAttackFinished = time + 1.0;
|
||||
return FALSE;
|
||||
} else if ( iBuyRestriction == BUY_T && self.team == TEAM_CT ) {
|
||||
centerprint( self, "CTs aren't allowed to buy\nanything on this map!\n" );
|
||||
self.fAttackFinished = time + 1.0;
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
if ( self.fInBuyZone == FALSE ) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void Rules_MakeBomber( void ) {
|
||||
Weapon_AddItem( WEAPON_C4BOMB );
|
||||
centerprint( self, "You have the bomb!\nFind the target zone or DROP\nthe bomb for another Terrorist." );
|
||||
}
|
||||
|
||||
void Rules_MakeVIP( void ) {
|
||||
self.team = TEAM_VIP;
|
||||
Spawn_RespawnClient( self.team );
|
||||
centerprint( self, "You are the VIP\nMake your way to the safety zones!" );
|
||||
forceinfokey( self, "*dead", "2" );
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
Rules_Restart
|
||||
|
||||
Loop through all ents and handle them
|
||||
=================
|
||||
*/
|
||||
void Rules_Restart( int iWipe ) {
|
||||
iHostagesRescued = 0;
|
||||
|
||||
entity eOld = self;
|
||||
|
||||
// Spawn/Respawn everyone at their team position and give them $$$
|
||||
for ( entity eFind = world; ( eFind = find( eFind, classname, "player" ) ); ) {
|
||||
self = eFind;
|
||||
|
||||
if ( self.health > 0 && iWipe == FALSE ) {
|
||||
Spawn_RespawnClient( self.team );
|
||||
} else {
|
||||
Spawn_MakeSpectator();
|
||||
Spawn_CreateClient( self.fCharModel );
|
||||
}
|
||||
|
||||
if ( iWipe == FALSE ) {
|
||||
Money_GiveTeamReward();
|
||||
} else {
|
||||
self.fMoney = autocvar_mp_startmoney;
|
||||
}
|
||||
}
|
||||
|
||||
// Clear the corpses/items
|
||||
for ( entity eFind = world; ( eFind = find( eFind, classname, "remove_me" ) ); ) {
|
||||
remove( eFind );
|
||||
}
|
||||
|
||||
// Find the bombs. Destory them!
|
||||
for ( entity eFind = world; ( eFind = find( eFind, classname, "c4bomb" ) ); ) {
|
||||
remove( eFind );
|
||||
}
|
||||
|
||||
// Select a random Terrorist for the bomb, if needed
|
||||
if ( iBombZones > 0 ) {
|
||||
int iRandomT = floor( random( 1, (float)iAlivePlayers_T + 1 ) );
|
||||
int iPickT = 0;
|
||||
|
||||
for ( entity eFind = world; ( eFind = find( eFind, classname, "player" ) ); ) {
|
||||
if ( eFind.team == TEAM_T ) {
|
||||
iPickT++;
|
||||
|
||||
if ( iPickT == iRandomT ) {
|
||||
self = eFind;
|
||||
Rules_MakeBomber();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If there is a VIP, select a random CT to be it
|
||||
if ( iVIPZones > 0 ) {
|
||||
int iRandomCT = floor( random( 1, (float)iAlivePlayers_CT + 1 ) );
|
||||
int iPickCT = 0;
|
||||
|
||||
for ( entity eFind = world; ( eFind = find( eFind, classname, "player" ) ); ) {
|
||||
if ( eFind.team == TEAM_CT ) {
|
||||
iPickCT++;
|
||||
if ( iPickCT == iRandomCT ) {
|
||||
self = eFind;
|
||||
Rules_MakeVIP();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Respawn all the entities
|
||||
for ( entity eFind = world; ( eFind = findfloat( eFind, fRespawns, TRUE ) ); ) {
|
||||
self = eFind;
|
||||
Entities_Respawn();
|
||||
}
|
||||
|
||||
self = eOld;
|
||||
|
||||
Timer_Begin( autocvar_mp_freezetime, GAME_FREEZE );
|
||||
Money_ResetTeamReward();
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
Rules_RoundOver
|
||||
|
||||
This happens whenever an objective is complete or time is up
|
||||
=================
|
||||
*/
|
||||
void Rules_RoundOver( int iTeamWon, int iMoneyReward, float fSilent ) {
|
||||
|
||||
if ( fGameState != GAME_ACTIVE ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( iTeamWon == TEAM_T ) {
|
||||
if ( fSilent == FALSE ) {
|
||||
Radio_BroadcastMessage( RADIO_TERWIN );
|
||||
}
|
||||
iWon_T++;
|
||||
|
||||
// FIXME: Calculate the proper loss values
|
||||
Money_QueTeamReward( TEAM_CT, 1400 );
|
||||
} else if ( iTeamWon == TEAM_CT ) {
|
||||
if ( fSilent == FALSE ) {
|
||||
Radio_BroadcastMessage( RADIO_CTWIN );
|
||||
}
|
||||
iWon_CT++;
|
||||
// FIXME: Calculate the proper loss values
|
||||
Money_QueTeamReward( TEAM_T, 1400 );
|
||||
} else {
|
||||
if ( fSilent == FALSE ) {
|
||||
Radio_BroadcastMessage( RADIO_ROUNDDRAW );
|
||||
}
|
||||
}
|
||||
|
||||
Money_QueTeamReward( iTeamWon, iMoneyReward );
|
||||
Timer_Begin( 5, GAME_END); // Round is over, 5 seconds til a new round starts
|
||||
|
||||
iBombPlanted = 0;
|
||||
iRounds++;
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
Rules_TimeOver
|
||||
|
||||
Whenever mp_roundtime was being counted down to 0
|
||||
=================
|
||||
*/
|
||||
void Rules_TimeOver( void ) {
|
||||
if ( iVIPZones > 0 ) {
|
||||
Rules_RoundOver( TEAM_T, 3250, FALSE );
|
||||
} else if ( iBombZones > 0 ) {
|
||||
Rules_RoundOver( TEAM_CT, 3250, FALSE );
|
||||
} else if ( iHostagesMax > 0 ) {
|
||||
// TODO: Broadcast_Print: Hostages have not been rescued!
|
||||
Rules_RoundOver( TEAM_T, 3250, FALSE );
|
||||
} else {
|
||||
Rules_RoundOver( 0, 0, FALSE );
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
Rules_SwitchTeams
|
||||
|
||||
Happens rarely
|
||||
=================
|
||||
*/
|
||||
void Rules_SwitchTeams( void ) {
|
||||
int iCTW, iTW;
|
||||
|
||||
for ( entity eFind = world; ( eFind = find( eFind, classname, "player" ) ); ) {
|
||||
if ( eFind.team == TEAM_CT ) {
|
||||
eFind.team = TEAM_T;
|
||||
eFind.fCharModel -= 4;
|
||||
} else if ( eFind.team == TEAM_T ) {
|
||||
eFind.team = TEAM_CT;
|
||||
eFind.fCharModel += 4;
|
||||
}
|
||||
forceinfokey( eFind, "*team", ftos( eFind.team ) );
|
||||
}
|
||||
|
||||
iCTW = iWon_CT;
|
||||
iTW = iWon_T;
|
||||
|
||||
iWon_T = iCTW;
|
||||
iWon_CT = iTW;
|
||||
|
||||
iCTW = iAlivePlayers_CT;
|
||||
iTW = iAlivePlayers_T;
|
||||
|
||||
iAlivePlayers_CT = iTW;
|
||||
iAlivePlayers_T = iCTW;
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
SPAWN: info_map_parameters
|
||||
|
||||
Let's map authors decide who can buy stuff and who CAN'T.
|
||||
Also allows people to set the bomb placing radius incase you want to use info_bomb_target.
|
||||
=================
|
||||
*/
|
||||
.float buying;
|
||||
.float bombradius;
|
||||
void info_map_parameters( void ) {
|
||||
if ( self.bombradius ) {
|
||||
iBombRadius = self.bombradius;
|
||||
}
|
||||
if ( self.buying ) {
|
||||
iBuyRestriction = self.buying;
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue