Added spectator HUD and fix for our new observer/spectator implementation

This commit is contained in:
Marco Cawthorne 2021-03-24 07:52:52 +01:00
parent 38f985e3a2
commit a310454e98
7 changed files with 267 additions and 9 deletions

View file

@ -681,6 +681,11 @@ HUD_Draw(void)
}
/* specatator main entry */
string g_specmodes[] = {
"Free Camera",
"Third Person",
"First Person"
};
void
HUD_DrawSpectator(void)
{
@ -689,4 +694,20 @@ HUD_DrawSpectator(void)
Obituary_Draw();
HUD_DrawTimer(1);
Textmenu_Draw();
spectator spec = (spectator)pSeat->m_ePlayer;
drawfont = FONT_20;
vector vecPos;
string strText;
strText = sprintf("Tracking: %s", getplayerkeyvalue(spec.spec_ent - 1, "name"));
vecPos[0] = g_hudmins[0] + (g_hudres[0] / 2) - (stringwidth(strText, TRUE, [20,20]) / 2);
vecPos[1] = g_hudmins[1] + g_hudres[1] - 60;
drawstring(vecPos, strText, [20,20], [1,1,1], 1.0f, DRAWFLAG_ADDITIVE);
strText = sprintf("Mode: %s", g_specmodes[spec.spec_mode]);
vecPos[0] = g_hudmins[0] + (g_hudres[0] / 2) - (stringwidth(strText, TRUE, [20,20]) / 2);
vecPos[1] = g_hudmins[1] + g_hudres[1] - 40;
drawstring(vecPos, strText, [20,20], [1,1,1], 1.0f, DRAWFLAG_ADDITIVE);
}

View file

@ -115,7 +115,8 @@ ClientGame_Init(float apilevel, string enginename, float engineversion)
void
ClientGame_InitDone(void)
{
Textmenu_Call("TEAM_SELECT");
if (getplayerkeyfloat(player_localnum, "*spec") == 2)
Textmenu_Call("TEAM_SELECT");
}
void

View file

@ -143,8 +143,11 @@ CSEv_BuyEquipment_f(float fUtil)
Sound_Play(pl, CHAN_ITEM, "buy.kevlar");
break;
case 1:
if (pl.g_items & ITEM_HELMET && pl.armor >= 0)
/* if we already have a helmet, buy just armor */
if (pl.g_items & ITEM_HELMET && pl.armor >= 0) {
CSEv_BuyEquipment_f(0);
return;
}
pl.armor = 100;
pl.g_items |= ITEM_HELMET;
@ -200,6 +203,6 @@ CSEv_BuyEquipment_f(float fUtil)
}
Money_AddMoney(pl, -g_cstrikeUtilPrice[iUtil]);
} else {
//centerprint(pl, "You have insufficient funds!");
centerprint(pl, "You have insufficient funds!");
}
}

View file

@ -49,6 +49,8 @@ CSMultiplayerRules::PlayerDeath(base_player pl)
msg_entity = world;
multicast([0,0,0], MULTICAST_ALL);
Plugin_PlayerObituary(g_dmg_eAttacker, g_dmg_eTarget, g_dmg_iWeapon, g_dmg_iHitBody, g_dmg_iDamage);
/* death-counter */
pl.deaths++;
forceinfokey(pl, "*deaths", ftos(pl.deaths));
@ -801,6 +803,7 @@ CSMultiplayerRules::PlayerClearWeaponry(base_player pp)
pl.sg550_mag = 0;
pl.para_mag = 0;
pl.viewzoom = 1.0f;
pl.mode_temp = 0;
}
/*
@ -855,7 +858,7 @@ Force the player to become an observer.
void
CSMultiplayerRules::PlayerMakeSpectator(base_player pl)
{
pl.classname = "spectator";
pl.classname = "dead";
pl.health = 0;
pl.armor = 0;
pl.takedamage = DAMAGE_NO;

View file

@ -271,11 +271,15 @@ player::ReceiveEntity(float new)
if (fl & PLAYER_ORIGIN_Z)
origin[2] = readcoord();
if (fl & PLAYER_ANGLES_X)
pitch = readfloat();
if (fl & PLAYER_ANGLES_Y)
v_angle[0] = pitch = readfloat();
if (fl & PLAYER_ANGLES_Y) {
angles[1] = readfloat();
if (fl & PLAYER_ANGLES_Z)
v_angle[1] = readfloat();
}
if (fl & PLAYER_ANGLES_Z) {
angles[2] = readfloat();
v_angle[1] = readfloat();
}
if (fl & PLAYER_VELOCITY) {
velocity[0] = readcoord();
@ -746,10 +750,14 @@ player::SendEntity(entity ePEnt, float fChanged)
WriteCoord(MSG_ENTITY, origin[2]);
if (fChanged & PLAYER_ANGLES_X)
WriteFloat(MSG_ENTITY, v_angle[0]);
if (fChanged & PLAYER_ANGLES_Y)
if (fChanged & PLAYER_ANGLES_Y) {
WriteFloat(MSG_ENTITY, angles[1]);
if (fChanged & PLAYER_ANGLES_Z)
WriteFloat(MSG_ENTITY, v_angle[1]);
}
if (fChanged & PLAYER_ANGLES_Z) {
WriteFloat(MSG_ENTITY, angles[2]);
WriteFloat(MSG_ENTITY, v_angle[2]);
}
if (fChanged & PLAYER_VELOCITY) {
WriteCoord(MSG_ENTITY, velocity[0]);
WriteCoord(MSG_ENTITY, velocity[1]);

View file

@ -0,0 +1,165 @@
sfx_impact.default
{
attenuation normal
sample weapons/ric1.wav
sample weapons/ric2.wav
sample weapons/ric3.wav
sample weapons/ric4.wav
sample weapons/ric5.wav
}
sfx_impact.alien
{
attenuation normal
sample weapons/ric1.wav
sample weapons/ric2.wav
sample weapons/ric3.wav
sample weapons/ric4.wav
sample weapons/ric5.wav
}
sfx_impact.flesh
{
attenuation normal
sample debris/flesh1.wav
sample debris/flesh2.wav
sample debris/flesh3.wav
sample debris/flesh4.wav
sample debris/flesh5.wav
sample debris/flesh6.wav
sample debris/flesh7.wav
}
sfx_impact.foliage
{
attenuation normal
sample weapons/ric1.wav
sample weapons/ric2.wav
sample weapons/ric3.wav
sample weapons/ric4.wav
sample weapons/ric5.wav
}
sfx_impact.computer
{
attenuation normal
sample buttons/spark1.wav
sample buttons/spark2.wav
sample buttons/spark3.wav
sample buttons/spark4.wav
sample buttons/spark5.wav
sample buttons/spark6.wav
}
sfx_impact.dirt
{
attenuation normal
sample weapons/ric1.wav
sample weapons/ric2.wav
sample weapons/ric3.wav
sample weapons/ric4.wav
sample weapons/ric5.wav
}
sfx_impact.vent
{
attenuation normal
sample debris/metal1.wav
sample debris/metal2.wav
sample debris/metal3.wav
sample debris/metal4.wav
sample debris/metal5.wav
sample debris/metal6.wav
sample weapons/ric_metal-1.wav
sample weapons/ric_metal-2.wav
}
sfx_impact.grate
{
attenuation normal
sample debris/metal1.wav
sample debris/metal2.wav
sample debris/metal3.wav
sample debris/metal4.wav
sample debris/metal5.wav
sample debris/metal6.wav
}
sfx_impact.metal
{
attenuation normal
sample debris/metal1.wav
sample debris/metal2.wav
sample debris/metal3.wav
sample debris/metal4.wav
sample debris/metal5.wav
sample debris/metal6.wav
}
sfx_impact.glass
{
attenuation normal
sample debris/glass1.wav
sample debris/glass2.wav
sample debris/glass3.wav
sample debris/glass4.wav
}
sfx_impact.sand
{
attenuation normal
sample weapons/ric1.wav
sample weapons/ric2.wav
sample weapons/ric3.wav
sample weapons/ric4.wav
sample weapons/ric5.wav
}
sfx_impact.slosh
{
attenuation normal
sample weapons/ric1.wav
sample weapons/ric2.wav
sample weapons/ric3.wav
sample weapons/ric4.wav
sample weapons/ric5.wav
}
sfx_impact.snow
{
attenuation normal
sample weapons/ric1.wav
sample weapons/ric2.wav
sample weapons/ric3.wav
sample weapons/ric4.wav
sample weapons/ric5.wav
}
sfx_impact.tile
{
attenuation normal
sample weapons/ric1.wav
sample weapons/ric2.wav
sample weapons/ric3.wav
sample weapons/ric4.wav
sample weapons/ric5.wav
}
sfx_impact.wood
{
attenuation normal
sample debris/wood1.wav
sample debris/wood2.wav
sample debris/wood3.wav
sample debris/wood4.wav
}
sfx_impact.concrete
{
attenuation normal
sample debris/concrete1.wav
sample debris/concrete2.wav
sample debris/concrete3.wav
sample weapons/ric_conc-1.wav
sample weapons/ric_conc-2.wav
}

View file

@ -0,0 +1,57 @@
player.headshot
{
sample player/headshot1.wav
sample player/headshot2.wav
sample player/headshot3.wav
}
player.headshotarmor
{
sample player/bhit_helmet-1.wav
}
player.hitbody
{
sample player/pl_pain2.wav
sample player/pl_pain4.wav
sample player/pl_die1.wav
}
player.hitarmor
{
sample player/bhitkevlar-1.wav
}
player.fall
{
sample player/pl_pain2.wav
sample player/pl_pain7.wav
}
player.lightfall
{
sample player/pl_fallpain1.wav
}
player.die
{
sample player/die1.wav
sample player/die2.wav
sample player/die3.wav
sample player/death6.wav
}
player.gasplight
{
sample misc/null.wav
}
player.gaspheavy
{
sample misc/null.wav
}
player.waterexit
{
sample player/pl_wade1.wav
sample player/pl_wade3.wav
}
player.waterenter
{
sample player/pl_wade2.wav
sample player/pl_wade4.wav
}