Moved Player_Death into the Gamerule logic.

Counter-Strike's zones have been shoved into .flags, where we desperately
need some more bits.
Counter-Strike's WEAPON_C4BOMB now only works in a func_bomb_target zone.
This commit is contained in:
Marco Cawthorne 2020-04-20 19:25:15 +02:00
parent 1eda0ab5d4
commit a3ff75a4da
39 changed files with 526 additions and 271 deletions

View file

@ -197,10 +197,10 @@ HUD_DrawMoney(void)
/* dollar sign */ /* dollar sign */
drawsubpic( drawsubpic(
money_pos, money_pos,
[18,25], [18,26],
HUD_NUMS, HUD_NUMS,
[NUMSIZE_X * 8, NUMSIZE_Y * 1], [192/256, 24/256],
[NUMSIZE_X * 0.75, NUMSIZE_Y], [18/256, 26/256],
g_hud_color, g_hud_color,
HUD_ALPHA - endalpha, HUD_ALPHA - endalpha,
DRAWFLAG_ADDITIVE DRAWFLAG_ADDITIVE
@ -210,7 +210,16 @@ HUD_DrawMoney(void)
* varying alphas/colors */ * varying alphas/colors */
if (pSeat->m_flMoneyAlpha > 0) { if (pSeat->m_flMoneyAlpha > 0) {
/* red/green dollar sign */ /* red/green dollar sign */
drawsubpic(money_pos, [18,25], HUD_NUMS, [NUMSIZE_X * 8, NUMSIZE_Y * 1], [NUMSIZE_X * 0.75, NUMSIZE_Y], pSeat->m_vecMoneyColor, endalpha, DRAWFLAG_ADDITIVE); drawsubpic(
money_pos,
[18,26],
HUD_NUMS,
[192/256, 24/256],
[18/256, 26/256],
pSeat->m_vecMoneyColor,
endalpha,
DRAWFLAG_ADDITIVE
);
/* draw the +/- symbols depending on whether /* draw the +/- symbols depending on whether
* or not we made or lost money */ * or not we made or lost money */
@ -310,29 +319,56 @@ HUD_DrawArmor(void)
pSeat->m_flArmorAlpha = HUD_ALPHA; pSeat->m_flArmorAlpha = HUD_ALPHA;
} }
drawsubpic( if (pl.g_items & ITEM_HELMET) {
pos + [-80,1],
[24,24],
HUD_NUMS,
[spr_suit2[0], spr_suit2[1]],
[spr_suit2[2], spr_suit2[3]],
g_hud_color,
pSeat->m_flArmorAlpha,
DRAWFLAG_ADDITIVE
);
if (pl.armor > 0) {
drawsubpic( drawsubpic(
pos + [-80,1], pos + [-80,1],
[24, 24 * (pl.armor / 100)], [24,24],
HUD_NUMS, HUD_NUMS,
[spr_suit1[0], [spr_suit4[0], spr_suit4[1]],
spr_suit1[1]], [spr_suit4[2], spr_suit4[3]],
[spr_suit1[2], spr_suit1[3] * (pl.armor / 100)],
g_hud_color, g_hud_color,
pSeat->m_flArmorAlpha, pSeat->m_flArmorAlpha,
DRAWFLAG_ADDITIVE DRAWFLAG_ADDITIVE
); );
} else {
drawsubpic(
pos + [-80,1],
[24,24],
HUD_NUMS,
[spr_suit2[0], spr_suit2[1]],
[spr_suit2[2], spr_suit2[3]],
g_hud_color,
pSeat->m_flArmorAlpha,
DRAWFLAG_ADDITIVE
);
}
if (pl.armor > 0) {
if (pl.g_items & ITEM_HELMET) {
drawsubpic(
pos + [-80,1],
[24, 24 * (pl.armor / 100)],
HUD_NUMS,
[spr_suit3[0],
spr_suit3[1]],
[spr_suit3[2], spr_suit3[3] * (pl.armor / 100)],
g_hud_color,
pSeat->m_flArmorAlpha,
DRAWFLAG_ADDITIVE
);
} else {
drawsubpic(
pos + [-80,1],
[24, 24 * (pl.armor / 100)],
HUD_NUMS,
[spr_suit1[0],
spr_suit1[1]],
[spr_suit1[2], spr_suit1[3] * (pl.armor / 100)],
g_hud_color,
pSeat->m_flArmorAlpha,
DRAWFLAG_ADDITIVE
);
}
} }
HUD_DrawNums(pl.armor, pos, pSeat->m_flArmorAlpha, g_hud_color); HUD_DrawNums(pl.armor, pos, pSeat->m_flArmorAlpha, g_hud_color);
@ -451,35 +487,79 @@ HUD_DrawFlashlight(void)
} }
} }
/* logo animation used during e3 1998 */
void void
HUD_DrawLogo(void) HUD_DrawZones(void)
{ {
vector pos; int zc = 0;
static int f; vector pos = [0,0,0];
static float frame_timer; player pl = (player)pSeat->m_ePlayer;
frame_timer -= clframetime; if (pl.flags & FL_BUYZONE) {
pos = [g_hudres[0] - 262, 48]; zc++;
}
drawpic( if (pl.flags & FL_BOMBZONE) {
pos, zc++;
sprintf("sprites/640_logo.spr_%i.tga", f), }
[256, 48], if (pl.flags & FL_RESCUEZONE) {
[1,1,1], zc++;
1.0f, }
DRAWFLAG_ADDITIVE if (pl.g_items & ITEM_DEFUSAL) {
); zc++;
if (frame_timer > 0) {
return;
} }
frame_timer = 0.1f; pos = g_hudmins + [16, (g_hudres[1] / 2) - (zc * 16)];
f++; if (pl.flags & FL_BUYZONE) {
if (f == 31) { drawsubpic(
f = 0; pos,
[32,32],
HUD_NUMS,
[96/256,148/256],
[32/256,32/256],
[0,1,0],
1.0f,
DRAWFLAG_ADDITIVE
);
pos[1] += 32;
}
if (pl.flags & FL_BOMBZONE) {
drawsubpic(
pos,
[32,32],
HUD_NUMS,
[0/256,148/256],
[32/256,32/256],
[0,1,0],
1.0f,
DRAWFLAG_ADDITIVE
);
pos[1] += 32;
}
if (pl.flags & FL_RESCUEZONE) {
drawsubpic(
pos,
[32,32],
HUD_NUMS,
[64/256,148/256],
[32/256,32/256],
[0,1,0],
1.0f,
DRAWFLAG_ADDITIVE
);
pos[1] += 32;
}
if (pl.g_items & ITEM_DEFUSAL) {
drawsubpic(
pos,
[32,32],
HUD_NUMS,
[48/256,148/256],
[32/256,32/256],
[0,1,0],
1.0f,
DRAWFLAG_ADDITIVE
);
pos[1] += 32;
} }
} }
@ -529,10 +609,9 @@ HUD_Draw(void)
HUD_DrawNotify(); HUD_DrawNotify();
HUD_DrawHealth(); HUD_DrawHealth();
HUD_DrawArmor(); HUD_DrawArmor();
HUD_DrawZones();
HUD_DrawFlashlight(); HUD_DrawFlashlight();
Damage_Draw(); Damage_Draw();
//drawpic([128,128], HUD_NUMS, [256,256], [1,1,1], 1.0f);
} }
/* specatator main entry */ /* specatator main entry */

View file

@ -36,6 +36,20 @@ float spr_suit2[4] = {
24 / 256 // size y 24 / 256 // size y
}; };
float spr_suit3[4] = {
0 / 256, // pos x
124 / 256, // pos u
24 / 256, // size x
24 / 256 // size y
};
float spr_suit4[4] = {
24 / 256, // pos x
124 / 256, // pos u
24 / 256, // size x
24 / 256 // size y
};
float spr_flash1[4] = { float spr_flash1[4] = {
160 / 256, // pos x 160 / 256, // pos x
24 / 256, // pos u 24 / 256, // pos u

View file

@ -77,7 +77,7 @@ CSEv_BuyWeapon_f(float fWeapon)
if ((pl.money - g_cstrikeWeaponPrice[iWeapon]) >= 0) { if ((pl.money - g_cstrikeWeaponPrice[iWeapon]) >= 0) {
Weapons_AddItem(pl, iWeapon); Weapons_AddItem(pl, iWeapon);
Money_AddMoney(pl, -g_cstrikeWeaponPrice[iWeapon]); Money_AddMoney(pl, -g_cstrikeWeaponPrice[iWeapon]);
sound(pl, CHAN_ITEM, "items/gunpickup2.wav", 1, ATTN_IDLE); Sound_Play(pl, CHAN_ITEM, "buy.weapon");
} else { } else {
//centerprint(pl, "You have insufficient funds!"); //centerprint(pl, "You have insufficient funds!");
} }
@ -115,32 +115,32 @@ CSEv_BuyEquipment_f(float fUtil)
switch (iUtil) { switch (iUtil) {
case 0: case 0:
pl.armor = 100; pl.armor = 100;
sound(pl, CHAN_ITEM, "items/tr_kevlar.wav", 1.0f, ATTN_IDLE); Sound_Play(pl, CHAN_ITEM, "buy.kevlar");
break; break;
case 1: case 1:
pl.armor = 100; pl.armor = 100;
pl.g_items |= ITEM_HELMET; pl.g_items |= ITEM_HELMET;
sound(pl, CHAN_ITEM, "items/tr_kevlar.wav", 1.0f, ATTN_IDLE); Sound_Play(pl, CHAN_ITEM, "buy.kevlar");
break; break;
case 2: case 2:
Weapons_AddItem(pl, WEAPON_FLASHBANG); Weapons_AddItem(pl, WEAPON_FLASHBANG);
sound(pl, CHAN_ITEM, "items/gunpickup2.wav", 1.0f, ATTN_IDLE); Sound_Play(pl, CHAN_ITEM, "buy.weapon");
break; break;
case 3: case 3:
Weapons_AddItem(pl, WEAPON_HEGRENADE); Weapons_AddItem(pl, WEAPON_HEGRENADE);
sound(pl, CHAN_ITEM, "items/gunpickup2.wav", 1.0f, ATTN_IDLE); Sound_Play(pl, CHAN_ITEM, "buy.weapon");
break; break;
case 4: case 4:
Weapons_AddItem(pl, WEAPON_SMOKEGRENADE); Weapons_AddItem(pl, WEAPON_SMOKEGRENADE);
sound(pl, CHAN_ITEM, "items/gunpickup2.wav", 1.0f, ATTN_IDLE); Sound_Play(pl, CHAN_ITEM, "buy.weapon");
break; break;
case 5: case 5:
pl.g_items |= ITEM_DEFUSAL; pl.g_items |= ITEM_DEFUSAL;
sound(pl, CHAN_ITEM, "items/gunpickup2.wav", 1.0f, ATTN_IDLE); Sound_Play(pl, CHAN_ITEM, "buy.weapon");
break; break;
case 6: case 6:
pl.g_items |= ITEM_NIGHTVISION; pl.g_items |= ITEM_NIGHTVISION;
sound(pl, CHAN_ITEM, "items/gunpickup2.wav", 1.0f, ATTN_IDLE); Sound_Play(pl, CHAN_ITEM, "buy.weapon");
break; break;
} }
Money_AddMoney(pl, -g_cstrikeUtilPrice[iUtil]); Money_AddMoney(pl, -g_cstrikeUtilPrice[iUtil]);

View file

@ -18,7 +18,10 @@ void
Game_RunClientCommand(void) Game_RunClientCommand(void)
{ {
player pl = (player)self; player pl = (player)self;
pl.buyzone = FALSE;
pl.flags &= ~FL_BUYZONE;
pl.flags &= ~FL_RESCUEZONE;
pl.flags &= ~FL_BOMBZONE;
Footsteps_Update(); Footsteps_Update();
PMove_Run(); PMove_Run();

View file

@ -29,9 +29,27 @@ Once the bomb explodes inside this volume, it'll trigger its targets.
class func_bomb_target:CBaseTrigger class func_bomb_target:CBaseTrigger
{ {
void(void) func_bomb_target;
virtual void(void) Respawn; virtual void(void) Respawn;
virtual void(void) touch;
}; };
void
func_bomb_target::touch(void)
{
player pl = (player)other;
if (!(other.flags & FL_CLIENT)) {
return;
}
if (pl.team != TEAM_T) {
return;
}
pl.flags |= FL_BOMBZONE;
}
void void
func_bomb_target::Respawn(void) func_bomb_target::Respawn(void)
{ {

View file

@ -52,11 +52,11 @@ void
func_buyzone::touch(void) func_buyzone::touch(void)
{ {
player pl = (player)other; player pl = (player)other;
if (!(other.flags & FL_CLIENT)) { if (!(other.flags & FL_CLIENT))
return; return;
}
pl.buyzone = TRUE; if (team == 0 || team == pl.team)
pl.flags |= FL_BUYZONE;
} }
void void

View file

@ -39,6 +39,12 @@ class func_hostage_rescue:CBaseTrigger
void void
func_hostage_rescue::touch(void) func_hostage_rescue::touch(void)
{ {
if (other.flags & FL_CLIENT) {
player pl = (player)other;
pl.flags |= FL_RESCUEZONE;
return;
}
if (other.classname != "hostage_entity") { if (other.classname != "hostage_entity") {
return; return;
} }
@ -52,7 +58,7 @@ func_hostage_rescue::touch(void)
Radio_BroadcastMessage(RADIO_RESCUED); Radio_BroadcastMessage(RADIO_RESCUED);
g_cs_hostagesrescued++; g_cs_hostagesrescued++;
Money_AddMoney(hosty.m_eFollowing, 1000); Money_AddMoney((player)hosty.m_eFollowing, 1000);
/* In Hostage Rescue, all Counter-Terrorists receive an $850 /* In Hostage Rescue, all Counter-Terrorists receive an $850
* bonus for every hostage they rescue, even if they lose the round. */ * bonus for every hostage they rescue, even if they lose the round. */

View file

@ -16,6 +16,16 @@
var int autocvar_sv_playerkeepalive = TRUE; var int autocvar_sv_playerkeepalive = TRUE;
void
CSGameRules::PlayerDeath(player pl)
{
}
void
CSGameRules::PlayerPain(player pl)
{
}
int int
CSGameRules::BuyingPossible(player pl) CSGameRules::BuyingPossible(player pl)
{ {

View file

@ -22,6 +22,8 @@ class CSGameRules:CGameRules
virtual void(entity) PlayerDisconnect; virtual void(entity) PlayerDisconnect;
virtual void(player) PlayerKill; virtual void(player) PlayerKill;
virtual void(player) PlayerPostFrame; virtual void(player) PlayerPostFrame;
virtual void(player) PlayerDeath;
virtual void(player) PlayerPain;
/* level transitions */ /* level transitions */
virtual void(player) LevelChangeParms; virtual void(player) LevelChangeParms;
@ -35,6 +37,7 @@ class CSSingleplayerRules:CSGameRules
{ {
/* client */ /* client */
virtual void(player) PlayerSpawn; virtual void(player) PlayerSpawn;
virtual void(player) PlayerDeath;
}; };
class CSMultiplayerRules:CSGameRules class CSMultiplayerRules:CSGameRules
@ -48,6 +51,7 @@ class CSMultiplayerRules:CSGameRules
virtual void(void) FrameStart; virtual void(void) FrameStart;
virtual void(player) PlayerSpawn; virtual void(player) PlayerSpawn;
virtual void(player) PlayerPreFrame; virtual void(player) PlayerPreFrame;
virtual void(player) PlayerDeath;
/* CS specific */ /* CS specific */
virtual void(void) CreateRescueZones; virtual void(void) CreateRescueZones;

View file

@ -14,6 +14,44 @@
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/ */
void
CSMultiplayerRules::PlayerDeath(player pl)
{
pl.movetype = MOVETYPE_NONE;
pl.solid = SOLID_NOT;
pl.takedamage = DAMAGE_NO;
pl.flags &= ~FL_FLASHLIGHT;
pl.armor = pl.activeweapon = pl.g_items = 0;
pl.health = 0;
entity corpse = spawn();
setorigin(corpse, pl.origin + [0,0,32]);
setmodel(corpse, pl.model);
setsize(corpse, VEC_HULL_MIN, VEC_HULL_MAX);
corpse.movetype = MOVETYPE_TOSS;
corpse.solid = SOLID_TRIGGER;
corpse.modelindex = pl.modelindex;
corpse.frame = ANIM_DIESIMPLE;
corpse.angles = pl.angles;
corpse.velocity = pl.velocity;
/* gamerule stuff */
PlayerMakeSpectator(pl);
pl.classname = "player";
pl.health = 0;
forceinfokey(pl, "*dead", "1");
forceinfokey(pl, "*team", ftos(pl.team));
CountPlayers();
/* In Assassination, all Terrorists receive a $2500
* reward if they won by killing the VIP. */
if (self.team == TEAM_VIP) {
RoundOver(TEAM_T, 2500, FALSE);
return;
}
DeathCheck(pl);
}
void void
CSMultiplayerRules::PlayerPreFrame(player pl) CSMultiplayerRules::PlayerPreFrame(player pl)
{ {
@ -294,7 +332,7 @@ CSMultiplayerRules::BuyingPossible(player pl)
} }
} }
if (pl.buyzone == FALSE) { if (!(pl.flags & FL_BUYZONE)) {
centerprint(pl, "Sorry, you aren't in a buyzone.\n"); centerprint(pl, "Sorry, you aren't in a buyzone.\n");
return FALSE; return FALSE;
} }
@ -828,5 +866,3 @@ void CSEv_JoinTeam_f(float flChar)
rules.RoundOver(FALSE, 0, FALSE); rules.RoundOver(FALSE, 0, FALSE);
} }
} }
void weaponbox_spawn(player pl) {}

View file

@ -14,6 +14,24 @@
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/ */
void
CSSingleplayerRules::PlayerDeath(player pl)
{
pl.movetype = MOVETYPE_NONE;
pl.solid = SOLID_NOT;
pl.takedamage = DAMAGE_NO;
pl.flags &= ~FL_FLASHLIGHT;
pl.armor = pl.activeweapon = pl.g_items = 0;
if (pl.health < -50) {
pl.health = 0;
Effect_GibHuman(pl.origin);
return;
}
pl.health = 0;
}
void void
CSSingleplayerRules::PlayerSpawn(player pl) CSSingleplayerRules::PlayerSpawn(player pl)
{ {

View file

@ -35,11 +35,11 @@ void
info_buyzone::touch(void) info_buyzone::touch(void)
{ {
player pl = (player)other; player pl = (player)other;
if (!(other.flags & FL_CLIENT)) { if (!(other.flags & FL_CLIENT))
return; return;
}
pl.buyzone = TRUE; if (team == 0 || team == pl.team)
pl.flags |= FL_BUYZONE;
} }
void void

View file

@ -38,6 +38,12 @@ class info_hostage_rescue
void void
info_hostage_rescue::touch(void) info_hostage_rescue::touch(void)
{ {
if (other.flags & FL_CLIENT) {
player pl = (player)other;
pl.flags |= FL_RESCUEZONE;
return;
}
if (other.classname != "hostage_entity") { if (other.classname != "hostage_entity") {
return; return;
} }
@ -51,7 +57,7 @@ info_hostage_rescue::touch(void)
Radio_BroadcastMessage(RADIO_RESCUED); Radio_BroadcastMessage(RADIO_RESCUED);
g_cs_hostagesrescued++; g_cs_hostagesrescued++;
Money_AddMoney(hosty.m_eFollowing, 1000); Money_AddMoney((player)hosty.m_eFollowing, 1000);
/* In Hostage Rescue, all Counter-Terrorists receive an $850 /* In Hostage Rescue, all Counter-Terrorists receive an $850
* bonus for every hostage they rescue, even if they lose the round. */ * bonus for every hostage they rescue, even if they lose the round. */

View file

@ -14,63 +14,6 @@
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/ */
void Player_Pain(int hit)
{
}
void Player_Death(int hit)
{
player pl = (player)self;
pl.movetype = MOVETYPE_NONE;
pl.solid = SOLID_NOT;
pl.takedamage = DAMAGE_NO;
pl.flags &= ~FL_FLASHLIGHT;
pl.armor = pl.activeweapon = pl.g_items = 0;
pl.think = PutClientInServer;
pl.nextthink = time + 4.0f;
if (pl.health < -50) {
pl.health = 0;
Effect_GibHuman(pl.origin);
return;
}
pl.health = 0;
/* Let's handle corpses on the clientside */
entity corpse = spawn();
setorigin(corpse, pl.origin + [0,0,32]);
setmodel(corpse, pl.model);
setsize(corpse, VEC_HULL_MIN, VEC_HULL_MAX);
corpse.movetype = MOVETYPE_TOSS;
corpse.solid = SOLID_TRIGGER;
corpse.modelindex = pl.modelindex;
corpse.frame = ANIM_DIESIMPLE;
corpse.angles = pl.angles;
corpse.velocity = pl.velocity;
/* gamerule stuff */
// PlayerMakeSpectator();
self.classname = "player";
self.health = 0;
forceinfokey(self, "*dead", "1");
forceinfokey(self, "*team", ftos(self.team));
//Rules_CountPlayers();
/* In Assassination, all Terrorists receive a $2500
* reward if they won by killing the VIP. */
if (self.team == TEAM_VIP) {
// Rules_RoundOver(TEAM_T, 2500, FALSE);
return;
}
//
//Rules_DeathCheck();
}
/* /*
==================== ====================
UseWorkaround UseWorkaround

View file

@ -37,10 +37,15 @@ void Game_Worldspawn(void)
precache_model("models/player/urban/urban.mdl"); precache_model("models/player/urban/urban.mdl");
precache_model("models/player/vip/vip.mdl"); precache_model("models/player/vip/vip.mdl");
precache_sound("weapons/ric_metal-2.wav"); precache_sound("weapons/ric_metal-2.wav");
precache_sound("player/pl_pain2.wav");
precache_sound("player/pl_pain4.wav");
Sound_Precache("buy.kevlar");
Sound_Precache("buy.weapon");
Weapons_Init(); Weapons_Init();
clientstat(STAT_MONEY, EV_INTEGER, player::money); clientstat(STAT_MONEY, EV_INTEGER, player::money);
pointerstat(STAT_GAMETIME, EV_FLOAT, &g_cs_gametime); pointerstat(STAT_GAMETIME, EV_FLOAT, &g_cs_gametime);
pointerstat(STAT_GAMESTATE, EV_INTEGER, &g_cs_gamestate); pointerstat(STAT_GAMESTATE, EV_INTEGER, &g_cs_gamestate);
} }

View file

@ -46,6 +46,16 @@ CGameRules::PlayerDisconnect(entity pl)
} }
void void
CGameRules::PlayerKill(player pl) CGameRules::PlayerKill(player pl)
{
//print("PlayerKill!\n");
}
void
CGameRules::PlayerDeath(player pl)
{
//print("PlayerDeath!\n");
}
void
CGameRules::PlayerPain(player pl)
{ {
//print("ClientKill!\n"); //print("ClientKill!\n");
} }

View file

@ -31,6 +31,8 @@ class CGameRules
virtual void(player) PlayerSpawn; virtual void(player) PlayerSpawn;
virtual void(player) PlayerPreFrame; virtual void(player) PlayerPreFrame;
virtual void(player) PlayerPostFrame; virtual void(player) PlayerPostFrame;
virtual void(player) PlayerDeath;
virtual void(player) PlayerPain;
/* level transitions */ /* level transitions */
virtual void(void) LevelNewParms; virtual void(void) LevelNewParms;

View file

@ -15,9 +15,36 @@
*/ */
void void
HLMultiplayerRules::LevelDecodeParms(player pl) HLMultiplayerRules::PlayerDeath(player pl)
{ {
pl.movetype = MOVETYPE_NONE;
pl.solid = SOLID_NOT;
pl.takedamage = DAMAGE_NO;
pl.flags &= ~FL_FLASHLIGHT;
pl.armor = pl.activeweapon = pl.g_items = 0;
pl.think = PutClientInServer;
pl.nextthink = time + 4.0f;
if (pl.health < -50) {
pl.health = 0;
Effect_GibHuman(pl.origin);
return;
}
pl.health = 0;
/* Let's handle corpses on the clientside */
entity corpse = spawn();
setorigin(corpse, pl.origin + [0,0,32]);
setmodel(corpse, pl.model);
setsize(corpse, VEC_HULL_MIN, VEC_HULL_MAX);
corpse.movetype = MOVETYPE_TOSS;
corpse.solid = SOLID_TRIGGER;
corpse.modelindex = pl.modelindex;
corpse.frame = ANIM_DIESIMPLE;
corpse.angles = pl.angles;
corpse.velocity = pl.velocity;
} }
void void
@ -65,7 +92,3 @@ HLMultiplayerRules::PlayerSpawn(player pl)
Client_FixAngle(pl, pl.angles); Client_FixAngle(pl, pl.angles);
} }
void weaponbox_spawn(player pl)
{
}

View file

@ -14,11 +14,39 @@
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/ */
class HLMultiplayerRules:HLGameRules void
HLMultiplayerRules::PlayerDeath(player pl)
{ {
/* client */ pl.movetype = MOVETYPE_NONE;
virtual void(player) PlayerSpawn; pl.solid = SOLID_NOT;
}; pl.takedamage = DAMAGE_NO;
pl.flags &= ~FL_FLASHLIGHT;
pl.armor = pl.activeweapon = pl.g_items = 0;
pl.think = PutClientInServer;
pl.nextthink = time + 4.0f;
sound(pl, CHAN_AUTO, "fvox/flatline.wav", 1.0, ATTN_NORM);
if (pl.health < -50) {
pl.health = 0;
Effect_GibHuman(pl.origin);
return;
}
pl.health = 0;
/* Let's handle corpses on the clientside */
entity corpse = spawn();
setorigin(corpse, pl.origin + [0,0,32]);
setmodel(corpse, pl.model);
setsize(corpse, VEC_HULL_MIN, VEC_HULL_MAX);
corpse.movetype = MOVETYPE_TOSS;
corpse.solid = SOLID_TRIGGER;
corpse.modelindex = pl.modelindex;
corpse.frame = ANIM_DIESIMPLE;
corpse.angles = pl.angles;
corpse.velocity = pl.velocity;
}
void void
HLMultiplayerRules::PlayerSpawn(player pl) HLMultiplayerRules::PlayerSpawn(player pl)
@ -71,7 +99,3 @@ HLMultiplayerRules::PlayerSpawn(player pl)
Client_FixAngle(pl, pl.angles); Client_FixAngle(pl, pl.angles);
} }
void weaponbox_spawn(player pl)
{
}

View file

@ -16,6 +16,42 @@
var int autocvar_sv_playerkeepalive = TRUE; var int autocvar_sv_playerkeepalive = TRUE;
void
SHMultiplayerRules::PlayerDeath(player pl)
{
weaponbox_spawn(pl);
pl.movetype = MOVETYPE_NONE;
pl.solid = SOLID_NOT;
pl.takedamage = DAMAGE_NO;
pl.flags &= ~FL_FLASHLIGHT;
pl.armor = pl.activeweapon = pl.g_items = 0;
pl.think = PutClientInServer;
pl.nextthink = time + 4.0f;
sound(pl, CHAN_AUTO, "fvox/flatline.wav", 1.0, ATTN_NORM);
if (pl.health < -50) {
pl.health = 0;
Effect_GibHuman(pl.origin);
return;
}
pl.health = 0;
/* Let's handle corpses on the clientside */
entity corpse = spawn();
setorigin(corpse, pl.origin + [0,0,32]);
setmodel(corpse, pl.model);
setsize(corpse, VEC_HULL_MIN, VEC_HULL_MAX);
corpse.movetype = MOVETYPE_TOSS;
corpse.solid = SOLID_TRIGGER;
corpse.modelindex = pl.modelindex;
corpse.frame = ANIM_DIESIMPLE;
corpse.angles = pl.angles;
corpse.velocity = pl.velocity;
}
void void
SHMultiplayerRules::PlayerSpawn(player pl) SHMultiplayerRules::PlayerSpawn(player pl)
{ {

View file

@ -23,6 +23,7 @@ class SHMultiplayerRules:CGameRules
virtual void(entity) PlayerConnect; virtual void(entity) PlayerConnect;
virtual void(entity) PlayerDisconnect; virtual void(entity) PlayerDisconnect;
virtual void(player) PlayerKill; virtual void(player) PlayerKill;
virtual void(player) PlayerDeath;
virtual void(player) PlayerPostFrame; virtual void(player) PlayerPostFrame;
virtual void(player) LevelDecodeParms; virtual void(player) LevelDecodeParms;

View file

@ -36,6 +36,7 @@ Damage_Obituary(entity c, entity t, float weapon, float flags)
void void
Damage_Apply(entity t, entity c, float dmg, int w, int type) Damage_Apply(entity t, entity c, float dmg, int w, int type)
{ {
CGameRules rules = (CGameRules)g_grMode;
if (t.flags & FL_GODMODE) { if (t.flags & FL_GODMODE) {
return; return;
} }
@ -99,9 +100,17 @@ Damage_Apply(entity t, entity c, float dmg, int w, int type)
if (t.flags & FL_MONSTER || t.flags & FL_CLIENT) { if (t.flags & FL_MONSTER || t.flags & FL_CLIENT) {
Damage_Obituary(c, t, w, 0); Damage_Obituary(c, t, w, 0);
} }
s.Death(trace_surface_id); if (s.flags & FL_CLIENT) {
rules.PlayerDeath((player)s);
} else {
s.Death(trace_surface_id);
}
} else { } else {
s.Pain(trace_surface_id); if (s.flags & FL_CLIENT) {
rules.PlayerPain((player)s);
} else {
s.Pain(trace_surface_id);
}
} }
} }

View file

@ -32,10 +32,12 @@ class HLSingleplayerRules:HLGameRules
{ {
/* client */ /* client */
virtual void(player) PlayerSpawn; virtual void(player) PlayerSpawn;
virtual void(player) PlayerDeath;
}; };
class HLMultiplayerRules:HLGameRules class HLMultiplayerRules:HLGameRules
{ {
/* client */ /* client */
virtual void(player) PlayerSpawn; virtual void(player) PlayerSpawn;
virtual void(player) PlayerDeath;
}; };

View file

@ -14,6 +14,41 @@
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/ */
void
HLMultiplayerRules::PlayerDeath(player pl)
{
weaponbox_spawn(pl);
pl.movetype = MOVETYPE_NONE;
pl.solid = SOLID_NOT;
pl.takedamage = DAMAGE_NO;
pl.flags &= ~FL_FLASHLIGHT;
pl.armor = pl.activeweapon = pl.g_items = 0;
pl.think = PutClientInServer;
pl.nextthink = time + 4.0f;
sound(pl, CHAN_AUTO, "fvox/flatline.wav", 1.0, ATTN_NORM);
if (pl.health < -50) {
pl.health = 0;
Effect_GibHuman(pl.origin);
return;
}
pl.health = 0;
/* Let's handle corpses on the clientside */
entity corpse = spawn();
setorigin(corpse, pl.origin + [0,0,32]);
setmodel(corpse, pl.model);
setsize(corpse, VEC_HULL_MIN, VEC_HULL_MAX);
corpse.movetype = MOVETYPE_TOSS;
corpse.solid = SOLID_TRIGGER;
corpse.modelindex = pl.modelindex;
corpse.frame = ANIM_DIESIMPLE;
corpse.angles = pl.angles;
corpse.velocity = pl.velocity;
}
void void
HLMultiplayerRules::PlayerSpawn(player pl) HLMultiplayerRules::PlayerSpawn(player pl)
{ {

View file

@ -14,6 +14,25 @@
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/ */
void
HLSingleplayerRules::PlayerDeath(player pl)
{
pl.movetype = MOVETYPE_NONE;
pl.solid = SOLID_NOT;
pl.takedamage = DAMAGE_NO;
pl.flags &= ~FL_FLASHLIGHT;
pl.armor = pl.activeweapon = pl.g_items = 0;
sound(pl, CHAN_AUTO, "fvox/flatline.wav", 1.0, ATTN_NORM);
if (pl.health < -50) {
pl.health = 0;
Effect_GibHuman(pl.origin);
return;
}
pl.health = 0;
}
void void
HLSingleplayerRules::PlayerSpawn(player pl) HLSingleplayerRules::PlayerSpawn(player pl)
{ {

View file

@ -14,47 +14,6 @@
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/ */
void weaponbox_spawn(player);
void player::Pain(int hit)
{
}
void player::Death(int hit)
{
weaponbox_spawn(this);
movetype = MOVETYPE_NONE;
solid = SOLID_NOT;
takedamage = DAMAGE_NO;
flags &= ~FL_FLASHLIGHT;
armor = activeweapon = g_items = 0;
think = PutClientInServer;
nextthink = time + 4.0f;
sound(this, CHAN_AUTO, "fvox/flatline.wav", 1.0, ATTN_NORM);
if (health < -50) {
health = 0;
Effect_GibHuman(origin);
return;
}
health = 0;
/* Let's handle corpses on the clientside */
entity corpse = spawn();
setorigin(corpse, origin + [0,0,32]);
setmodel(corpse, model);
setsize(corpse, VEC_HULL_MIN, VEC_HULL_MAX);
corpse.movetype = MOVETYPE_TOSS;
corpse.solid = SOLID_TRIGGER;
corpse.modelindex = modelindex;
corpse.frame = ANIM_DIESIMPLE;
corpse.angles = angles;
corpse.velocity = velocity;
}
/* /*
==================== ====================
UseWorkaround UseWorkaround

View file

@ -56,7 +56,8 @@ Vote_Reset(void)
forceinfokey(world, "vote_cmd", ""); forceinfokey(world, "vote_cmd", "");
for (entity e = world; (e = find(e, ::classname, "player"));) { for (entity e = world; (e = find(e, ::classname, "player"));) {
e.flags &= ~FL_VOTED; player pl = (player)e;
pl.voted = 0;
} }
} }
@ -127,6 +128,8 @@ CSEv_VoteY
void void
CSEv_VoteY(void) CSEv_VoteY(void)
{ {
player pl = (player)self;
/* No vote is in progress */ /* No vote is in progress */
if (g_iVoteState != VOTE_INPROGRESS) { if (g_iVoteState != VOTE_INPROGRESS) {
return; return;
@ -136,12 +139,12 @@ CSEv_VoteY(void)
return; return;
} }
if (self.flags & FL_VOTED) { if (pl.voted) {
return; return;
} }
forceinfokey(world, "votes_y", ftos(serverkeyfloat("votes_y")+1)); forceinfokey(world, "votes_y", ftos(serverkeyfloat("votes_y")+1));
self.flags |= FL_VOTED; pl.voted = 1;
/* HACK: Is there a better way to do this? */ /* HACK: Is there a better way to do this? */
float playernums = 0; float playernums = 0;
@ -170,6 +173,8 @@ CSEv_VoteN
void void
CSEv_VoteN(void) CSEv_VoteN(void)
{ {
player pl = (player)self;
/* No vote is in progress */ /* No vote is in progress */
if (g_iVoteState != VOTE_INPROGRESS) { if (g_iVoteState != VOTE_INPROGRESS) {
return; return;
@ -179,12 +184,12 @@ CSEv_VoteN(void)
return; return;
} }
if (self.flags & FL_VOTED) { if (pl.voted) {
return; return;
} }
forceinfokey(world, "votes_n", ftos(serverkeyfloat("votes_n")+1)); forceinfokey(world, "votes_n", ftos(serverkeyfloat("votes_n")+1));
self.flags |= FL_VOTED; pl.voted = 1;
/* HACK: Is there a better way to do this? */ /* HACK: Is there a better way to do this? */
float playernums = 0; float playernums = 0;

View file

@ -18,21 +18,17 @@
#include "weapons.h" #include "weapons.h"
#include "items.h" #include "items.h"
enum
{
STAT_BUYZONE = 34,
STAT_ESCAPEZONE,
STAT_VIPZONE,
STAT_HOSTAGEZONE,
STAT_BOMBZONE,
STAT_MONEY,
STAT_TEAM,
STAT_GAMETIME,
STAT_GAMESTATE,
STAT_WON_T,
STAT_WON_CT
};
#define TEAM_T 1 #define TEAM_T 1
#define TEAM_CT 2 #define TEAM_CT 2
#define TEAM_VIP 3 #define TEAM_VIP 3
#define FL_BUYZONE (1<<21)
#define FL_RESCUEZONE (1<<22)
#define FL_BOMBZONE (1<<23)
enum
{
STAT_MONEY = 34,
STAT_GAMETIME,
STAT_GAMESTATE
};

View file

@ -85,7 +85,6 @@ class player:CBaseEntity
virtual float() predraw; virtual float() predraw;
virtual void(void) postdraw; virtual void(void) postdraw;
#else #else
int buyzone;
int charmodel; int charmodel;
int money; int money;
int ammo_50ae; int ammo_50ae;
@ -148,6 +147,8 @@ class player:CBaseEntity
int old_a_ammo2; int old_a_ammo2;
int old_a_ammo3; int old_a_ammo3;
int voted;
int old_cs_shotmultiplier; int old_cs_shotmultiplier;
float old_cs_shottime; float old_cs_shottime;
#endif #endif

View file

@ -225,7 +225,11 @@ void
w_c4bomb_primary(void) w_c4bomb_primary(void)
{ {
player pl = (player)self; player pl = (player)self;
if (!(pl.flags & FL_BOMBZONE)) {
return;
}
pl.flags |= FL_FROZEN; pl.flags |= FL_FROZEN;
switch (pl.a_ammo1) { switch (pl.a_ammo1) {

View file

@ -34,12 +34,12 @@
/* nuclide */ /* nuclide */
#define FL_ONLADDER (1<<13) #define FL_ONLADDER (1<<13)
#define FL_FLASHLIGHT (1<<17) #define FL_FLASHLIGHT (1<<17)
#define FL_REMOVEME (1<<18) #define FL_CROUCHING (1<<18)
#define FL_CROUCHING (1<<19) #define FL_SEMI_TOGGLED (1<<19)
#define FL_SEMI_TOGGLED (1<<20) #define FL_FROZEN (1<<20)
#define FL_FROZEN (1<<21) #define FL_RESERVED1 (1<<21)
#define FL_VOTED (1<<22) #define FL_RESERVED2 (1<<22)
#define FL_RESERVED (1<<23) #define FL_RESERVED3 (1<<23)
/* game flags */ /* game flags */
#define GF_UNUSED1 (1<<0) #define GF_UNUSED1 (1<<0)

View file

@ -125,8 +125,7 @@ class player:CBaseEntity
int old_a_ammo2; int old_a_ammo2;
int old_a_ammo3; int old_a_ammo3;
virtual void(int) Pain; int voted;
virtual void(int) Death;
#endif #endif
}; };

View file

@ -123,9 +123,7 @@ class player:CBaseEntity
int old_a_ammo1; int old_a_ammo1;
int old_a_ammo2; int old_a_ammo2;
int old_a_ammo3; int old_a_ammo3;
int voted;
virtual void(int) Pain;
virtual void(int) Death;
#endif #endif
}; };

View file

@ -106,9 +106,7 @@ class player:CBaseEntity
int old_a_ammo1; int old_a_ammo1;
int old_a_ammo2; int old_a_ammo2;
int old_a_ammo3; int old_a_ammo3;
int voted;
virtual void(int) Pain;
virtual void(int) Death;
#endif #endif
}; };

View file

@ -122,8 +122,7 @@ class player:CBaseEntity
int old_a_ammo2; int old_a_ammo2;
int old_a_ammo3; int old_a_ammo3;
virtual void(int) Pain; int voted;
virtual void(int) Death;
#endif #endif
}; };

View file

@ -115,8 +115,6 @@ class player:CBaseEntity
int old_a_ammo1; int old_a_ammo1;
int old_a_ammo2; int old_a_ammo2;
int old_a_ammo3; int old_a_ammo3;
int voted;
virtual void(int) Pain;
virtual void(int) Death;
#endif #endif
}; };

View file

@ -115,8 +115,7 @@ class player:CBaseEntity
int old_a_ammo2; int old_a_ammo2;
int old_a_ammo3; int old_a_ammo3;
virtual void(int) Pain; int voted;
virtual void(int) Death;
#endif #endif
}; };

View file

@ -1,7 +1,3 @@
#ifndef WASTES
#define CLASSIC_VGUI
#endif
#includelist #includelist
../vgui/font.cpp ../vgui/font.cpp
../vgui/ui.cpp ../vgui/ui.cpp

View file

@ -69,15 +69,15 @@ void CUIScrollbar::Draw(void)
drawfill(m_parent.m_vecOrigin + m_vecOrigin, vecSize, m_vecColor, m_flAlpha); drawfill(m_parent.m_vecOrigin + m_vecOrigin, vecSize, m_vecColor, m_flAlpha);
if (m_iFlags & BUTTON_DOWN) { if (m_iFlags & BUTTON_DOWN) {
drawfill(m_parent.m_vecOrigin + m_vecOrigin + [0, vecSize[1] - 1], [vecSize[0], 1], '1 1 1', 0.5f); drawfill(m_parent.m_vecOrigin + m_vecOrigin + [0, vecSize[1] - 1], [vecSize[0], 1], [1,1,1], 0.5f);
drawfill(m_parent.m_vecOrigin + m_vecOrigin, [vecSize[0], 1], '0 0 0', 0.5f); drawfill(m_parent.m_vecOrigin + m_vecOrigin, [vecSize[0], 1], [0,0,0], 0.5f);
drawfill(m_parent.m_vecOrigin + m_vecOrigin + [0, 1], [1, vecSize[1] - 2], '0 0 0', 0.5f); drawfill(m_parent.m_vecOrigin + m_vecOrigin + [0, 1], [1, vecSize[1] - 2], [0,0,0], 0.5f);
drawfill(m_parent.m_vecOrigin + m_vecOrigin + [vecSize[0] - 1, 1], [1, vecSize[1] - 2], '1 1 1', 0.5f); drawfill(m_parent.m_vecOrigin + m_vecOrigin + [vecSize[0] - 1, 1], [1, vecSize[1] - 2], [1,1,1], 0.5f);
} else { } else {
drawfill(m_parent.m_vecOrigin + m_vecOrigin + [0, vecSize[1] - 1], [vecSize[0], 1], '0 0 0', 0.5f); drawfill(m_parent.m_vecOrigin + m_vecOrigin + [0, vecSize[1] - 1], [vecSize[0], 1], [0,0,0], 0.5f);
drawfill(m_parent.m_vecOrigin + m_vecOrigin, [vecSize[0], 1], '1 1 1', 0.5f); drawfill(m_parent.m_vecOrigin + m_vecOrigin, [vecSize[0], 1], [1,1,1], 0.5f);
drawfill(m_parent.m_vecOrigin + m_vecOrigin + [0, 1], [1, vecSize[1] - 2], '1 1 1', 0.5f); drawfill(m_parent.m_vecOrigin + m_vecOrigin + [0, 1], [1, vecSize[1] - 2], [1,1,1], 0.5f);
drawfill(m_parent.m_vecOrigin + m_vecOrigin + [vecSize[0] - 1, 1], [1, vecSize[1] - 2], '0 0 0', 0.5f); drawfill(m_parent.m_vecOrigin + m_vecOrigin + [vecSize[0] - 1, 1], [1, vecSize[1] - 2], [0,0,0], 0.5f);
} }
#else #else
drawfill(m_parent.m_vecOrigin + m_vecOrigin + [0, vecSize[1] - 1], [vecSize[0], 1], m_vecColor, 1.0f); drawfill(m_parent.m_vecOrigin + m_vecOrigin + [0, vecSize[1] - 1], [vecSize[0], 1], m_vecColor, 1.0f);
@ -93,67 +93,67 @@ void CUIScrollbar::Draw(void)
vecSliderPos[1] += (m_iLength - 60) * (m_flValue / m_flMax); vecSliderPos[1] += (m_iLength - 60) * (m_flValue / m_flMax);
// Slider Button // Slider Button
drawfill(vecSliderPos, '20 20', m_vecColor, m_flAlpha); drawfill(vecSliderPos, [20,20], m_vecColor, m_flAlpha);
if (m_iFlags & SCROLLBAR_SLIDER_DOWN) { if (m_iFlags & SCROLLBAR_SLIDER_DOWN) {
drawfill(vecSliderPos, [20, 1], '0 0 0', 0.5f); drawfill(vecSliderPos, [20, 1], [0,0,0], 0.5f);
drawfill(vecSliderPos + [0, 19], [20, 1], '1 1 1', 0.5f); drawfill(vecSliderPos + [0, 19], [20, 1], [1,1,1], 0.5f);
drawfill(vecSliderPos + [0, 1], [1, 18], '0 0 0', 0.5f); drawfill(vecSliderPos + [0, 1], [1, 18], [0,0,0], 0.5f);
drawfill(vecSliderPos + [19, 1], [1, 18], '1 1 1', 0.5f); drawfill(vecSliderPos + [19, 1], [1, 18], [1,1,1], 0.5f);
} else { } else {
drawfill(vecSliderPos, [20, 1], '1 1 1', 0.5f); drawfill(vecSliderPos, [20, 1], [1,1,1], 0.5f);
drawfill(vecSliderPos + [0, 19], [20, 1], '0 0 0', 0.5f); drawfill(vecSliderPos + [0, 19], [20, 1], [0,0,0], 0.5f);
drawfill(vecSliderPos + [0, 1], [1, 18], '1 1 1', 0.5f); drawfill(vecSliderPos + [0, 1], [1, 18], [1,1,1], 0.5f);
drawfill(vecSliderPos + [19, 1], [1, 18], '0 0 0', 0.5f); drawfill(vecSliderPos + [19, 1], [1, 18], [0,0,0], 0.5f);
} }
// Button UP // Button UP
#ifndef CLASSIC_VGUI #ifndef CLASSIC_VGUI
drawfill(vecUpPos, '20 20', m_vecColor, m_flAlpha); drawfill(vecUpPos, [20,20], m_vecColor, m_flAlpha);
if (m_iFlags & SCROLLBAR_UP_DOWN) { if (m_iFlags & SCROLLBAR_UP_DOWN) {
drawfill(vecUpPos, [20, 1], '0 0 0', 0.5f); drawfill(vecUpPos, [20, 1], [0,0,0], 0.5f);
drawfill(vecUpPos + [0, 19], [20, 1], '1 1 1', 0.5f); drawfill(vecUpPos + [0, 19], [20, 1], [1,1,1], 0.5f);
drawfill(vecUpPos + [0, 1], [1, 18], '0 0 0', 0.5f); drawfill(vecUpPos + [0, 1], [1, 18], [0,0,0], 0.5f);
drawfill(vecUpPos + [19, 1], [1, 18], '1 1 1', 0.5f); drawfill(vecUpPos + [19, 1], [1, 18], [1,1,1], 0.5f);
} else { } else {
drawfill(vecUpPos, [20, 1], '1 1 1', 0.5f); drawfill(vecUpPos, [20, 1], [1,1,1], 0.5f);
drawfill(vecUpPos + [0, 19], [20, 1], '0 0 0', 0.5f); drawfill(vecUpPos + [0, 19], [20, 1], [0,0,0], 0.5f);
drawfill(vecUpPos + [0, 1], [1, 18], '1 1 1', 0.5f); drawfill(vecUpPos + [0, 1], [1, 18], [1,1,1], 0.5f);
drawfill(vecUpPos + [19, 1], [1, 18], '0 0 0', 0.5f); drawfill(vecUpPos + [19, 1], [1, 18], [0,0,0], 0.5f);
} }
drawpic(vecUpPos + '2 2', "textures/ui/steam/icon_up", '16 16', '1 1 1', 1.0f, 0); drawpic(vecUpPos + [2,2], "textures/ui/steam/icon_up", [16,16], [1,1,1], 1.0f, 0);
#else #else
if (m_iFlags & SCROLLBAR_UP_DOWN) { if (m_iFlags & SCROLLBAR_UP_DOWN) {
drawfill(vecUpPos, '20 20', m_vecColor, 0.25f); drawfill(vecUpPos, [20,20], m_vecColor, 0.25f);
drawfill(vecUpPos, [20, 1], m_vecColor, 1.0f); drawfill(vecUpPos, [20, 1], m_vecColor, 1.0f);
drawfill(vecUpPos + [0, 19], [20, 1], m_vecColor, 1.0f); drawfill(vecUpPos + [0, 19], [20, 1], m_vecColor, 1.0f);
drawfill(vecUpPos + [0, 1], [1, 18], m_vecColor, 1.0f); drawfill(vecUpPos + [0, 1], [1, 18], m_vecColor, 1.0f);
drawfill(vecUpPos + [19, 1], [1, 18], m_vecColor, 1.0f); drawfill(vecUpPos + [19, 1], [1, 18], m_vecColor, 1.0f);
} else { } else {
drawfill(vecUpPos, [20, 1], '1 1 1', 0.5f); drawfill(vecUpPos, [20, 1], [1,1,1], 0.5f);
drawfill(vecUpPos + [0, 19], [20, 1], m_vecColor, 1.0f); drawfill(vecUpPos + [0, 19], [20, 1], m_vecColor, 1.0f);
drawfill(vecUpPos + [0, 1], [1, 18], m_vecColor, 1.0f); drawfill(vecUpPos + [0, 1], [1, 18], m_vecColor, 1.0f);
drawfill(vecUpPos + [19, 1], [1, 18], m_vecColor, 1.0f); drawfill(vecUpPos + [19, 1], [1, 18], m_vecColor, 1.0f);
} }
drawpic(vecUpPos + '2 2', "textures/ui/steam/icon_up", '16 16', m_vecColor, 1.0f, 0); drawpic(vecUpPos + [2,2], "textures/ui/steam/icon_up", [16,16], m_vecColor, 1.0f, 0);
#endif #endif
// Button DOWN // Button DOWN
#ifndef CLASSIC_VGUI #ifndef CLASSIC_VGUI
drawfill(vecDownPos, '20 20', m_vecColor, m_flAlpha); drawfill(vecDownPos, [20,20], m_vecColor, m_flAlpha);
if (m_iFlags & SCROLLBAR_DN_DOWN) { if (m_iFlags & SCROLLBAR_DN_DOWN) {
drawfill(vecDownPos, [20, 1], '0 0 0', 0.5f); drawfill(vecDownPos, [20, 1], [0,0,0], 0.5f);
drawfill(vecDownPos + [0, 19], [20, 1], '1 1 1', 0.5f); drawfill(vecDownPos + [0, 19], [20, 1], [1,1,1], 0.5f);
drawfill(vecDownPos + [0, 1], [1, 18], '0 0 0', 0.5f); drawfill(vecDownPos + [0, 1], [1, 18], [0,0,0], 0.5f);
drawfill(vecDownPos + [19, 1], [1, 18], '1 1 1', 0.5f); drawfill(vecDownPos + [19, 1], [1, 18], [1,1,1], 0.5f);
} else { } else {
drawfill(vecDownPos, [20, 1], '1 1 1', 0.5f); drawfill(vecDownPos, [20, 1], [1,1,1], 0.5f);
drawfill(vecDownPos+ [0, 19], [20, 1], '0 0 0', 0.5f); drawfill(vecDownPos+ [0, 19], [20, 1], [0,0,0], 0.5f);
drawfill(vecDownPos + [0, 1], [1, 18], '1 1 1', 0.5f); drawfill(vecDownPos + [0, 1], [1, 18], [1,1,1], 0.5f);
drawfill(vecDownPos + [19, 1], [1, 18], '0 0 0', 0.5f); drawfill(vecDownPos + [19, 1], [1, 18], [0,0,0], 0.5f);
} }
drawpic(vecDownPos + '2 2', "textures/ui/steam/icon_down", '16 16', '1 1 1', 1.0f, 0); drawpic(vecDownPos + [2,2], "textures/ui/steam/icon_down", [16,16], [1,1,1], 1.0f, 0);
#else #else
if (m_iFlags & SCROLLBAR_DN_DOWN) { if (m_iFlags & SCROLLBAR_DN_DOWN) {
drawfill(vecDownPos, '20 20', m_vecColor, 0.25f); drawfill(vecDownPos, [20,20], m_vecColor, 0.25f);
drawfill(vecDownPos, [20, 1], m_vecColor, 1.0f); drawfill(vecDownPos, [20, 1], m_vecColor, 1.0f);
drawfill(vecDownPos + [0, 19], [20, 1], m_vecColor, 1.0f); drawfill(vecDownPos + [0, 19], [20, 1], m_vecColor, 1.0f);
drawfill(vecDownPos + [0, 1], [1, 18], m_vecColor, 1.0f); drawfill(vecDownPos + [0, 1], [1, 18], m_vecColor, 1.0f);
@ -164,7 +164,7 @@ void CUIScrollbar::Draw(void)
drawfill(vecDownPos + [0, 1], [1, 18], m_vecColor, 1.0f); drawfill(vecDownPos + [0, 1], [1, 18], m_vecColor, 1.0f);
drawfill(vecDownPos + [19, 1], [1, 18], m_vecColor, 1.0f); drawfill(vecDownPos + [19, 1], [1, 18], m_vecColor, 1.0f);
} }
drawpic(vecDownPos + '2 2', "textures/ui/steam/icon_down", '16 16', m_vecColor, 1.0f, 0); drawpic(vecDownPos + [2,2], "textures/ui/steam/icon_down", [16,16], m_vecColor, 1.0f, 0);
#endif #endif
} }
@ -175,17 +175,17 @@ void CUIScrollbar::Input (float flEVType, float flKey, float flChar, float flDev
if (flEVType == IE_KEYDOWN) { if (flEVType == IE_KEYDOWN) {
if (flKey == K_MOUSE1) { if (flKey == K_MOUSE1) {
if (Util_MouseAbove(getmousepos(), vecUpPos, '20 20')) { if (Util_MouseAbove(getmousepos(), vecUpPos, [20,20])) {
m_iFlags |= SCROLLBAR_UP_DOWN; m_iFlags |= SCROLLBAR_UP_DOWN;
} else if (Util_MouseAbove(getmousepos(), vecDownPos, '20 20')) { } else if (Util_MouseAbove(getmousepos(), vecDownPos, [20,20])) {
m_iFlags |= SCROLLBAR_DN_DOWN; m_iFlags |= SCROLLBAR_DN_DOWN;
} }
} }
} else if (flEVType == IE_KEYUP) { } else if (flEVType == IE_KEYUP) {
if (flKey == K_MOUSE1) { if (flKey == K_MOUSE1) {
if (m_iFlags & SCROLLBAR_UP_DOWN && Util_MouseAbove(getmousepos(), vecUpPos, '20 20')) { if (m_iFlags & SCROLLBAR_UP_DOWN && Util_MouseAbove(getmousepos(), vecUpPos, [20,20])) {
SetValue(GetValue() - GetStep(), TRUE); SetValue(GetValue() - GetStep(), TRUE);
} else if (m_iFlags & SCROLLBAR_DN_DOWN && Util_MouseAbove(getmousepos(), vecDownPos, '20 20')) { } else if (m_iFlags & SCROLLBAR_DN_DOWN && Util_MouseAbove(getmousepos(), vecDownPos, [20,20])) {
SetValue(GetValue() + GetStep(), TRUE); SetValue(GetValue() + GetStep(), TRUE);
} }
m_iFlags -= (m_iFlags & SCROLLBAR_UP_DOWN); m_iFlags -= (m_iFlags & SCROLLBAR_UP_DOWN);