Various changes to enable use of the new Touch(entity) method.

This commit is contained in:
Marco Cawthorne 2022-04-03 14:06:23 -07:00
parent d1962767b4
commit fdd706526f
Signed by: eukara
GPG Key ID: C196CD8BA993248A
12 changed files with 57 additions and 52 deletions

View File

@ -474,11 +474,16 @@ HUD_DrawSpectator(void)
drawfont = Font_GetID(FONT_20);
vector vecPos;
string strText;
float palpha = 1.0f;
if (spec.spec_mode == SPECMODE_FREE) {
palpha = 0.5f;
}
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);
drawstring(vecPos, strText, [20,20], [1,1,1], palpha, 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);

View File

@ -178,7 +178,7 @@ Scores_Draw(void)
pos = video_mins + [(video_res[0] / 2) - 145, 30];
}
if (serverkeyfloat("teams") > 0) {
if (Util_IsTeamPlay()) {
Scores_DrawTeam(pl, pos);
} else {
Scores_DrawNormal(pl, pos);

View File

@ -18,10 +18,10 @@ class item_ammo:CBaseEntity
{
void(void) item_ammo;
virtual void(void) Respawn;
virtual void(void) touch;
virtual void(entity) Touch;
};
void item_ammo::touch(void)
void item_ammo::Touch(entity eToucher)
{
if not (other.flags & FL_CLIENT) {
return;
@ -79,7 +79,7 @@ A single ammo_357 will provide 6 bullets.
class ammo_357:item_ammo
{
void(void) ammo_357;
virtual void(void) touch;
virtual void(entity) Touch;
};
void ammo_357::ammo_357(void)
@ -87,7 +87,7 @@ void ammo_357::ammo_357(void)
model = "models/w_357ammobox.mdl";
item_ammo::item_ammo();
}
void ammo_357::touch(void)
void ammo_357::Touch(entity eToucher)
{
if not (other.flags & FL_CLIENT) {
return;
@ -96,7 +96,7 @@ void ammo_357::touch(void)
player pl = (player)other;
if (pl.ammo_357 < MAX_A_357) {
pl.ammo_357 = bound(0, pl.ammo_357 + 6, MAX_A_357);
item_ammo::touch();
item_ammo::Touch(eToucher);
}
}
}
@ -112,7 +112,7 @@ A single ammo_9mmAR will provide 50 bullets.
class ammo_9mmAR:item_ammo
{
void(void) ammo_9mmAR;
virtual void(void) touch;
virtual void(entity) Touch;
};
void ammo_9mmAR::ammo_9mmAR(void)
@ -120,7 +120,7 @@ void ammo_9mmAR::ammo_9mmAR(void)
model = "models/w_9mmarclip.mdl";
item_ammo::item_ammo();
}
void ammo_9mmAR::touch(void)
void ammo_9mmAR::Touch(entity eToucher)
{
if not (other.flags & FL_CLIENT) {
return;
@ -129,7 +129,7 @@ void ammo_9mmAR::touch(void)
player pl = (player)other;
if (pl.ammo_9mm < MAX_A_9MM) {
pl.ammo_9mm = bound(0, pl.ammo_9mm + 50, MAX_A_9MM);
item_ammo::touch();
item_ammo::Touch(eToucher);
}
}
}
@ -146,7 +146,7 @@ A single ammo_9mmbox will provide 200 bullets.
class ammo_9mmbox:item_ammo
{
void(void) ammo_9mmbox;
virtual void(void) touch;
virtual void(entity) Touch;
};
void ammo_9mmbox::ammo_9mmbox(void)
@ -154,7 +154,7 @@ void ammo_9mmbox::ammo_9mmbox(void)
model = "models/w_chainammo.mdl";
item_ammo::item_ammo();
}
void ammo_9mmbox::touch(void)
void ammo_9mmbox::Touch(entity eToucher)
{
if not (other.flags & FL_CLIENT) {
return;
@ -163,7 +163,7 @@ void ammo_9mmbox::touch(void)
player pl = (player)other;
if (pl.ammo_9mm < MAX_A_9MM) {
pl.ammo_9mm = bound(0, pl.ammo_9mm + 200, MAX_A_9MM);
item_ammo::touch();
item_ammo::Touch(eToucher);
}
}
}
@ -179,7 +179,7 @@ A single ammo_9mmclip will provide 17 bullets.
class ammo_9mmclip:item_ammo
{
void(void) ammo_9mmclip;
virtual void(void) touch;
virtual void(entity) Touch;
};
void ammo_9mmclip::ammo_9mmclip(void)
@ -187,7 +187,7 @@ void ammo_9mmclip::ammo_9mmclip(void)
model = "models/w_9mmclip.mdl";
item_ammo::item_ammo();
}
void ammo_9mmclip::touch(void)
void ammo_9mmclip::Touch(entity eToucher)
{
if not (other.flags & FL_CLIENT) {
return;
@ -196,7 +196,7 @@ void ammo_9mmclip::touch(void)
player pl = (player)other;
if (pl.ammo_9mm < MAX_A_9MM) {
pl.ammo_9mm = bound(0, pl.ammo_9mm + 17, MAX_A_9MM);
item_ammo::touch();
item_ammo::Touch(eToucher);
}
}
}
@ -212,7 +212,7 @@ A single ammo_ARgrenades will provide 2 AR grenades.
class ammo_ARgrenades:item_ammo
{
void(void) ammo_ARgrenades;
virtual void(void) touch;
virtual void(entity) Touch;
};
void ammo_ARgrenades::ammo_ARgrenades(void)
@ -220,7 +220,7 @@ void ammo_ARgrenades::ammo_ARgrenades(void)
model = "models/w_argrenade.mdl";
item_ammo::item_ammo();
}
void ammo_ARgrenades::touch(void)
void ammo_ARgrenades::Touch(entity eToucher)
{
if not (other.flags & FL_CLIENT) {
return;
@ -229,7 +229,7 @@ void ammo_ARgrenades::touch(void)
player pl = (player)other;
if (pl.ammo_m203_grenade < MAX_A_M203_GRENADE) {
pl.ammo_m203_grenade = bound(0, pl.ammo_m203_grenade + 2, MAX_A_M203_GRENADE);
item_ammo::touch();
item_ammo::Touch(eToucher);
}
}
}
@ -246,7 +246,7 @@ A single ammo_buckshot will provide 12 shells.
class ammo_buckshot:item_ammo
{
void(void) ammo_buckshot;
virtual void(void) touch;
virtual void(entity) Touch;
};
void ammo_buckshot::ammo_buckshot(void)
@ -254,7 +254,7 @@ void ammo_buckshot::ammo_buckshot(void)
model = "models/w_shotbox.mdl";
item_ammo::item_ammo();
}
void ammo_buckshot::touch(void)
void ammo_buckshot::Touch(entity eToucher)
{
if not (other.flags & FL_CLIENT) {
return;
@ -263,7 +263,7 @@ void ammo_buckshot::touch(void)
player pl = (player)other;
if (pl.ammo_buckshot < MAX_A_BUCKSHOT) {
pl.ammo_buckshot = bound(0, pl.ammo_buckshot + 12, MAX_A_BUCKSHOT);
item_ammo::touch();
item_ammo::Touch(eToucher);
}
}
}
@ -279,7 +279,7 @@ A single ammo_crossbow will provide 5 bolts.
class ammo_crossbow:item_ammo
{
void(void) ammo_crossbow;
virtual void(void) touch;
virtual void(entity) Touch;
};
void ammo_crossbow::ammo_crossbow(void)
@ -287,7 +287,7 @@ void ammo_crossbow::ammo_crossbow(void)
model = "models/w_crossbow_clip.mdl";
item_ammo::item_ammo();
}
void ammo_crossbow::touch(void)
void ammo_crossbow::Touch(entity eToucher)
{
if not (other.flags & FL_CLIENT) {
return;
@ -296,7 +296,7 @@ void ammo_crossbow::touch(void)
player pl = (player)other;
if (pl.ammo_bolt < MAX_A_BOLT) {
pl.ammo_bolt = bound(0, pl.ammo_bolt + 5, MAX_A_BOLT);
item_ammo::touch();
item_ammo::Touch(eToucher);
}
}
}
@ -312,7 +312,7 @@ A single ammo_gaussclip will provide 20 cells.
class ammo_gaussclip:item_ammo
{
void(void) ammo_gaussclip;
virtual void(void) touch;
virtual void(entity) Touch;
};
void ammo_gaussclip::ammo_gaussclip(void)
@ -320,7 +320,7 @@ void ammo_gaussclip::ammo_gaussclip(void)
model = "models/w_gaussammo.mdl";
item_ammo::item_ammo();
}
void ammo_gaussclip::touch(void)
void ammo_gaussclip::Touch(entity eToucher)
{
if not (other.flags & FL_CLIENT) {
return;
@ -329,7 +329,7 @@ void ammo_gaussclip::touch(void)
player pl = (player)other;
if (pl.ammo_uranium < MAX_A_URANIUM) {
pl.ammo_uranium = bound(0, pl.ammo_uranium + 20, MAX_A_URANIUM);
item_ammo::touch();
item_ammo::Touch(eToucher);
}
}
@ -344,7 +344,7 @@ A single ammo_rpgclip will provide 1 rocket.
class ammo_rpgclip:item_ammo
{
void(void) ammo_rpgclip;
virtual void(void) touch;
virtual void(entity) Touch;
};
void ammo_rpgclip::ammo_rpgclip(void)
@ -352,7 +352,7 @@ void ammo_rpgclip::ammo_rpgclip(void)
model = "models/w_rpgammo.mdl";
item_ammo::item_ammo();
}
void ammo_rpgclip::touch(void)
void ammo_rpgclip::Touch(entity eToucher)
{
if not (other.flags & FL_CLIENT) {
return;
@ -361,6 +361,6 @@ void ammo_rpgclip::touch(void)
player pl = (player)other;
if (pl.ammo_rocket < MAX_A_ROCKET) {
pl.ammo_rocket = bound(0, pl.ammo_rocket + 1, MAX_A_ROCKET);
item_ammo::touch();
item_ammo::Touch(eToucher);
}
}

View File

@ -153,7 +153,7 @@ HLMultiplayerRules::ConsoleCommand(base_player pp, string cmd)
switch (argv(0)) {
case "bot_add":
bot pete = Bot_AddQuick();
bot pete = (bot)Bot_AddQuick();
Bot_RandomColormap(pete);
searchhandle pm = search_begin("models/player/*/*.mdl", TRUE, TRUE);
int r = floor(random(0, search_getsize(pm)));

View File

@ -32,10 +32,10 @@ class item_battery:CBaseEntity
void(void) item_battery;
virtual void(void) Respawn;
virtual void(void) touch;
virtual void(entity) Touch;
};
void item_battery::touch(void)
void item_battery::Touch(entity eToucher)
{
if (other.classname != "player") {
return;

View File

@ -26,10 +26,10 @@ class item_healthkit:CBaseEntity
{
void(void) item_healthkit;
virtual void(void) Respawn;
virtual void(void) touch;
virtual void(entity) Touch;
};
void item_healthkit::touch(void)
void item_healthkit::Touch(entity eToucher)
{
if (other.classname != "player") {
return;

View File

@ -29,13 +29,13 @@ class item_longjump:CBaseTrigger
void(void) item_longjump;
virtual void(void) touch;
virtual void(entity) Touch;
virtual void(void) Respawn;
virtual void(string, string) SpawnKey;
};
void
item_longjump::touch(void)
item_longjump::Touch(entity eToucher)
{
if (other.classname != "player") {
return;

View File

@ -31,13 +31,13 @@ class item_suit:CBaseTrigger
void(void) item_suit;
virtual void(void) touch;
virtual void(entity) Touch;
virtual void(void) Respawn;
virtual void(string, string) SpawnKey;
};
void
item_suit::touch(void)
item_suit::Touch(entity eToucher)
{
if (other.classname != "player") {
return;

View File

@ -39,11 +39,11 @@ class item_weaponbox:CBaseEntity
#endif
void(void) item_weaponbox;
virtual void(void) touch;
virtual void(entity) Touch;
virtual void(player) setup;
};
void item_weaponbox::touch(void)
void item_weaponbox::Touch(entity eToucher)
{
if (other.classname != "player") {
return;

View File

@ -23,7 +23,7 @@ class item_pickup:CBaseTrigger
int id;
void(void) item_pickup;
virtual void(void) touch;
virtual void(entity) Touch;
virtual void(int i) SetItem;
virtual void(void) Respawn;
virtual void(int) SetFloating;

View File

@ -14,21 +14,21 @@
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
void item_pickup::touch(void)
void item_pickup::Touch(entity eToucher)
{
if (other.classname != "player") {
if (eToucher.classname != "player") {
return;
}
/* don't remove if AddItem fails */
if (Weapons_AddItem((player)other, id, m_iClip) == FALSE) {
if (Weapons_AddItem((player)eToucher, id, m_iClip) == FALSE) {
return;
}
Logging_Pickup(other, this, __NULL__);
Logging_Pickup(eToucher, this, __NULL__);
Sound_Play(other, CHAN_ITEM, "weapon.pickup");
UseTargets(other, TRIG_TOGGLE, m_flDelay);
UseTargets(eToucher, TRIG_TOGGLE, m_flDelay);
if (real_owner || m_iWasDropped == 1 || cvar("sv_playerslots") == 1) {
remove(self);

View File

@ -60,7 +60,7 @@ class monster_headcrab:NSMonster
virtual int(void) AnimWalk;
virtual int(void) AnimRun;
virtual int(void) AttackRanged;
virtual void(void) touch;
virtual void(entity) Touch;
};
int
@ -100,11 +100,11 @@ monster_headcrab::AttackRanged(void)
}
void
monster_headcrab::touch(void)
monster_headcrab::Touch(entity eToucher)
{
if (other.takedamage == DAMAGE_YES)
if (eToucher.takedamage == DAMAGE_YES)
if (frame == HC_JUMP || frame == HC_JUMP_VARIATION1)
Damage_Apply(other, this, 500, 0, 0);
Damage_Apply(eToucher, this, 500, 0, 0);
}
void