]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/cl_client.qc
Merge branch 'master' into Mario/user_movetypes
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / cl_client.qc
index a37227d03024614a464ff56e4b27167b832ae72b..0a608e979bff5da3e4b535fed7019bc0a9fb2301 100644 (file)
@@ -218,8 +218,7 @@ void FixPlayermodel(entity player);
 void PutObserverInServer(entity this)
 {
     bool mutator_returnvalue = MUTATOR_CALLHOOK(MakePlayerObserver, this);
-    if(IS_PLAYER(this)) // our own state
-               PlayerState_detach(this);
+       PlayerState_detach(this);
 
        if (IS_PLAYER(this) && this.health >= 1) {
         // despawn effect
@@ -352,6 +351,10 @@ void PutObserverInServer(entity this)
        this.oldvelocity = this.velocity;
        this.fire_endtime = -1;
        this.event_damage = func_null;
+
+       STAT(ACTIVEWEAPON, this) = WEP_Null.m_id;
+       STAT(SWITCHINGWEAPON, this) = WEP_Null.m_id;
+       STAT(SWITCHWEAPON, this) = WEP_Null.m_id;
 }
 
 int player_getspecies(entity this)
@@ -1730,8 +1733,24 @@ void SetSpectatee(entity this, entity spectatee)
 
        // WEAPONTODO
        // these are required to fix the spectator bug with arc
-       if(old_spectatee && old_spectatee.arc_beam) { old_spectatee.arc_beam.SendFlags |= ARC_SF_SETTINGS; }
-       if(this.enemy && this.enemy.arc_beam) { this.enemy.arc_beam.SendFlags |= ARC_SF_SETTINGS; }
+       if(old_spectatee)
+       {
+               for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
+               {
+                       .entity weaponentity = weaponentities[slot];
+                       if(old_spectatee.(weaponentity).arc_beam)
+                               old_spectatee.(weaponentity).arc_beam.SendFlags |= ARC_SF_SETTINGS;
+               }
+       }
+       if(this.enemy)
+       {
+               for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
+               {
+                       .entity weaponentity = weaponentities[slot];
+                       if(this.enemy.(weaponentity).arc_beam)
+                               this.enemy.(weaponentity).arc_beam.SendFlags |= ARC_SF_SETTINGS;
+               }
+       }
 
        // needed to update spectator list
        if(old_spectatee) { ClientData_Touch(old_spectatee); }
@@ -2326,7 +2345,6 @@ void PlayerPreThink (entity this)
                this.prevorigin = this.origin;
 
                bool do_crouch = PHYS_INPUT_BUTTON_CROUCH(this);
-        .entity weaponentity = weaponentities[0]; // TODO: unhardcode
                if (this.hook.state) {
                        do_crouch = false;
                } else if (this.waterlevel >= WATERLEVEL_SWIMMING) {
@@ -2335,10 +2353,6 @@ void PlayerPreThink (entity this)
                        do_crouch = false;
                } else if (STAT(FROZEN, this)) {
                        do_crouch = false;
-        } else if ((PS(this).m_weapon.spawnflags & WEP_TYPE_MELEE_PRI) && this.(weaponentity).wframe == WFRAME_FIRE1 && time < this.(weaponentity).weapon_nextthink) {
-                       do_crouch = false;
-        } else if ((PS(this).m_weapon.spawnflags & WEP_TYPE_MELEE_SEC) && this.(weaponentity).wframe == WFRAME_FIRE2 && time < this.(weaponentity).weapon_nextthink) {
-                       do_crouch = false;
         }
 
                if (do_crouch) {
@@ -2364,7 +2378,13 @@ void PlayerPreThink (entity this)
                {
                        this.items &= ~this.items_added;
 
-                       W_WeaponFrame(this);
+                       //for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
+                       //{
+                               //.entity weaponentity = weaponentities[slot];
+                               //W_WeaponFrame(this, weaponentity);
+                       //}
+                       .entity weaponentity = weaponentities[0]; // TODO
+                       W_WeaponFrame(this, weaponentity);
 
                        this.items_added = 0;
                        if (this.items & ITEM_Jetpack.m_itemid && (this.items & ITEM_JetpackRegen.m_itemid || this.ammo_fuel >= 0.01))