Work on the various visual feedback and scoring of CTF
This commit is contained in:
parent
fbcc868870
commit
930a034a01
13 changed files with 73 additions and 2 deletions
|
@ -24,7 +24,7 @@ OP4CTF_DrawHud(player pl)
|
|||
vector iconOP4Ofs;
|
||||
bool myTeam = getplayerkeyfloat(player_localnum, "*team");
|
||||
|
||||
iconPos = g_hudmins + [16, g_hudres[1] - 128];
|
||||
iconPos = g_hudmins + [16, g_hudres[1] - 142];
|
||||
|
||||
if (serverkeyfloat("ctfflag_1") == CTFFLAG_IDLE)
|
||||
iconBMOfs = [67/256, 77/256];
|
||||
|
|
|
@ -40,12 +40,14 @@ ClientGame_InitDone(void)
|
|||
}
|
||||
}
|
||||
|
||||
void HLSprite_Init(void);
|
||||
void
|
||||
ClientGame_RendererRestart(string rstr)
|
||||
{
|
||||
Nightvision_Init();
|
||||
Obituary_Precache();
|
||||
Damage_Precache();
|
||||
HLSprite_Init();
|
||||
|
||||
FX_Blood_Init();
|
||||
FX_BreakModel_Init();
|
||||
|
|
|
@ -32,6 +32,7 @@ cmds.qc
|
|||
../../../valve/src/client/viewmodel.qc
|
||||
../../../valve/src/client/view.qc
|
||||
../../../valve/src/client/obituary.qc
|
||||
../../../valve/src/client/hud_sprite.qc
|
||||
../../../valve/src/client/hud_ammonotify.qc
|
||||
../../../valve/src/client/hud_dmgnotify.qc
|
||||
../../../valve/src/client/hud_itemnotify.qc
|
||||
|
|
|
@ -27,12 +27,17 @@ public:
|
|||
private:
|
||||
int m_iItemID;
|
||||
float m_iTeamID;
|
||||
string m_strScoreIcon;
|
||||
vector m_vecScoreColor;
|
||||
};
|
||||
|
||||
void
|
||||
OP4CTFItem::OP4CTFItem(void)
|
||||
{
|
||||
m_iItemID = 0i;
|
||||
m_strScoreIcon = __NULL__;
|
||||
m_iTeamID = 0;
|
||||
m_vecScoreColor = [1,1,1];
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -73,6 +78,11 @@ OP4CTFItem::Touch(entity toucherEntity)
|
|||
return;
|
||||
|
||||
pl.g_items |= m_iItemID; /* add to inventory */
|
||||
|
||||
forceinfokey(pl, "*icon2", m_strScoreIcon);
|
||||
forceinfokey(pl, "*icon2_r", ftos(m_vecScoreColor[0]));
|
||||
forceinfokey(pl, "*icon2_g", ftos(m_vecScoreColor[1]));
|
||||
forceinfokey(pl, "*icon2_b", ftos(m_vecScoreColor[2]));
|
||||
Destroy();
|
||||
}
|
||||
|
||||
|
|
|
@ -21,6 +21,8 @@ class OP4CTFRules:HLMultiplayerRules
|
|||
virtual void InitPostEnts(void);
|
||||
virtual void PlayerSpawn(NSClientPlayer);
|
||||
virtual void PlayerDeath(NSClientPlayer);
|
||||
virtual void PlayerConnect(NSClientPlayer);
|
||||
virtual void PlayerDisconnect(NSClientPlayer);
|
||||
|
||||
nonvirtual void CharacterSpawn(NSClientPlayer, string);
|
||||
nonvirtual void CaptureFlag(NSClientPlayer);
|
||||
|
|
|
@ -31,6 +31,7 @@ OP4CTFRules::InitPostEnts(void)
|
|||
|
||||
forceinfokey(world, "ctfflag_1", "0");
|
||||
forceinfokey(world, "ctfflag_2", "0");
|
||||
forceinfokey(world, "scorepoints", "1");
|
||||
|
||||
Sound_Precache("op4ctf_bm.flag_taken");
|
||||
Sound_Precache("op4ctf_bm.flag_capture");
|
||||
|
@ -39,6 +40,16 @@ OP4CTFRules::InitPostEnts(void)
|
|||
Sound_Precache("op4ctf_op4.flag_capture");
|
||||
}
|
||||
|
||||
void
|
||||
OP4CTFRules::PlayerConnect(NSClientPlayer pp)
|
||||
{
|
||||
super::PlayerConnect(pp);
|
||||
pp.frags = 0;
|
||||
forceinfokey(pp, "*deaths", "0");
|
||||
forceinfokey(pp, "*score", "0");
|
||||
forceinfokey(pp, "*icon1", "");
|
||||
}
|
||||
|
||||
void
|
||||
OP4CTFRules::PlayerDisconnect(NSClientPlayer pl)
|
||||
{
|
||||
|
@ -105,6 +116,8 @@ OP4CTFRules::CaptureFlag(NSClientPlayer pp)
|
|||
/* detach flag */
|
||||
pl.g_items &= ~ITEM_GOALITEM;
|
||||
pl.flagmodel = 0;
|
||||
pl.score += 10;
|
||||
forceinfokey(pl, "*icon1", "");
|
||||
|
||||
if (pl.team == 1) {
|
||||
flagName = "info_ctfflag_2";
|
||||
|
|
|
@ -33,9 +33,16 @@ When detected, will enable Capture The Flag on the map that it's on.
|
|||
This entity was introduced in Half-Life: Opposing Force (1999)
|
||||
*/
|
||||
|
||||
class info_ctfdetect
|
||||
class info_ctfdetect:NSEntity
|
||||
{
|
||||
public:
|
||||
void info_ctfdetect(void);
|
||||
|
||||
virtual void SpawnKey(string, string);
|
||||
|
||||
private:
|
||||
string m_strScoreIconBM;
|
||||
string m_strScoreIconOF;
|
||||
};
|
||||
info_ctfdetect g_ctf;
|
||||
|
||||
|
@ -43,4 +50,17 @@ void
|
|||
info_ctfdetect::info_ctfdetect(void)
|
||||
{
|
||||
g_ctf = this;
|
||||
}
|
||||
|
||||
void
|
||||
info_ctfdetect::SpawnKey(string strKey, string strValue)
|
||||
{
|
||||
switch (strKey) {
|
||||
case "score_icon_namebm":
|
||||
m_strScoreIconBM = ReadString(strValue);
|
||||
break;
|
||||
case "score_icon_nameof":
|
||||
m_strScoreIconOF = ReadString(strValue);
|
||||
break;
|
||||
}
|
||||
}
|
|
@ -45,6 +45,8 @@ void
|
|||
item_ctfaccelerator::Spawned(void)
|
||||
{
|
||||
m_iItemID = ITEM_CTF_DEATH;
|
||||
m_strScoreIcon = "score_ctfaccel";
|
||||
m_vecScoreColor = [1,0,0];
|
||||
model = "models/w_accelerator.mdl";
|
||||
super::Spawned();
|
||||
}
|
|
@ -45,6 +45,8 @@ void
|
|||
item_ctfbackpack::Spawned(void)
|
||||
{
|
||||
m_iItemID = ITEM_CTF_BACKPACK;
|
||||
m_strScoreIcon = "score_ctfbpack";
|
||||
m_vecScoreColor = [1,1,0];
|
||||
model = "models/w_backpack.mdl";
|
||||
super::Spawned();
|
||||
}
|
|
@ -87,8 +87,21 @@ item_ctfflag::Touch(entity eToucher)
|
|||
|
||||
m_eActivator = pl;
|
||||
pl.g_items |= ITEM_GOALITEM;
|
||||
forceinfokey(pl, "*icon1", "score_flag");
|
||||
|
||||
if (eToucher.team == 1) {
|
||||
forceinfokey(pl, "*icon1_r", "0");
|
||||
forceinfokey(pl, "*icon1_g", "1");
|
||||
forceinfokey(pl, "*icon1_b", "0");
|
||||
} else {
|
||||
forceinfokey(pl, "*icon1_r", "1");
|
||||
forceinfokey(pl, "*icon1_g", "1");
|
||||
forceinfokey(pl, "*icon1_b", "0");
|
||||
}
|
||||
|
||||
pl.flagmodel = GetModelindex();
|
||||
pl.flagskin = GetSkin();
|
||||
pl.score += 1;
|
||||
FlagTaken();
|
||||
}
|
||||
|
||||
|
|
|
@ -45,6 +45,8 @@ void
|
|||
item_ctflongjump::Spawned(void)
|
||||
{
|
||||
m_iItemID = ITEM_CTF_JUMPPACK;
|
||||
m_strScoreIcon = "score_ctfljump";
|
||||
m_vecScoreColor = [1,0.5,0];
|
||||
model = "models/w_jumppack.mdl";
|
||||
super::Spawned();
|
||||
}
|
|
@ -45,6 +45,8 @@ void
|
|||
item_ctfportablehev::Spawned(void)
|
||||
{
|
||||
m_iItemID = ITEM_CTF_SHIELD;
|
||||
m_strScoreIcon = "score_ctfphev";
|
||||
m_vecScoreColor = [0.25,0.25,1];
|
||||
model = "models/w_porthev.mdl";
|
||||
super::Spawned();
|
||||
|
||||
|
|
|
@ -42,6 +42,8 @@ void
|
|||
item_ctfregeneration::Spawned(void)
|
||||
{
|
||||
m_iItemID = ITEM_CTF_HEALTH;
|
||||
m_strScoreIcon = "score_ctfregen";
|
||||
m_vecScoreColor = [0, 1, 0];
|
||||
model = "models/w_health.mdl";
|
||||
super::Spawned();
|
||||
}
|
Loading…
Reference in a new issue