]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/weapons/weapon/tuba.qc
Remove weapon SELFPARAM
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / weapons / weapon / tuba.qc
index 0e429acb22b50e1ff66d17461c4f0a24f2f08dc6..3dd1c26289f3a74e6c5c5190a04c051c06306a97 100644 (file)
@@ -213,9 +213,9 @@ int W_Tuba_GetNote(entity pl, int hittype)
                case 8: note = +4; break; // e
                case 9: note = -1; break; // B
        }
-       if(pl.BUTTON_CROUCH)
+       if(PHYS_INPUT_BUTTON_CROUCH(pl))
                note -= 12;
-       if(pl.BUTTON_JUMP)
+       if(PHYS_INPUT_BUTTON_JUMP(pl))
                note += 12;
        if(hittype & HITTYPE_SECONDARY)
                note += 7;
@@ -274,8 +274,8 @@ bool W_Tuba_NoteSendEntity(entity this, entity to, int sf)
        return true;
 }
 
-void W_Tuba_NoteThink()
-{SELFPARAM();
+void W_Tuba_NoteThink(entity this)
+{
        float dist_mult;
        float vol0, vol1;
        vector dir0, dir1;
@@ -287,7 +287,7 @@ void W_Tuba_NoteThink()
        }
        self.nextthink = time;
        dist_mult = WEP_CVAR(tuba, attenuation) / autocvar_snd_soundradius;
-       FOREACH_CLIENT(IS_REAL_CLIENT(it) && it != self.realowner, LAMBDA(
+       FOREACH_CLIENT(IS_REAL_CLIENT(it) && it != self.realowner, {
                v = self.origin - (it.origin + it.view_ofs);
                vol0 = max(0, 1 - vlen(v) * dist_mult);
                dir0 = normalize(v);
@@ -306,15 +306,15 @@ void W_Tuba_NoteThink()
                        self.SendFlags |= 2;
                        break;
                }
-       ));
+       });
 }
 
-void W_Tuba_NoteOn(float hittype)
-{SELFPARAM();
+void W_Tuba_NoteOn(entity actor, float hittype)
+{entity this = actor;
        vector o;
        float n;
 
-       W_SetupShot(self, false, 2, "", 0, WEP_CVAR(tuba, damage));
+       W_SetupShot(self, false, 2, SND_Null, 0, WEP_CVAR(tuba, damage));
 
        n = W_Tuba_GetNote(self, hittype);
 
@@ -338,7 +338,7 @@ void W_Tuba_NoteOn(float hittype)
                self.tuba_note.owner = self.tuba_note.realowner = self;
                self.tuba_note.cnt = n;
                self.tuba_note.tuba_instrument = self.tuba_instrument;
-               self.tuba_note.think = W_Tuba_NoteThink;
+               setthink(self.tuba_note, W_Tuba_NoteThink);
                self.tuba_note.nextthink = time;
                self.tuba_note.spawnshieldtime = time;
                Net_LinkEntity(self.tuba_note, false, 0, W_Tuba_NoteSendEntity);
@@ -359,17 +359,16 @@ void W_Tuba_NoteOn(float hittype)
 #endif
 
 #ifdef SVQC
-METHOD(Tuba, wr_aim, void(Tuba this))
+METHOD(Tuba, wr_aim, void(Tuba this, entity actor))
 {
-       entity actor = self;
        // bots cannot play the Tuba well yet
        // I think they should start with the recorder first
        if (vdist((actor.origin - actor.enemy.origin), <, WEP_CVAR(tuba, radius)))
        {
                if (random() > 0.5)
-                       actor.BUTTON_ATCK = 1;
+                       PHYS_INPUT_BUTTON_ATCK(actor) = true;
                else
-                       actor.BUTTON_ATCK2 = 1;
+                       PHYS_INPUT_BUTTON_ATCK2(actor) = true;
        }
 }
 
@@ -378,13 +377,13 @@ METHOD(Tuba, wr_think, void(Tuba this, entity actor, .entity weaponentity, int f
        if (fire & 1)
        if (weapon_prepareattack(this, actor, weaponentity, false, WEP_CVAR(tuba, refire)))
        {
-               W_Tuba_NoteOn(0);
+               W_Tuba_NoteOn(actor, 0);
                weapon_thinkf(actor, weaponentity, WFRAME_IDLE, WEP_CVAR(tuba, animtime), w_ready);
        }
        if (fire & 2)
        if (weapon_prepareattack(this, actor, weaponentity, true, WEP_CVAR(tuba, refire)))
        {
-               W_Tuba_NoteOn(HITTYPE_SECONDARY);
+               W_Tuba_NoteOn(actor, HITTYPE_SECONDARY);
                weapon_thinkf(actor, weaponentity, WFRAME_IDLE, WEP_CVAR(tuba, animtime), w_ready);
        }
        if (actor.tuba_note)
@@ -396,9 +395,8 @@ METHOD(Tuba, wr_think, void(Tuba this, entity actor, .entity weaponentity, int f
        }
 }
 
-METHOD(Tuba, wr_setup, void(Tuba this))
+METHOD(Tuba, wr_setup, void(Tuba this, entity actor))
 {
-       entity actor = self;
        actor.ammo_field = ammo_none;
        actor.tuba_instrument = 0;
 }
@@ -413,7 +411,7 @@ NET_HANDLE(tuba_instrument, bool)
        string s = (i == 0) ? "tuba" :
                   (i == 1) ? "akordeon" :
                              "kleinbottle" ;
-       CL_WeaponEntity_SetModel(viewmodel, s);
+       CL_WeaponEntity_SetModel(viewmodel, s, true);
 }
 #endif
 #ifdef SVQC
@@ -450,7 +448,7 @@ METHOD(Tuba, wr_reload, void(Tuba this, entity actor, .entity weaponentity))
                                break;
                }
                tuba_instrument_send(actor, actor.tuba_instrument);
-               W_SetupShot(actor, false, 0, "", 0, 0);
+               W_SetupShot(actor, false, 0, SND_Null, 0, 0);
                Send_Effect(EFFECT_TELEPORT, w_shotorg, '0 0 0', 1);
                actor.(weaponentity).state = WS_INUSE;
                weapon_thinkf(actor, weaponentity, WFRAME_RELOAD, 0.5, w_ready);
@@ -461,10 +459,10 @@ METHOD(Tuba, wr_reload, void(Tuba this, entity actor, .entity weaponentity))
 #ifdef SVQC
 
 // infinite ammo
-METHOD(Tuba, wr_checkammo1, bool(Tuba this)) { return true; }
-METHOD(Tuba, wr_checkammo2, bool(Tuba this)) { return true; }
+METHOD(Tuba, wr_checkammo1, bool(Tuba this, entity actor)) { return true; }
+METHOD(Tuba, wr_checkammo2, bool(Tuba this, entity actor)) { return true; }
 
-METHOD(Tuba, wr_suicidemessage, int(Tuba this))
+METHOD(Tuba, wr_suicidemessage, Notification(Tuba this))
 {
        if (w_deathtype & HITTYPE_BOUNCE)
                return WEAPON_KLEINBOTTLE_SUICIDE;
@@ -473,7 +471,7 @@ METHOD(Tuba, wr_suicidemessage, int(Tuba this))
        else
                return WEAPON_TUBA_SUICIDE;
 }
-METHOD(Tuba, wr_killmessage, int(Tuba this))
+METHOD(Tuba, wr_killmessage, Notification(Tuba this))
 {
        if (w_deathtype & HITTYPE_BOUNCE)
                return WEAPON_KLEINBOTTLE_MURDER;
@@ -552,8 +550,8 @@ void tubasound(entity e, bool restart)
        }
 }
 
-void Ent_TubaNote_Think()
-{SELFPARAM();
+void Ent_TubaNote_Think(entity this)
+{
        float f = autocvar_g_balance_tuba_fadetime;
        if (f > 0) {
                this.tuba_volume -= frametime * this.tuba_volume_initial / f;
@@ -588,8 +586,6 @@ void Ent_TubaNote_StopSound(entity this)
        this.enemy = NULL;
 }
 
-void Ent_TubaNote_StopSound_self() { Ent_TubaNote_StopSound(self); }
-
 NET_HANDLE(ENT_CLIENT_TUBANOTE, bool isNew)
 {
        bool upd = false;
@@ -631,9 +627,9 @@ NET_HANDLE(ENT_CLIENT_TUBANOTE, bool isNew)
                }
        }
 
-       this.think = Ent_TubaNote_StopSound_self;
+       setthink(this, Ent_TubaNote_StopSound);
        this.entremove = Ent_TubaNote_StopSound;
-       this.enemy.think = Ent_TubaNote_Think;
+       setthink(this.enemy, Ent_TubaNote_Think);
        this.enemy.nextthink = time + 10;
 
        if (upd) {