Merge branch 'master' into Mario/vaporizer_damage 215/head
authorMario <zacjardine@y7mail.com>
Mon, 31 Aug 2015 14:15:08 +0000 (00:15 +1000)
committerMario <zacjardine@y7mail.com>
Mon, 31 Aug 2015 14:15:08 +0000 (00:15 +1000)
# Conflicts:
# qcsrc/common/weapons/w_vaporizer.qc
# qcsrc/server/cl_player.qc

1  2 
qcsrc/common/weapons/weapon/vaporizer.qc
qcsrc/server/cl_player.qc
qcsrc/server/mutators/mutator_instagib.qc
vehicles.cfg

index 0000000,4ed2dc2..256019d
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,476 +1,477 @@@
 -      float flying;
 -      flying = IsFlying(self); // do this BEFORE to make the trace values from FireRailgunBullet last
+ #ifndef IMPLEMENTATION
+ REGISTER_WEAPON(
+ /* WEP_##id  */ VAPORIZER,
+ /* function  */ W_Vaporizer,
+ /* ammotype  */ ammo_cells,
+ /* impulse   */ 7,
+ /* flags     */ WEP_FLAG_RELOADABLE | WEP_FLAG_CANCLIMB | WEP_FLAG_SUPERWEAPON | WEP_TYPE_HITSCAN,
+ /* rating    */ BOT_PICKUP_RATING_HIGH,
+ /* color     */ '0.5 1 1',
+ /* modelname */ "minstanex",
+ /* simplemdl */ "foobar",
+ /* crosshair */ "gfx/crosshairminstanex 0.6",
+ /* wepimg    */ "weaponminstanex",
+ /* refname   */ "vaporizer",
+ /* wepname   */ _("Vaporizer")
+ );
+ #define VAPORIZER_SETTINGS(w_cvar,w_prop) VAPORIZER_SETTINGS_LIST(w_cvar, w_prop, VAPORIZER, vaporizer)
+ #define VAPORIZER_SETTINGS_LIST(w_cvar,w_prop,id,sn) \
+       w_cvar(id, sn, PRI, ammo) \
+       w_cvar(id, sn, PRI, animtime) \
++      w_cvar(id, sn, PRI, damage) \
+       w_cvar(id, sn, PRI, refire) \
+       w_cvar(id, sn, SEC, ammo) \
+       w_cvar(id, sn, SEC, animtime) \
+       w_cvar(id, sn, SEC, damage) \
+       w_cvar(id, sn, SEC, delay) \
+       w_cvar(id, sn, SEC, edgedamage) \
+       w_cvar(id, sn, SEC, force) \
+       w_cvar(id, sn, SEC, lifetime) \
+       w_cvar(id, sn, SEC, radius) \
+       w_cvar(id, sn, SEC, refire) \
+       w_cvar(id, sn, SEC, shotangle) \
+       w_cvar(id, sn, SEC, speed) \
+       w_cvar(id, sn, SEC, spread) \
+       w_prop(id, sn, float,  reloading_ammo, reload_ammo) \
+       w_prop(id, sn, float,  reloading_time, reload_time) \
+       w_prop(id, sn, float,  switchdelay_raise, switchdelay_raise) \
+       w_prop(id, sn, float,  switchdelay_drop, switchdelay_drop) \
+       w_prop(id, sn, string, weaponreplace, weaponreplace) \
+       w_prop(id, sn, float,  weaponstart, weaponstart) \
+       w_prop(id, sn, float,  weaponstartoverride, weaponstartoverride) \
+       w_prop(id, sn, float,  weaponthrowable, weaponthrowable)
+ #ifdef SVQC
+ VAPORIZER_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
+ .float vaporizer_lasthit;
+ .float jump_interval;
+ .float jump_interval2;
+ .bool held_down;
+ .float rm_force;
+ .float rm_damage;
+ .float rm_edmg;
+ #endif
+ #endif
+ #ifdef IMPLEMENTATION
+ #ifdef SVQC
+ void spawnfunc_weapon_vaporizer(void) { weapon_defaultspawnfunc(WEP_VAPORIZER.m_id); }
+ void spawnfunc_weapon_minstanex(void) { spawnfunc_weapon_vaporizer(); }
+ void W_RocketMinsta_Explosion(vector loc)
+ {
+       if(accuracy_canbegooddamage(self))
+               accuracy_add(self, WEP_DEVASTATOR.m_id, autocvar_g_rm_damage, 0);
+       entity dmgent = spawn();
+       dmgent.owner = dmgent.realowner = self;
+       setorigin(dmgent, loc);
+       RadiusDamage (dmgent, self, autocvar_g_rm_damage, autocvar_g_rm_edgedamage, autocvar_g_rm_radius, world, world, autocvar_g_rm_force, WEP_DEVASTATOR.m_id | HITTYPE_SPLASH, other);
+       remove(dmgent);
+ }
+ void W_Vaporizer_Attack(void)
+ {
 -      W_SetupShot(self, true, 0, "", CH_WEAPON_A, 10000);
++      bool flying = IsFlying(self); // do this BEFORE to make the trace values from FireRailgunBullet last
++      float vaporizer_damage = ((WEP_CVAR_PRI(vaporizer, damage) > 0) ? WEP_CVAR_PRI(vaporizer, damage) : 10000);
 -      FireRailgunBullet(w_shotorg, w_shotorg + w_shotdir * MAX_SHOT_DISTANCE, 10000, 800, 0, 0, 0, 0, WEP_VAPORIZER.m_id);
++      W_SetupShot(self, true, 0, "", CH_WEAPON_A, vaporizer_damage);
+       // handle sound separately so we can change the volume
+       // added bonus: no longer plays the strength sound (strength gives no bonus to instakill anyway)
+       sound (self, CH_WEAPON_A, W_Sound("minstanexfire"), VOL_BASE * 0.8, ATTEN_NORM);
+       yoda = 0;
+       damage_goodhits = 0;
++      FireRailgunBullet(w_shotorg, w_shotorg + w_shotdir * MAX_SHOT_DISTANCE, vaporizer_damage, 800, 0, 0, 0, 0, WEP_VAPORIZER.m_id);
+       if(yoda && flying)
+               Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_ACHIEVEMENT_YODA);
+       if(damage_goodhits && self.vaporizer_lasthit)
+       {
+               Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_ACHIEVEMENT_IMPRESSIVE);
+               damage_goodhits = 0; // only every second time
+       }
+       self.vaporizer_lasthit = damage_goodhits;
+       Send_Effect(EFFECT_VORTEX_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
+       // teamcolor / hit beam effect
+       vector v;
+       v = WarpZone_UnTransformOrigin(WarpZone_trace_transform, trace_endpos);
+       switch(self.team)
+       {
+               case NUM_TEAM_1:   // Red
+                       if(damage_goodhits)
+                               Send_Effect(EFFECT_VAPORIZER_RED_HIT, w_shotorg, v, 1);
+                       else
+                               Send_Effect(EFFECT_VAPORIZER_RED, w_shotorg, v, 1);
+                       break;
+               case NUM_TEAM_2:   // Blue
+                       if(damage_goodhits)
+                               Send_Effect(EFFECT_VAPORIZER_BLUE_HIT, w_shotorg, v, 1);
+                       else
+                               Send_Effect(EFFECT_VAPORIZER_BLUE, w_shotorg, v, 1);
+                       break;
+               case NUM_TEAM_3:   // Yellow
+                       if(damage_goodhits)
+                               Send_Effect(EFFECT_VAPORIZER_YELLOW_HIT, w_shotorg, v, 1);
+                       else
+                               Send_Effect(EFFECT_VAPORIZER_YELLOW, w_shotorg, v, 1);
+                       break;
+               case NUM_TEAM_4:   // Pink
+                       if(damage_goodhits)
+                               Send_Effect(EFFECT_VAPORIZER_PINK_HIT, w_shotorg, v, 1);
+                       else
+                               Send_Effect(EFFECT_VAPORIZER_PINK, w_shotorg, v, 1);
+                       break;
+               default:
+                       if(damage_goodhits)
+                               Send_Effect_("TE_TEI_G3_HIT", w_shotorg, v, 1);
+                       else
+                               Send_Effect_("TE_TEI_G3", w_shotorg, v, 1);
+                       break;
+       }
+       if(autocvar_g_rm)
+       if(!(trace_dphitq3surfaceflags & (Q3SURFACEFLAG_SKY | Q3SURFACEFLAG_NOIMPACT)))
+               W_RocketMinsta_Explosion(trace_endpos);
+       W_DecreaseAmmo(((g_instagib) ? 1 : WEP_CVAR_PRI(vaporizer, ammo)));
+ }
+ void W_RocketMinsta_Laser_Explode (void)
+ {
+       if(other.takedamage == DAMAGE_AIM)
+               if(IS_PLAYER(other))
+                       if(DIFF_TEAM(self.realowner, other))
+                               if(other.deadflag == DEAD_NO)
+                                       if(IsFlying(other))
+                                               Send_Notification(NOTIF_ONE, self.realowner, MSG_ANNCE, ANNCE_ACHIEVEMENT_ELECTROBITCH);
+       self.event_damage = func_null;
+       self.takedamage = DAMAGE_NO;
+       RadiusDamage (self, self.realowner, self.rm_damage, self.rm_edmg, autocvar_g_rm_laser_radius, world, world, self.rm_force, self.projectiledeathtype, other);
+       remove(self);
+ }
+ void W_RocketMinsta_Laser_Touch (void)
+ {
+       PROJECTILE_TOUCH;
+       //W_RocketMinsta_Laser_Explode ();
+       RadiusDamage (self, self.realowner, self.rm_damage, self.rm_edmg, autocvar_g_rm_laser_radius, world, world, self.rm_force, self.projectiledeathtype, other);
+       remove(self);
+ }
+ void W_RocketMinsta_Attack2(void)
+ {
+       makevectors(self.v_angle);
+       
+       entity proj;
+       float counter = 0;
+       float total = autocvar_g_rm_laser_count;
+       float spread = autocvar_g_rm_laser_spread;
+       float rndspread = autocvar_g_rm_laser_spread_random;
+       float w = self.weapon;
+       self.weapon = WEP_ELECTRO.m_id;
+       W_SetupShot_ProjectileSize (self, '0 0 -3', '0 0 -3', false, 2, W_Sound("crylink_fire"), CH_WEAPON_A, autocvar_g_rm_laser_damage);
+       self.weapon = w;
+       Send_Effect(EFFECT_ELECTRO_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
+     while(counter < total)
+       {
+         proj = spawn ();
+         proj.classname = "plasma_prim";
+         proj.owner = proj.realowner = self;
+         proj.bot_dodge = true;
+         proj.bot_dodgerating = autocvar_g_rm_laser_damage;
+         proj.use = W_RocketMinsta_Laser_Explode;
+         proj.think = adaptor_think2use_hittype_splash;
+         proj.nextthink = time + autocvar_g_rm_laser_lifetime;
+         PROJECTILE_MAKETRIGGER(proj);
+         proj.projectiledeathtype = WEP_ELECTRO.m_id;
+         setorigin(proj, w_shotorg);
+               
+               proj.rm_force = autocvar_g_rm_laser_force / total;
+               proj.rm_damage = autocvar_g_rm_laser_damage / total;
+               proj.rm_edmg = proj.rm_damage;
+         
+         //W_SetupProjectileVelocity(proj, autocvar_g_rm_laser_speed, spread * (rndspread ? random() : 1) * autocvar_g_rm_laser_speed);
+         proj.movetype = MOVETYPE_BOUNCEMISSILE;
+         //W_SETUPPROJECTILEVELOCITY(proj, g_balance_minstanex_laser);
+               proj.velocity = (w_shotdir + (((counter + 0.5) / total) * 2 - 1) * v_right * (spread * (rndspread ? random() : 1))) * cvar("g_rm_laser_speed");
+               proj.velocity_z = proj.velocity_z + cvar("g_rm_laser_zspread") * (random() - 0.5);
+               proj.velocity = W_CalculateProjectileVelocity(proj.realowner.velocity, proj.velocity, true);
+         proj.angles = vectoangles(proj.velocity);
+         proj.touch = W_RocketMinsta_Laser_Touch;
+         setsize(proj, '0 0 -3', '0 0 -3');
+         proj.flags = FL_PROJECTILE;
+         proj.missile_flags = MIF_SPLASH;
+         CSQCProjectile(proj, true, PROJECTILE_ROCKETMINSTA_LASER, true);
+         MUTATOR_CALLHOOK(EditProjectile, self, proj);
+         counter++;
+     }
+ }
+ void W_RocketMinsta_Attack3 (void)
+ {
+       makevectors(self.v_angle);
+       
+       entity proj;
+       float counter = 0;
+       float total = 1;
+       int w = self.weapon;
+       self.weapon = WEP_ELECTRO.m_id;
+       W_SetupShot_ProjectileSize (self, '0 0 -3', '0 0 -3', false, 2, W_Sound("electro_fire2"), CH_WEAPON_A, autocvar_g_rm_laser_damage);
+       self.weapon = w;
+       Send_Effect(EFFECT_ELECTRO_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
+     while(counter < total)
+       {
+         proj = spawn ();
+         proj.classname = "plasma_prim";
+         proj.owner = proj.realowner = self;
+         proj.bot_dodge = true;
+         proj.bot_dodgerating = autocvar_g_rm_laser_damage;
+         proj.use = W_RocketMinsta_Laser_Explode;
+         proj.think = adaptor_think2use_hittype_splash;
+         proj.nextthink = time + autocvar_g_rm_laser_lifetime;
+         PROJECTILE_MAKETRIGGER(proj);
+         proj.projectiledeathtype = WEP_ELECTRO.m_id;
+         setorigin(proj, w_shotorg);
+               
+               proj.rm_force = autocvar_g_rm_laser_force / total;
+               proj.rm_damage = autocvar_g_rm_laser_damage / total;
+               proj.rm_edmg = proj.rm_damage;
+         
+         //W_SetupProjectileVelocity(proj, autocvar_g_rm_laser_speed, spread * (rndspread ? random() : 1) * autocvar_g_rm_laser_speed);
+         proj.movetype = MOVETYPE_BOUNCEMISSILE;
+               proj.velocity = w_shotdir * autocvar_g_rm_laser_speed;
+               proj.velocity = W_CalculateProjectileVelocity(proj.realowner.velocity, proj.velocity, true);
+         proj.angles = vectoangles(proj.velocity);
+         proj.touch = W_RocketMinsta_Laser_Touch;
+         setsize(proj, '0 0 -3', '0 0 -3');
+         proj.flags = FL_PROJECTILE;
+         proj.missile_flags = MIF_SPLASH;
+         CSQCProjectile(proj, true, PROJECTILE_ROCKETMINSTA_LASER, true);
+         MUTATOR_CALLHOOK(EditProjectile, self, proj);
+         counter++;
+     }
+ }
+ float W_Vaporizer(float req)
+ {
+       float ammo_amount;
+       float vaporizer_ammo;
+       float rapid = autocvar_g_rm_laser_rapid;
+       // now multiple WR_s use this
+       vaporizer_ammo = ((g_instagib) ? 1 : WEP_CVAR_PRI(vaporizer, ammo));
+       switch(req)
+       {
+               case WR_AIM:
+               {
+                       if(self.WEP_AMMO(VAPORIZER) > 0)
+                               self.BUTTON_ATCK = bot_aim(1000000, 0, 1, false);
+                       else
+                               self.BUTTON_ATCK2 = bot_aim(WEP_CVAR_SEC(vaporizer, speed), 0, WEP_CVAR_SEC(vaporizer, lifetime), false); // WEAPONTODO: replace with proper vaporizer cvars
+                       return true;
+               }
+               case WR_THINK:
+               {
+                       // if the laser uses load, we also consider its ammo for reloading
+                       if(WEP_CVAR(vaporizer, reload_ammo) && WEP_CVAR_SEC(vaporizer, ammo) && self.clip_load < min(vaporizer_ammo, WEP_CVAR_SEC(vaporizer, ammo))) // forced reload
+                               WEP_ACTION(self.weapon, WR_RELOAD);
+                       else if(WEP_CVAR(vaporizer, reload_ammo) && self.clip_load < vaporizer_ammo) // forced reload
+                               WEP_ACTION(self.weapon, WR_RELOAD);
+                       if(self.BUTTON_ATCK && (self.ammo_cells || !autocvar_g_rm) && !forbidWeaponUse(self))
+                       {
+                               if(weapon_prepareattack(0, WEP_CVAR_PRI(vaporizer, refire)))
+                               {
+                                       W_Vaporizer_Attack();
+                                       weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_PRI(vaporizer, animtime), w_ready);
+                               }
+                       }
+                       if(self.BUTTON_ATCK2 || (self.BUTTON_ATCK && !self.ammo_cells && autocvar_g_rm))
+                       {
+                               if((autocvar_g_rm && autocvar_g_rm_laser) || autocvar_g_rm_laser == 2)
+                               {
+                                       if(self.jump_interval <= time && !self.held_down)
+                                       {
+                                               if(rapid)
+                                                       self.held_down = true;
+                                               self.jump_interval = time + autocvar_g_rm_laser_refire;
+                                               self.jump_interval2 = time + autocvar_g_rm_laser_rapid_delay;
+                                               damage_goodhits = 0;
+                                               W_RocketMinsta_Attack2();
+                                       }
+                                       else if(rapid && self.jump_interval2 <= time && self.held_down)
+                                       {
+                                               self.jump_interval2 = time + autocvar_g_rm_laser_rapid_refire;
+                                               damage_goodhits = 0;
+                                               W_RocketMinsta_Attack3();
+                                               //weapon_thinkf(WFRAME_FIRE2, autocvar_g_rm_laser_rapid_animtime, w_ready);
+                                       }
+                               }
+                               else if (self.jump_interval <= time)
+                               {
+                                       // handle refire manually, so that primary and secondary can be fired without conflictions (important for instagib)
+                                       self.jump_interval = time + WEP_CVAR_SEC(vaporizer, refire) * W_WeaponRateFactor();
+                                       // decrease ammo for the laser?
+                                       if(WEP_CVAR_SEC(vaporizer, ammo))
+                                               W_DecreaseAmmo(WEP_CVAR_SEC(vaporizer, ammo));
+                                       // ugly instagib hack to reuse the fire mode of the laser
+                                       makevectors(self.v_angle);
+                                       int oldwep = self.weapon; // we can't avoid this hack
+                                       self.weapon = WEP_BLASTER.m_id;
+                                       W_Blaster_Attack(
+                                               WEP_BLASTER.m_id | HITTYPE_SECONDARY,
+                                               WEP_CVAR_SEC(vaporizer, shotangle),
+                                               WEP_CVAR_SEC(vaporizer, damage),
+                                               WEP_CVAR_SEC(vaporizer, edgedamage),
+                                               WEP_CVAR_SEC(vaporizer, radius),
+                                               WEP_CVAR_SEC(vaporizer, force),
+                                               WEP_CVAR_SEC(vaporizer, speed),
+                                               WEP_CVAR_SEC(vaporizer, spread),
+                                               WEP_CVAR_SEC(vaporizer, delay),
+                                               WEP_CVAR_SEC(vaporizer, lifetime)
+                                       );
+                                       self.weapon = oldwep;
+                                       // now do normal refire
+                                       weapon_thinkf(WFRAME_FIRE2, WEP_CVAR_SEC(vaporizer, animtime), w_ready);
+                               }
+                       }
+                       else
+                               self.held_down = false;
+                       
+                       return true;
+               }
+               case WR_INIT:
+               {
+                       precache_model("models/nexflash.md3");
+                       precache_model(W_Model("g_minstanex.md3"));
+                       precache_model(W_Model("v_minstanex.md3"));
+                       precache_model(W_Model("h_minstanex.iqm"));
+                       precache_sound(W_Sound("minstanexfire"));
+                       precache_sound(W_Sound("nexwhoosh1"));
+                       precache_sound(W_Sound("nexwhoosh2"));
+                       precache_sound(W_Sound("nexwhoosh3"));
+                       //W_Blaster(WR_INIT); // Samual: Is this really the proper thing to do? Didn't we already run this previously?
+                       VAPORIZER_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP);
+                       return true;
+               }
+               case WR_SETUP:
+               {
+                       self.ammo_field = WEP_AMMO(VAPORIZER);
+                       self.vaporizer_lasthit = 0;
+                       return true;
+               }
+               case WR_CHECKAMMO1:
+               {
+                       ammo_amount = self.WEP_AMMO(VAPORIZER) >= vaporizer_ammo;
+                       ammo_amount += self.(weapon_load[WEP_VAPORIZER.m_id]) >= vaporizer_ammo;
+                       return ammo_amount;
+               }
+               case WR_CHECKAMMO2:
+               {
+                       if(!WEP_CVAR_SEC(vaporizer, ammo))
+                               return true;
+                       ammo_amount = self.WEP_AMMO(VAPORIZER) >= WEP_CVAR_SEC(vaporizer, ammo);
+                       ammo_amount += self.(weapon_load[WEP_VAPORIZER.m_id]) >= WEP_CVAR_SEC(vaporizer, ammo);
+                       return ammo_amount;
+               }
+               case WR_CONFIG:
+               {
+                       VAPORIZER_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS);
+                       return true;
+               }
+               case WR_RESETPLAYER:
+               {
+                       self.vaporizer_lasthit = 0;
+                       return true;
+               }
+               case WR_RELOAD:
+               {
+                       float used_ammo;
+                       if(WEP_CVAR_SEC(vaporizer, ammo))
+                               used_ammo = min(vaporizer_ammo, WEP_CVAR_SEC(vaporizer, ammo));
+                       else
+                               used_ammo = vaporizer_ammo;
+                       W_Reload(used_ammo, W_Sound("reload"));
+                       return true;
+               }
+               case WR_SUICIDEMESSAGE:
+               {
+                       return WEAPON_THINKING_WITH_PORTALS;
+               }
+               case WR_KILLMESSAGE:
+               {
+                       return WEAPON_VAPORIZER_MURDER;
+               }
+       }
+       return false;
+ }
+ #endif
+ #ifdef CSQC
+ float W_Vaporizer(float req)
+ {
+       switch(req)
+       {
+               case WR_IMPACTEFFECT:
+               {
+                       vector org2 = w_org + w_backoff * 6;
+                       if(w_deathtype & HITTYPE_SECONDARY)
+                       {
+                               pointparticles(particleeffectnum(EFFECT_BLASTER_IMPACT), org2, w_backoff * 1000, 1);
+                               if(!w_issilent) { sound(self, CH_SHOTS, W_Sound("laserimpact"), VOL_BASE, ATTN_NORM); }
+                       }
+                       else
+                       {
+                               pointparticles(particleeffectnum(EFFECT_VORTEX_IMPACT), org2, '0 0 0', 1);
+                               if(!w_issilent) { sound(self, CH_SHOTS, W_Sound("neximpact"), VOL_BASE, ATTN_NORM); }
+                       }
+                       return true;
+               }
+               case WR_INIT:
+               {
+                       precache_sound(W_Sound("laserimpact"));
+                       precache_sound(W_Sound("neximpact"));
+                       if(autocvar_cl_reticle && autocvar_cl_reticle_weapon)
+                       {
+                               precache_pic("gfx/reticle_nex");
+                       }
+                       return true;
+               }
+               case WR_ZOOMRETICLE:
+               {
+                       if(button_zoom || zoomscript_caught)
+                       {
+                               reticle_image = "gfx/reticle_nex";
+                               return true;
+                       }
+                       else
+                       {
+                               // no weapon specific image for this weapon
+                               return false;
+                       }
+               }
+       }
+       return false;
+ }
+ #endif
+ #endif
@@@ -1,10 -1,29 +1,29 @@@
  #include "cl_player.qh"
- #include "g_triggers.qh"
+ #include "_all.qh"
+ #include "bot/bot.qh"
+ #include "cheats.qh"
+ #include "g_damage.qh"
+ #include "g_subs.qh"
  #include "g_violence.qh"
  #include "miscfunctions.qh"
+ #include "portals.qh"
+ #include "teamplay.qh"
+ #include "weapons/throwing.qh"
+ #include "command/common.qh"
+ #include "../common/animdecide.qh"
+ #include "../common/csqcmodel_settings.qh"
+ #include "../common/deathtypes.qh"
+ #include "../common/triggers/subs.qh"
+ #include "../common/playerstats.qh"
+ #include "../csqcmodellib/sv_model.qh"
+ #include "../common/minigames/sv_minigames.qh"
  
  #include "weapons/weaponstats.qh"
  
+ #include "../common/animdecide.qh"
  void CopyBody_Think(void)
  {
        if(self.CopyBody_nextthink && time > self.CopyBody_nextthink)
@@@ -134,6 -153,8 +153,8 @@@ void player_anim (void
        int animbits = deadbits;
        if(self.frozen)
                animbits |= ANIMSTATE_FROZEN;
+       if(self.movetype == MOVETYPE_FOLLOW)
+               animbits |= ANIMSTATE_FOLLOW;
        if(self.crouch)
                animbits |= ANIMSTATE_DUCK;
        animdecide_setstate(self, animbits, false);
        }
  }
  
- void PlayerCorpseDamage (entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force)
+ void PlayerCorpseDamage (entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
  {
        float take, save;
        vector v;
@@@ -304,7 -325,7 +325,7 @@@ void PlayerDamage (entity inflictor, en
                        damage /= sqrt(bound(1.0, attacker.cvar_cl_handicap, 100.0));
        }
  
-       if(DEATH_ISWEAPON(deathtype, WEP_TUBA))
+       if(DEATH_ISWEAPON(deathtype, WEP_TUBA.m_id))
        {
                // tuba causes blood to come out of the ears
                vector ear1, ear2;
                self.istypefrag = 0;
        }
  
-       frag_inflictor = inflictor;
-       frag_attacker = attacker;
-       frag_target = self;
        frag_damage = damage;
-       damage_take = take;
-       damage_save = save;
-       damage_force = force;
-       MUTATOR_CALLHOOK(PlayerDamage_SplitHealthArmor);
+       MUTATOR_CALLHOOK(PlayerDamage_SplitHealthArmor, inflictor, attacker, self, force, take, save);
        take = bound(0, damage_take, self.health);
        save = bound(0, damage_save, self.armorvalue);
        excess = max(0, damage - take - save);
                dh = dh - max(self.health, 0);
                da = da - max(self.armorvalue, 0);
                WeaponStats_LogDamage(awep, abot, self.weapon, vbot, dh + da);
+               MUTATOR_CALLHOOK(PlayerDamaged, attacker, self, dh, da, hitloc);
        }
  
        if (self.health < 1)
                        if(deathtype == DEATH_KILL)
                        {
                                // for the lemmings fans, a small harmless explosion
-                               pointparticles(particleeffectnum("rocket_explode"), self.origin, '0 0 0', 1);
+                               Send_Effect(EFFECT_ROCKET_EXPLODE, self.origin, '0 0 0', 1);
                        }
                }
  
        if(accuracy_isgooddamage(attacker, self))
          attacker.accuracy.(accuracy_frags[w-1]) += 1;
  
-               frag_attacker = attacker;
-               frag_inflictor = inflictor;
-               frag_target = self;
-               frag_damage = excess;
-               frag_deathtype = deathtype;
-               MUTATOR_CALLHOOK(PlayerDies);
+               MUTATOR_CALLHOOK(PlayerDies, inflictor, attacker, self, deathtype);
 +              excess = frag_damage;
  
                WEP_ACTION(self.weapon, WR_PLAYERDEATH);
  
@@@ -699,12 -709,28 +710,28 @@@ float Say(entity source, float teamsay
                }
                else if(teamsay)
                {
-                       msgstr = strcat("\{1}\{13}", colorstr, "(", colorprefix, namestr, colorstr, ") ^7", msgin);
+                       if(strstrofs(msgin, "/me", 0) >= 0)
+                       {
+                               //msgin = strreplace("/me", "", msgin);
+                               //msgin = substring(msgin, 3, strlen(msgin));
+                               msgin = strreplace("/me", strcat(colorstr, "(", colorprefix, namestr, colorstr, ")^7"), msgin);
+                               msgstr = strcat("\{1}\{13}^4* ", "^7", msgin);
+                       }
+                       else
+                               msgstr = strcat("\{1}\{13}", colorstr, "(", colorprefix, namestr, colorstr, ") ^7", msgin);
                        cmsgstr = strcat(colorstr, "(", colorprefix, namestr, colorstr, ")\n^7", msgin);
                }
                else
                {
-                       msgstr = strcat("\{1}", colorprefix, namestr, "^7: ", msgin);
+                       if(strstrofs(msgin, "/me", 0) >= 0)
+                       {
+                               //msgin = strreplace("/me", "", msgin);
+                               //msgin = substring(msgin, 3, strlen(msgin));
+                               msgin = strreplace("/me", strcat(colorprefix, namestr), msgin);
+                               msgstr = strcat("\{1}^4* ", "^7", msgin);
+                       }
+                       else
+                               msgstr = strcat("\{1}", colorprefix, namestr, "^7: ", msgin);
                        cmsgstr = "";
                }
                msgstr = strcat(strreplace("\n", " ", msgstr), "\n"); // newlines only are good for centerprint
                                flood = 2;
                        }
  
-                       if(time >= source.flood_field)
+                       if (time >= source.(flood_field))
                        {
-                               source.flood_field = max(time - flood_burst * flood_spl, source.flood_field) + lines * flood_spl;
+                               source.(flood_field) = max(time - flood_burst * flood_spl, source.(flood_field)) + lines * flood_spl;
                        }
                        else
                        {
                }
                else
                {
-                       if(time >= source.flood_field)
-                               source.flood_field = max(time - flood_burst * flood_spl, source.flood_field) + flood_spl;
+                       if (time >= source.(flood_field))
+                               source.(flood_field) = max(time - flood_burst * flood_spl, source.(flood_field)) + flood_spl;
                        else
                                flood = 1;
                }
  
                if (timeout_status == TIMEOUT_ACTIVE) // when game is paused, no flood protection
-                       source.flood_field = flood = 0;
+                       source.(flood_field) = flood = 0;
        }
  
        if(flood == 2) // cannot happen for empty msgstr
        }
  
        if(flood)
-               print("NOTE: ", playername(source), "^7 is flooding.\n");
+               LOG_INFO("NOTE: ", playername(source), "^7 is flooding.\n");
  
        // build sourcemsgstr by cutting off a prefix and replacing it by the other one
        if(privatesay)
        }
        else if(flood == 1)
        {
-               if(autocvar_g_chat_flood_notify_flooder)
+               if (autocvar_g_chat_flood_notify_flooder)
                {
-                       sprint(source, strcat("^3FLOOD CONTROL: ^7wait ^1", ftos(source.flood_field - time), "^3 seconds\n"));
+                       sprint(source, strcat("^3FLOOD CONTROL: ^7wait ^1", ftos(source.(flood_field) - time), "^3 seconds\n"));
                        ret = 0;
                }
                else
                        if(cmsgstr != "")
                                centerprint(privatesay, cmsgstr);
                }
+               else if ( teamsay && source.active_minigame )
+               {
+                       sprint(source, sourcemsgstr);
+                       dedicated_print(msgstr); // send to server console too
+                       FOR_EACH_REALCLIENT(head) 
+                               if(head != source)
+                               if(head.active_minigame == source.active_minigame)
+                                       sprint(head, msgstr);
+               }
                else if(teamsay > 0) // team message, only sent to team mates
                {
                        sprint(source, sourcemsgstr);
@@@ -961,7 -996,7 +997,7 @@@ void PrecachePlayerSounds(string f
        {
                if(tokenize_console(s) != 3)
                {
-                       dprint("Invalid sound info line: ", s, "\n");
+                       LOG_TRACE("Invalid sound info line: ", s, "\n");
                        continue;
                }
                PrecacheGlobalSound(strcat(argv(1), " ", argv(2)));
@@@ -993,7 -1028,7 +1029,7 @@@ float LoadPlayerSounds(string f, float 
        fh = fopen(f, FILE_READ);
        if(fh < 0)
        {
-               dprint("Player sound file not found: ", f, "\n");
+               LOG_TRACE("Player sound file not found: ", f, "\n");
                return 0;
        }
        while((s = fgets(fh)))
                        field = GetVoiceMessageSampleField(argv(0));
                if(GetPlayerSoundSampleField_notFound)
                        continue;
-               if(self.field)
-                       strunzone(self.field);
-               self.field = strzone(strcat(argv(1), " ", argv(2)));
+               if (self.(field))
+                       strunzone(self.(field));
+               self.(field) = strzone(strcat(argv(1), " ", argv(2)));
        }
        fclose(fh);
        return 1;
@@@ -1202,7 -1237,7 +1238,7 @@@ void GlobalSound(string sample, float c
  
  void PlayerSound(.string samplefield, float chan, float voicetype)
  {
-       GlobalSound(self.samplefield, chan, voicetype);
+       GlobalSound(self.(samplefield), chan, voicetype);
  }
  
  void VoiceMessage(string type, string msg)
  
        flood = Say(self, ownteam, world, msg, 1);
  
-       if(IS_SPEC(self) || IS_OBSERVER(self) || flood < 0)
-               FakeGlobalSound(self.sample, CH_VOICE, voicetype);
+       if (IS_SPEC(self) || IS_OBSERVER(self) || flood < 0)
+               FakeGlobalSound(self.(sample), CH_VOICE, voicetype);
        else if (flood > 0)
-               GlobalSound(self.sample, CH_VOICE, voicetype);
+               GlobalSound(self.(sample), CH_VOICE, voicetype);
  }
  
  void MoveToTeam(entity client, float team_colour, float type)
@@@ -1,20 -1,25 +1,25 @@@
+ #include "../_all.qh"
+ #include "mutator.qh"
+ #include "../cl_client.qh"
+ #include "../../common/buffs.qh"
+ #include "../../common/items/all.qc"
  void spawnfunc_item_minst_cells (void)
  {
        if (!g_instagib) { remove(self); return; }
        if (!self.ammo_cells)
                self.ammo_cells = autocvar_g_instagib_ammo_drop;
  
-       StartItem ("models/items/a_cells.md3",
-                          "misc/itempickup.wav", 45, 0,
-                          "Vaporizer Ammo", IT_CELLS, 0, 0, generic_pickupevalfunc, 100);
+       StartItemA (ITEM_VaporizerCells);
  }
  
  void instagib_health_mega()
  {
        self.max_health = 1;
-       StartItem ("models/items/g_h100.md3",
-                          "misc/megahealth.wav", g_pickup_respawntime_powerup, g_pickup_respawntimejitter_powerup,
-                          "Extralife", IT_NAILS, 0, FL_POWERUP, generic_pickupevalfunc, BOT_PICKUP_RATING_HIGH);
+       StartItemA (ITEM_ExtraLife);
  }
  
  .float instagib_nextthink;
@@@ -37,6 -42,14 +42,14 @@@ void instagib_ammocheck(
                instagib_stop_countdown(self);
        else if (self.ammo_cells > 0 || (self.items & IT_UNLIMITED_WEAPON_AMMO) || (self.flags & FL_GODMODE))
                instagib_stop_countdown(self);
+       else if(autocvar_g_rm && autocvar_g_rm_laser)
+       {
+               if(!self.instagib_needammo)
+               {
+                       Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_INSTAGIB_DOWNGRADE);
+                       self.instagib_needammo = true;
+               }
+       }
        else
        {
                self.instagib_needammo = true;
@@@ -119,7 -132,7 +132,7 @@@ MUTATOR_HOOKFUNCTION(instagib_MonsterLo
  MUTATOR_HOOKFUNCTION(instagib_MonsterSpawn)
  {
        // always refill ammo
-       if(self.monsterid == MON_MAGE)
+       if(self.monsterid == MON_MAGE.monsterid)
                self.skin = 1;
  
        return false;
  
  MUTATOR_HOOKFUNCTION(instagib_BotShouldAttack)
  {
-       if(checkentity.items & IT_STRENGTH)
+       if(checkentity.items & ITEM_Strength.m_itemid)
                return true;
  
        return false;
@@@ -162,14 -175,14 +175,14 @@@ MUTATOR_HOOKFUNCTION(instagib_PlayerPow
        if (!(self.effects & EF_FULLBRIGHT))
                self.effects |= EF_FULLBRIGHT;
  
-       if (self.items & IT_STRENGTH)
+       if (self.items & ITEM_Strength.m_itemid)
        {
                play_countdown(self.strength_finished, "misc/poweroff.wav");
                if (time > self.strength_finished)
                {
                        self.alpha = default_player_alpha;
                        self.exteriorweaponentity.alpha = default_weapon_alpha;
-                       self.items &= ~IT_STRENGTH;
+                       self.items &= ~ITEM_Strength.m_itemid;
                        Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_POWERDOWN_INVISIBILITY);
                }
        }
                {
                        self.alpha = autocvar_g_instagib_invis_alpha;
                        self.exteriorweaponentity.alpha = autocvar_g_instagib_invis_alpha;
-                       self.items |= IT_STRENGTH;
+                       self.items |= ITEM_Strength.m_itemid;
                        Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_POWERUP_INVISIBILITY, self.netname);
                        Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_POWERUP_INVISIBILITY);
                }
        }
  
-       if (self.items & IT_INVINCIBLE)
+       if (self.items & ITEM_Shield.m_itemid)
        {
                play_countdown(self.invincible_finished, "misc/poweroff.wav");
                if (time > self.invincible_finished)
                {
-                       self.items &= ~IT_INVINCIBLE;
+                       self.items &= ~ITEM_Shield.m_itemid;
                        Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_POWERDOWN_SPEED);
                }
        }
        {
                if (time < self.invincible_finished)
                {
-                       self.items |= IT_INVINCIBLE;
+                       self.items |= ITEM_Shield.m_itemid;
                        Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_POWERUP_SPEED, self.netname);
                        Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_POWERUP_SPEED);
                }
  
  MUTATOR_HOOKFUNCTION(instagib_PlayerPhysics)
  {
-       if(self.items & IT_INVINCIBLE)
+       if(self.items & ITEM_Shield.m_itemid)
                self.stat_sv_maxspeed = self.stat_sv_maxspeed * autocvar_g_instagib_speed_highspeed;
  
        return false;
@@@ -236,16 -249,21 +249,21 @@@ MUTATOR_HOOKFUNCTION(instagib_PlayerDam
  
        if(IS_PLAYER(frag_target))
        {
-               if ((frag_deathtype == DEATH_FALL)  ||
-                       (frag_deathtype == DEATH_DROWN) ||
-                       (frag_deathtype == DEATH_SLIME) ||
-                       (frag_deathtype == DEATH_LAVA))
+               if(frag_deathtype == DEATH_FALL)
+                       frag_damage = 0; // never count fall damage
+               if(!autocvar_g_instagib_damagedbycontents)
+               switch(frag_deathtype)
                {
-                       frag_damage = 0;
+                       case DEATH_DROWN:
+                       case DEATH_SLIME:
+                       case DEATH_LAVA:
+                               frag_damage = 0;
+                               break;
                }
  
                if(IS_PLAYER(frag_attacker))
-               if(DEATH_ISWEAPON(frag_deathtype, WEP_VAPORIZER))
+               if(DEATH_ISWEAPON(frag_deathtype, WEP_VAPORIZER.m_id))
                {
                        if(frag_target.armorvalue)
                        {
                        }
                }
  
-               if(IS_PLAYER(frag_attacker) && DEATH_ISWEAPON(frag_deathtype, WEP_BLASTER))
+               if(IS_PLAYER(frag_attacker) && DEATH_ISWEAPON(frag_deathtype, WEP_BLASTER.m_id))
                {
                        if(frag_deathtype & HITTYPE_SECONDARY)
                        {
                frag_mirrordamage = 0;
        }
  
-       if((frag_target.buffs & BUFF_INVISIBLE) || (frag_target.items & IT_STRENGTH))
+       if((frag_target.buffs & BUFF_INVISIBLE.m_itemid) || (frag_target.items & ITEM_Strength.m_itemid))
                yoda = 1;
  
        return false;
@@@ -314,19 -332,21 +332,21 @@@ MUTATOR_HOOKFUNCTION(instagib_FilterIte
        if(self.classname == "item_cells")
                return true; // no normal cells?
  
-       if(self.weapon == WEP_VAPORIZER && self.classname == "droppedweapon")
+       if(self.weapon == WEP_VAPORIZER.m_id && self.classname == "droppedweapon")
        {
                self.ammo_cells = autocvar_g_instagib_ammo_drop;
                return false;
        }
  
-       if(self.weapon == WEP_DEVASTATOR || self.weapon == WEP_VORTEX)
+       if(self.weapon == WEP_DEVASTATOR.m_id || self.weapon == WEP_VORTEX.m_id)
        {
-               entity e = spawn();
+               entity e = spawn(), oldself;
                setorigin(e, self.origin);
-               entity oldself;
                oldself = self;
                self = e;
+               self.noalign = oldself.noalign;
+               self.cnt = oldself.cnt;
+               self.team = oldself.team;
                spawnfunc_item_minst_cells();
                self = oldself;
                return true;
@@@ -350,7 -370,7 +370,7 @@@ MUTATOR_HOOKFUNCTION(instagib_Customize
  
        // if you have the invisibility powerup, sprites ALWAYS are restricted to your team
        // but only apply this to real players, not to spectators
-       if((self.owner.flags & FL_CLIENT) && (self.owner.items & IT_STRENGTH) && (e == other))
+       if((self.owner.flags & FL_CLIENT) && (self.owner.items & ITEM_Strength.m_itemid) && (e == other))
        if(DIFF_TEAM(self.owner, e))
                return true;
  
  
  MUTATOR_HOOKFUNCTION(instagib_ItemCountdown)
  {
-       switch(self.items)
+       switch (self.items)
        {
-               case IT_STRENGTH:   item_name = "item-invis"; item_color = '0 0 1'; break;
-               case IT_NAILS:      item_name = "item-extralife"; item_color = '1 0 0'; break;
-               case IT_INVINCIBLE: item_name = "item-speed"; item_color = '1 0 1'; break;
+               case ITEM_Strength.m_itemid:  item_name = "item-invis";     item_color = '0 0 1'; break;
+               case ITEM_ExtraLife.m_itemid: item_name = "item-extralife"; item_color = '1 0 0'; break;
+               case ITEM_Shield.m_itemid:    item_name = "item-speed";     item_color = '1 0 1'; break;
        }
        return false;
  }
  
-       if(DEATH_ISWEAPON(frag_deathtype, WEP_VAPORIZER))
 +MUTATOR_HOOKFUNCTION(instagib_PlayerDies)
 +{     
++      if(DEATH_ISWEAPON(frag_deathtype, WEP_VAPORIZER.m_id))
 +              frag_damage = 1000; // always gib if it was a vaporizer death
 +
 +      return FALSE;
 +}
 +
  MUTATOR_HOOKFUNCTION(instagib_ItemTouch)
  {
        if(self.ammo_cells)
  MUTATOR_HOOKFUNCTION(instagib_OnEntityPreSpawn)
  {
        if (!autocvar_g_powerups) { return false; }
-       if (!(self.classname == "item_strength" || self.classname == "item_invincible" || self.classname == "item_health_mega"))
+       if (!(self.classname == "item_strength" || self.classname == "item_invincible" || self.itemdef == ITEM_HealthMega))
                return false;
  
        entity e = spawn();
@@@ -461,7 -473,6 +481,7 @@@ MUTATOR_DEFINITION(mutator_instagib
        MUTATOR_HOOK(FilterItem, instagib_FilterItem, CBC_ORDER_ANY);
        MUTATOR_HOOK(CustomizeWaypoint, instagib_CustomizeWaypoint, CBC_ORDER_ANY);
        MUTATOR_HOOK(Item_RespawnCountdown, instagib_ItemCountdown, CBC_ORDER_ANY);
 +      MUTATOR_HOOK(PlayerDies, instagib_PlayerDies, CBC_ORDER_ANY);
        MUTATOR_HOOK(PlayerDamage_SplitHealthArmor, instagib_SplitHealthArmor, CBC_ORDER_ANY);
        MUTATOR_HOOK(PlayerPowerups, instagib_PlayerPowerups, CBC_ORDER_ANY);
        MUTATOR_HOOK(ForbidThrowCurrentWeapon, instagib_ForbidThrowing, CBC_ORDER_ANY);
diff --combined vehicles.cfg
@@@ -13,7 -13,16 +13,16 @@@ set g_vehicle_bumblebee 
  set g_vehicles_crush_dmg 70
  set g_vehicles_crush_force 50
  
+ set cl_vehicles_hud_tactical 1
  set cl_vehicles_hudscale 0.5
+ set cl_vehicles_crosshair_size 0.5
+ set g_vehicles_enter 0 "require pressing use key to enter a vehicle"
+ set g_vehicles_enter_radius 250
+ set g_vehicles_steal 1 "allow stealing enemy vehicles in teamplay modes"
+ set g_vehicles_steal_show_waypoint 1 "show a waypoint above the thief"
+ set g_vehicles_teams 1 "allow team specific vehicles"
  
  set g_vehicles_delayspawn 1
  set g_vehicles_delayspawn_jitter 10
@@@ -21,6 -30,6 +30,6 @@@
  set g_vehicles_vortex_damagerate 0.5
  set g_vehicles_machinegun_damagerate 0.65
  set g_vehicles_rifle_damagerate 1
 -set g_vehicles_vaporizer_damagerate 0.007
 +set g_vehicles_vaporizer_damagerate 0.8
  set g_vehicles_tag_damagerate 2