Skip to content

Commit

Permalink
VGUI Buy-Menu: Fix not being able to buy SG-550 as CT.
Browse files Browse the repository at this point in the history
Set the skull icon next to the player names in the scoreboard.
  • Loading branch information
eukara committed Mar 2, 2024
1 parent b6a4fb9 commit 0f445d8
Show file tree
Hide file tree
Showing 12 changed files with 51 additions and 23 deletions.
6 changes: 2 additions & 4 deletions src/client/game_event.qc
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,15 @@ switch (fHeader) {
float fSender = readbyte();
float fTeam = readbyte();
string sMessage = readstring();
string strName = strcat(HUD_GetChatColorHEX(getplayerkeyfloat(fSender, "*team")), getplayerkeyvalue(fSender, "name"));

CSQC_Parse_Print(sprintf("%s^xF80: %s", strName, sMessage), PRINT_CHAT);
CSQC_Parse_Print(Util_ChatFormat(fSender, 0, sMessage), PRINT_CHAT);
break;
case EV_CHAT_TEAM:
float fSender2 = readbyte();
float fTeam2 = readbyte();
string sMessage2 = readstring();
string strName2 = strcat(HUD_GetChatColorHEX(getplayerkeyfloat(fSender2, "*team")), getplayerkeyvalue(fSender2, "name"));

CSQC_Parse_Print(sprintf("^xF80[TEAM] ^7%s^7^xF80: %s", strName2, sMessage2), PRINT_CHAT);
CSQC_Parse_Print(Util_ChatFormat(fSender2, fTeam2, sMessage2), PRINT_CHAT);
break;
case EV_VIEWMODEL:
View_PlayAnimation(readbyte());
Expand Down
23 changes: 13 additions & 10 deletions src/client/hud_weaponselect.qc
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/

void View_ForceChange(player pl, int targetWeapon);

vector g_vecHUDNums[6] =
{
[168 / 256, 72 / 256],
Expand All @@ -35,9 +37,10 @@ HUD_DrawWeaponSelect_Forward(void)

if (pSeat->m_flHUDWeaponSelectTime < time) {
pSeat->m_iHUDWeaponSelected = pl.activeweapon;
sound(pSeat->m_ePlayer, CHAN_ITEM, "common/wpn_hudon.wav", 0.5, ATTN_NONE);
pl.StartSoundDef("Player.WeaponSelectionOpen", CHAN_ITEM, false);
} else {
sound(pSeat->m_ePlayer, CHAN_ITEM, "common/wpn_moveselect.wav", 0.5, ATTN_NONE);
pl.StartSoundDef("Player.WeaponSelectionMoveSlot", CHAN_ITEM, false);

pSeat->m_iHUDWeaponSelected--;
if (pSeat->m_iHUDWeaponSelected <= 0) {
pSeat->m_iHUDWeaponSelected = g_weapons.length - 1;
Expand All @@ -62,9 +65,10 @@ HUD_DrawWeaponSelect_Back(void)

if (pSeat->m_flHUDWeaponSelectTime < time) {
pSeat->m_iHUDWeaponSelected = pl.activeweapon;
sound(pSeat->m_ePlayer, CHAN_ITEM, "common/wpn_hudon.wav", 0.5, ATTN_NONE);
pl.StartSoundDef("Player.WeaponSelectionOpen", CHAN_ITEM, false);
} else {
sound(pSeat->m_ePlayer, CHAN_ITEM, "common/wpn_moveselect.wav", 0.5, ATTN_NONE);
pl.StartSoundDef("Player.WeaponSelectionMoveSlot", CHAN_ITEM, false);

pSeat->m_iHUDWeaponSelected++;
if (pSeat->m_iHUDWeaponSelected >= g_weapons.length) {
pSeat->m_iHUDWeaponSelected = 1;
Expand All @@ -84,11 +88,10 @@ HUD_DrawWeaponSelect_Trigger(void)
player pl = (player)pSeat->m_ePlayer;

if (pl.activeweapon != pSeat->m_iHUDWeaponSelected)
sendevent("PlayerSwitchWeapon", "i", pSeat->m_iHUDWeaponSelected);
View_ForceChange(pl, pSeat->m_iHUDWeaponSelected);

pl.activeweapon = pSeat->m_iHUDWeaponSelected;

sound(pSeat->m_ePlayer, CHAN_ITEM, "common/wpn_select.wav", 0.5f, ATTN_NONE);
pl.StartSoundDef("Player.WeaponSelected", CHAN_ITEM, false);
pSeat->m_iHUDWeaponSelected = pSeat->m_flHUDWeaponSelectTime = 0;
}

Expand Down Expand Up @@ -142,9 +145,9 @@ HUD_SlotSelect(int slot)
}

if (pSeat->m_flHUDWeaponSelectTime < time) {
sound(pSeat->m_ePlayer, CHAN_ITEM, "common/wpn_hudon.wav", 0.5, ATTN_NONE);
pl.StartSoundDef("Player.WeaponSelectionOpen", CHAN_ITEM, false);
} else {
sound(pSeat->m_ePlayer, CHAN_ITEM, "common/wpn_moveselect.wav", 0.5, ATTN_NONE);
pl.StartSoundDef("Player.WeaponSelectionMoveSlot", CHAN_ITEM, false);
}

/* weren't in that slot? select the first one then */
Expand Down Expand Up @@ -187,7 +190,7 @@ HUD_DrawWeaponSelect(void)
}
if (pSeat->m_flHUDWeaponSelectTime < time) {
if (pSeat->m_iHUDWeaponSelected) {
sound(pSeat->m_ePlayer, CHAN_ITEM, "common/wpn_hudoff.wav", 0.5, ATTN_NONE);
pl.StartSoundDef("Player.WeaponSelectionClose", CHAN_ITEM, false);
pSeat->m_iHUDWeaponSelected = 0;
}
return;
Expand Down
2 changes: 2 additions & 0 deletions src/client/init.qc
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ ClientGame_InitDone(void)
VGUI_ShowMOTD();
}

void HLSprite_Init(void);
void
ClientGame_RendererRestart(string rstr)
{
Expand Down Expand Up @@ -167,6 +168,7 @@ ClientGame_RendererRestart(string rstr)

FX_Blood_Init();
FX_Smokenade_Init();
HLSprite_Init();

Radar_Init();
}
2 changes: 1 addition & 1 deletion src/client/vgui_buypages.qc
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ VGUI_BuyMenu_Page(int buyPage)
btnBuyItem7.SetTitle(Titles_GetTextBody("D3AU1"));
btnBuyItem7.SetTag(BUYITEM_G3SG1);
btnBuyItem8.SetTitle(Titles_GetTextBody("Krieg550"));
btnBuyItem8.SetTag(BUYITEM_G3SG1);
btnBuyItem8.SetTag(BUYITEM_SG550);
break;
case BUYPAGE_MGS:
lblBuyScreenTitle.SetTitle(Titles_GetTextBody("Title_machinegun_selection"));
Expand Down
2 changes: 1 addition & 1 deletion src/server/bot.qc
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ csbot::WeaponThink(void)

/** @brief Get entity by class name and index **/
entity
csbot::GetEntityByNameAndIndex(const string name, int index)
csbot::GetEntityByNameAndIndex(string name, int index)
{
int curIndex = 0;
for (entity a = world; (a = find(a, ::classname, name));) {
Expand Down
2 changes: 1 addition & 1 deletion src/server/gamerules_deathmatch.qc
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ CSDeathmatchRules::PlayerDeath(NSClientPlayer pl)
float gibStrength = g_dmg_iDamage * 2.0f;
BreakModel_Entity(pl, gibDir, gibStrength);
} else {
FX_Corpse_Spawn(pl, ANIM_DEATH1);
FX_Corpse_Spawn((player)pl, ANIM_DEATH1);
//FX_Corpse_Spawn((player)pl, ANIM_DIESIMPLE);
}

Expand Down
13 changes: 13 additions & 0 deletions src/server/gamerules_multiplayer.qc
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,14 @@ CSMultiplayerRules::PlayerDeath(NSClientPlayer pl)
}
}

/* scoreboard death icon */
if (g_dmg_eTarget.flags & FL_CLIENT) {
targ.SetInfoKey("*icon1", "d_skull");
targ.SetInfoKey("*icon1_r", "1");
targ.SetInfoKey("*icon1_g", "0");
targ.SetInfoKey("*icon1_b", "0");
}

Weapon_DropCurrentWeapon(targ);

/* if we're the bomb carrier, make sure we drop the bomb. */
Expand Down Expand Up @@ -880,6 +888,11 @@ CSMultiplayerRules::PlayerRespawn(NSClientPlayer pp, int fTeam)
pl.SendFlags = UPDATE_ALL;
Client_FixAngle(pl, pl.angles);

pl.SetInfoKey("*icon1", "");
pl.SetInfoKey("*icon1_r", "1");
pl.SetInfoKey("*icon1_g", "1");
pl.SetInfoKey("*icon1_b", "1");

switch (pl.charmodel) {
case 1:
pl.model = "models/player/terror/terror.mdl";
Expand Down
2 changes: 1 addition & 1 deletion src/shared/item_c4bomb.qc
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ item_c4::Logic(void)

if (dist < bestDist) {
bestDist = dist;
bestTarget = e;
bestTarget = (NSEntity)e;
}
}

Expand Down
1 change: 0 additions & 1 deletion src/shared/w_awp.qc
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@ w_awp_draw(player pl)
void
w_awp_release(player pl)
{

w_cstrike_weaponrelease();

/* auto-reload if need be */
Expand Down
4 changes: 1 addition & 3 deletions src/shared/w_deagle.qc
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@ w_deagle_draw(player pl)
void
w_deagle_primary(player pl)
{

if (pl.w_attack_next > 0.0)
return;
if (pl.gflags & GF_SEMI_TOGGLED)
Expand All @@ -153,7 +152,6 @@ w_deagle_primary(player pl)


float accuracy = Cstrike_CalculateAccuracy(pl, 55,1.5)+0.005;
int dmg;
pl.deagle_mag--;

if (pl.deagle_mag <= 0) {
Expand All @@ -179,7 +177,7 @@ w_deagle_primary(player pl)
View_SetMuzzleflash(MUZZLE_RIFLE);
View_AddEvent(w_pistol_ejectshell, 0.0f);
#else
dmg = Skill_GetValue("plr_deagle_dmg", 54);
int dmg = Skill_GetValue("plr_deagle_dmg", 54);
TraceAttack_SetRangeModifier(1.875); /* 14 but not 15 */
TraceAttack_SetPenetrationPower(1);
Cstrike_BulletRecoil_ApplyPre(pl,0.5);
Expand Down
1 change: 0 additions & 1 deletion src/shared/w_scout.qc
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ w_scout_draw(player pl)
void
w_scout_release(player pl)
{

w_cstrike_weaponrelease();

/* auto-reload if need be */
Expand Down
16 changes: 16 additions & 0 deletions zpak001.pk3dir/sound/player.sndshd
Original file line number Diff line number Diff line change
Expand Up @@ -118,4 +118,20 @@ Player.FlashLightOff
SprayCan.Paint
{
sample player/sprayer.wav
}

Player.Wade
{
sample player/pl_wade1.wav
sample player/pl_wade2.wav
sample player/pl_wade3.wav
sample player/pl_wade4.wav
}

Player.Swim
{
sample player/pl_swim1.wav
sample player/pl_swim2.wav
sample player/pl_swim3.wav
sample player/pl_swim4.wav
}

0 comments on commit 0f445d8

Please sign in to comment.