CSQC: Change references to 'self' to pSeat->ePlayer to make sure we're targetting the current clientseat. Self might refer to shadow clients.

This commit is contained in:
Marco Cawthorne 2019-03-01 17:13:47 +01:00
parent 784cc97ee7
commit e21d6e94e5
10 changed files with 26 additions and 18 deletions

View file

@ -58,5 +58,5 @@ void Chat_Parse(string msg)
// Log to console
localcmd(sprintf("echo \"%s\"\n", msg));
sound(self, CHAN_ITEM, "misc/talk.wav", 1.0, ATTN_NONE);
sound(pSeat->ePlayer, CHAN_ITEM, "misc/talk.wav", 1.0, ATTN_NONE);
}

View file

@ -111,7 +111,7 @@ Draw the current amount of health
=================
*/
void HUD_DrawHealth(void) {
player pl = (player)self;
player pl = (player)pSeat->ePlayer;
static float fOldHealth;
static float fHealthAlpha;
@ -152,7 +152,7 @@ void HUD_DrawArmor(void)
vector pos;
static float oldarmor;
static float armoralpha;
player pl = (player)self;
player pl = (player)pSeat->ePlayer;
pos = video_mins + [72+16+30, video_res[1] - 42];
@ -182,7 +182,7 @@ void HUD_DrawArmor(void)
void HUD_DrawAmmo1(void)
{
player pl = (player)self;
player pl = (player)pSeat->ePlayer;
vector pos;
static int old_ammo1;
static float ammo1_alpha;
@ -210,7 +210,7 @@ void HUD_DrawAmmo1(void)
void HUD_DrawAmmo2(void)
{
player pl = (player)self;
player pl = (player)pSeat->ePlayer;
vector pos;
static int old_ammo2;
@ -235,7 +235,7 @@ void HUD_DrawAmmo2(void)
void HUD_DrawAmmo3(void)
{
player pl = (player)self;
player pl = (player)pSeat->ePlayer;
vector pos;
static int old_ammo3;

View file

@ -17,7 +17,7 @@ vector vHUDSlotNumPos[6] = {
void HUD_DrawWeaponSelect_Forward(void)
{
player pl = (player)self;
player pl = (player)pSeat->ePlayer;
if (!pl.activeweapon) {
return;
@ -25,9 +25,9 @@ void HUD_DrawWeaponSelect_Forward(void)
if (pSeat->fHUDWeaponSelectTime < time) {
pSeat->fHUDWeaponSelected = pl.activeweapon;
sound(self, CHAN_ITEM, "common/wpn_hudon.wav", 0.5, ATTN_NONE);
sound(pSeat->ePlayer, CHAN_ITEM, "common/wpn_hudon.wav", 0.5, ATTN_NONE);
} else {
sound(self, CHAN_ITEM, "common/wpn_moveselect.wav", 0.5, ATTN_NONE);
sound(pSeat->ePlayer, CHAN_ITEM, "common/wpn_moveselect.wav", 0.5, ATTN_NONE);
pSeat->fHUDWeaponSelected--;
if (pSeat->fHUDWeaponSelected <= 0) {
pSeat->fHUDWeaponSelected = g_weapons.length - 1;
@ -43,7 +43,7 @@ void HUD_DrawWeaponSelect_Forward(void)
void HUD_DrawWeaponSelect_Back(void)
{
player pl = (player)self;
player pl = (player)pSeat->ePlayer;
if (!pl.activeweapon) {
return;
@ -51,9 +51,9 @@ void HUD_DrawWeaponSelect_Back(void)
if (pSeat->fHUDWeaponSelectTime < time) {
pSeat->fHUDWeaponSelected = pl.activeweapon;
sound(self, CHAN_ITEM, "common/wpn_hudon.wav", 0.5, ATTN_NONE);
sound(pSeat->ePlayer, CHAN_ITEM, "common/wpn_hudon.wav", 0.5, ATTN_NONE);
} else {
sound(self, CHAN_ITEM, "common/wpn_moveselect.wav", 0.5, ATTN_NONE);
sound(pSeat->ePlayer, CHAN_ITEM, "common/wpn_moveselect.wav", 0.5, ATTN_NONE);
pSeat->fHUDWeaponSelected++;
if (pSeat->fHUDWeaponSelected >= g_weapons.length) {
pSeat->fHUDWeaponSelected = 1;
@ -70,7 +70,7 @@ void HUD_DrawWeaponSelect_Back(void)
void HUD_DrawWeaponSelect_Trigger(void)
{
sendevent("PlayerSwitchWeapon", "f", pSeat->fHUDWeaponSelected);
sound(self, CHAN_ITEM, "common/wpn_select.wav", 0.5f, ATTN_NONE);
sound(pSeat->ePlayer, CHAN_ITEM, "common/wpn_select.wav", 0.5f, ATTN_NONE);
pSeat->fHUDWeaponSelected = pSeat->fHUDWeaponSelectTime = 0;
}
@ -86,7 +86,7 @@ void HUD_DrawWeaponSelect_Num(vector vPos, float fValue)
int Weapon_InSlotPos(int slot, int pos)
{
player pl = (player)self;
player pl = (player)pSeat->ePlayer;
for (int i = 1; i < g_weapons.length; i++) {
if (g_weapons[i].slot == slot && g_weapons[i].slot_pos == pos) {
if (pl.items & g_weapons[i].id) {
@ -100,13 +100,13 @@ int Weapon_InSlotPos(int slot, int pos)
}
void HUD_DrawWeaponSelect(void)
{
player pl = (player)self;
player pl = (player)pSeat->ePlayer;
if (!pl.activeweapon) {
return;
}
if (pSeat->fHUDWeaponSelectTime < time) {
if (pSeat->fHUDWeaponSelected) {
sound(self, CHAN_ITEM, "common/wpn_hudoff.wav", 0.5, ATTN_NONE);
sound(pSeat->ePlayer, CHAN_ITEM, "common/wpn_hudoff.wav", 0.5, ATTN_NONE);
pSeat->fHUDWeaponSelected = 0;
}
return;

View file

@ -8,7 +8,7 @@
void View_UpdateWeapon(entity vm, entity mflash)
{
player pl = (player)self;
player pl = (player)pSeat->ePlayer;
if (pSeat->fLastWeapon != pl.activeweapon) {
pSeat->fLastWeapon = pl.activeweapon;

View file

@ -1,4 +1,10 @@
/***
*
* Copyright (c) 2016-2019 Marco 'eukara' Hladik. All rights reserved.
*
* See the file LICENSE attached with the sources for usage details.
*
****/
#define DECALS_MAX 30
@ -49,6 +55,7 @@ void Decals_PlaceSmall(vector pos)
decal.nextthink = time /*+ 0.1f*/;
#endif
}
void Decals_PlaceBig(vector pos)
{
#ifdef CSQC
@ -61,6 +68,7 @@ void Decals_PlaceBig(vector pos)
decal.nextthink = time /*+ 0.1f*/;
#endif
}
void Decals_PlaceScorch(vector pos)
{
#ifdef CSQC

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.