]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'master' into terencehill/bot_fix
authorterencehill <piuntn@gmail.com>
Thu, 29 Dec 2016 01:59:28 +0000 (02:59 +0100)
committerterencehill <piuntn@gmail.com>
Thu, 29 Dec 2016 01:59:28 +0000 (02:59 +0100)
59 files changed:
qcsrc/client/hud/panel/powerups.qc
qcsrc/client/hud/panel/radar.qc
qcsrc/client/miscfunctions.qh
qcsrc/client/teamradar.qc
qcsrc/common/ent_cs.qc
qcsrc/common/gamemodes/gamemode/onslaught/sv_onslaught.qc
qcsrc/common/items/all.qh
qcsrc/common/items/inventory.qh
qcsrc/common/items/item.qh
qcsrc/common/monsters/sv_monsters.qc
qcsrc/common/mutators/mutator/spawn_near_teammate/sv_spawn_near_teammate.qc
qcsrc/common/mutators/mutator/waypoints/waypointsprites.qc
qcsrc/common/physics/player.qc
qcsrc/common/stats.qh
qcsrc/common/t_items.qc
qcsrc/common/triggers/trigger/jumppads.qc
qcsrc/common/turrets/turret/hk_weapon.qc
qcsrc/common/vehicles/sv_vehicles.qc
qcsrc/common/vehicles/vehicle/bumblebee.qc
qcsrc/common/weapons/weapon/porto.qc
qcsrc/common/weapons/weapon/shotgun.qc
qcsrc/common/weapons/weapon/vaporizer.qc
qcsrc/lib/csqcmodel/cl_player.qc
qcsrc/lib/vector.qh
qcsrc/menu/xonotic/credits.qc
qcsrc/server/_all.inc
qcsrc/server/_mod.inc
qcsrc/server/_mod.qh
qcsrc/server/bot/default/havocbot/havocbot.qc
qcsrc/server/bot/default/navigation.qc
qcsrc/server/bot/default/waypoints.qc
qcsrc/server/cheats.qc
qcsrc/server/client.qc
qcsrc/server/command/getreplies.qc
qcsrc/server/command/sv_cmd.qc
qcsrc/server/compat/_mod.inc [new file with mode: 0644]
qcsrc/server/compat/_mod.qh [new file with mode: 0644]
qcsrc/server/compat/halflife.qc [new file with mode: 0644]
qcsrc/server/compat/halflife.qh [new file with mode: 0644]
qcsrc/server/compat/quake.qc [new file with mode: 0644]
qcsrc/server/compat/quake.qh [new file with mode: 0644]
qcsrc/server/compat/quake3.qc [new file with mode: 0644]
qcsrc/server/compat/quake3.qh [new file with mode: 0644]
qcsrc/server/compat/wop.qc [new file with mode: 0644]
qcsrc/server/compat/wop.qh [new file with mode: 0644]
qcsrc/server/impulse.qc
qcsrc/server/mapvoting.qc
qcsrc/server/miscfunctions.qc
qcsrc/server/mutators/mutator/gamemode_ctf.qc
qcsrc/server/mutators/mutator/gamemode_keyhunt.qc
qcsrc/server/portals.qc
qcsrc/server/race.qc
qcsrc/server/t_halflife.qc [deleted file]
qcsrc/server/t_halflife.qh [deleted file]
qcsrc/server/t_quake.qc [deleted file]
qcsrc/server/t_quake.qh [deleted file]
qcsrc/server/t_quake3.qc [deleted file]
qcsrc/server/t_quake3.qh [deleted file]
qcsrc/server/weapons/weaponsystem.qc

index 7c454f9f9001ff695115234408f7c571f8d93a25..076ce918f14723dcde2e755308a3f4379fb885e0 100644 (file)
@@ -63,7 +63,7 @@ void HUD_Powerups()
 {
        int allItems = STAT(ITEMS);
        int allBuffs = STAT(BUFFS);
-       int strengthTime, shieldTime, superTime;
+       float strengthTime, shieldTime, superTime;
 
        // Initialize items
        if(!autocvar__hud_configure)
@@ -72,7 +72,7 @@ void HUD_Powerups()
                        return;
                if(STAT(HEALTH) <= 0 && autocvar_hud_panel_powerups_hide_ondeath)
                        return;
-               if(!(allItems & (ITEM_Strength.m_itemid | ITEM_Shield.m_itemid | IT_SUPERWEAPON)) && !allBuffs) return;
+               //if(!(allItems & (ITEM_Strength.m_itemid | ITEM_Shield.m_itemid | IT_SUPERWEAPON)) && !allBuffs) return;
 
                strengthTime = bound(0, STAT(STRENGTH_FINISHED) - time, 99);
                shieldTime = bound(0, STAT(INVINCIBLE_FINISHED) - time, 99);
index 269d870718e42663a431a3445c984876ff74b4c5..3bc537c8f8b5e42760e5ca614ac4e02dadc4ce08 100644 (file)
@@ -312,10 +312,10 @@ void HUD_Radar()
        else
        {
                vector c0, c1, c2, c3, span;
-               c0 = rotate(mi_min, teamradar_angle * DEG2RAD);
-               c1 = rotate(mi_max, teamradar_angle * DEG2RAD);
-               c2 = rotate('1 0 0' * mi_min.x + '0 1 0' * mi_max.y, teamradar_angle * DEG2RAD);
-               c3 = rotate('1 0 0' * mi_max.x + '0 1 0' * mi_min.y, teamradar_angle * DEG2RAD);
+               c0 = Rotate(mi_min, teamradar_angle * DEG2RAD);
+               c1 = Rotate(mi_max, teamradar_angle * DEG2RAD);
+               c2 = Rotate('1 0 0' * mi_min.x + '0 1 0' * mi_max.y, teamradar_angle * DEG2RAD);
+               c3 = Rotate('1 0 0' * mi_max.x + '0 1 0' * mi_min.y, teamradar_angle * DEG2RAD);
                span = '0 0 0';
                span.x = max(c0_x, c1_x, c2_x, c3_x) - min(c0_x, c1_x, c2_x, c3_x);
                span.y = max(c0_y, c1_y, c2_y, c3_y) - min(c0_y, c1_y, c2_y, c3_y);
index 9d792f60cd62ad3335e5531e8c48c483a16dc199..62de4565e53bff2549a9b361f063ab0791c7004b 100644 (file)
@@ -31,7 +31,7 @@ vector HUD_GetFontsize(string cvarname);
 
 float PreviewExists(string name);
 
-vector rotate(vector v, float a);
+vector Rotate(vector v, float a);
 
 
 #define IS_DEAD(s) (((s).classname == "csqcmodel") ? (s).csqcmodel_isdead : ((s).health <= 0))
index abd700e613e38895b44ceeba7acbe86498895b42..782776eb7866757ebc7ff8ad24076b4923e57859 100644 (file)
@@ -20,7 +20,7 @@ vector teamradar_texcoord_to_2dcoord(vector in)
        vector out;
        in -= teamradar_origin3d_in_texcoord;
 
-       out = rotate(in, teamradar_angle * DEG2RAD);
+       out = Rotate(in, teamradar_angle * DEG2RAD);
        out.y = - out.y; // screen space is reversed
 
        out = out * teamradar_size;
@@ -42,7 +42,7 @@ vector teamradar_2dcoord_to_texcoord(vector in)
        out = out / teamradar_size;
 
        out_y = - out_y; // screen space is reversed
-       out = rotate(out, -teamradar_angle * DEG2RAD);
+       out = Rotate(out, -teamradar_angle * DEG2RAD);
 
        out += teamradar_origin3d_in_texcoord;
 
index 71052bd2b7fdbf256aaf2d034ec2490801e9657c..5a5c6acbebfefced8df45a82313944e36e49d496 100644 (file)
@@ -13,9 +13,9 @@ MACRO_END
 // #define PROP(public, fld, set, sv, cl)
 #define ENTCS_NETPROPS(ent, PROP) PROP(false, sv_entnum, ENTCS_SET_NORMAL, {}, {}) /* sentinel */ \
        PROP(false, origin, ENTCS_SET_NORMAL, \
-       { WriteShort(chan, ent.origin.x);  WriteShort(chan, ent.origin.y); \
-         WriteShort(chan, ent.origin.z); }, \
-       { ent.has_sv_origin = true; vector v; v.x = ReadShort(); v.y = ReadShort(); v.z = ReadShort(); setorigin(ent, v); }) \
+       { WriteCoord(chan, ent.origin.x);  WriteCoord(chan, ent.origin.y); \
+         WriteCoord(chan, ent.origin.z); }, \
+       { ent.has_sv_origin = true; vector v; v.x = ReadCoord(); v.y = ReadCoord(); v.z = ReadCoord(); setorigin(ent, v); }) \
     \
        PROP(false, angles_y, ENTCS_SET_NORMAL, \
        { WriteByte(chan, ent.angles.y / 360 * 256); }, \
index 572611c5d3f874169b7312c224888758d64f26a3..195a3bd982819c9329de86bed31de64328455504 100644 (file)
@@ -1638,7 +1638,7 @@ bool ons_Teleport(entity player, entity tele_target, float range, bool tele_effe
 
                loc += tele_target.origin + '0 0 128' * iteration_scale;
 
-               tracebox(loc, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), loc, MOVE_NORMAL, player);
+               tracebox(loc, STAT(PL_MIN, player), STAT(PL_MAX, player), loc, MOVE_NORMAL, player);
                if(trace_fraction == 1.0 && !trace_startsolid)
                {
                        traceline(tele_target.origin, loc, MOVE_NOMONSTERS, tele_target); // double check to make sure we're not spawning outside the NULL
@@ -1757,7 +1757,7 @@ MUTATOR_HOOKFUNCTION(ons, PlayerSpawn)
                                iteration_scale -= i / 10;
                                loc = closest_target.origin + '0 0 96' * iteration_scale;
                                loc += ('0 1 0' * random()) * 128 * iteration_scale;
-                               tracebox(loc, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), loc, MOVE_NORMAL, player);
+                               tracebox(loc, STAT(PL_MIN, player), STAT(PL_MAX, player), loc, MOVE_NORMAL, player);
                                if(trace_fraction == 1.0 && !trace_startsolid)
                                {
                                        traceline(closest_target.origin, loc, MOVE_NOMONSTERS, closest_target); // double check to make sure we're not spawning outside the NULL
@@ -1808,7 +1808,7 @@ MUTATOR_HOOKFUNCTION(ons, PlayerSpawn)
                                iteration_scale -= i / 10;
                                loc = closest_target.origin + '0 0 128' * iteration_scale;
                                loc += ('0 1 0' * random()) * 256 * iteration_scale;
-                               tracebox(loc, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), loc, MOVE_NORMAL, player);
+                               tracebox(loc, STAT(PL_MIN, player), STAT(PL_MAX, player), loc, MOVE_NORMAL, player);
                                if(trace_fraction == 1.0 && !trace_startsolid)
                                {
                                        traceline(closest_target.origin, loc, MOVE_NOMONSTERS, closest_target); // double check to make sure we're not spawning outside the NULL
index d377776cd554f0bc5c3b0467c755cf8fe641ad37..dc8cf21c020a6d06993f87281cc1dad98f29cbac 100644 (file)
@@ -4,7 +4,7 @@
 
 #include "item.qh"
 
-REGISTRY(Items, BITS(5))
+REGISTRY(Items, BITS(7))
 #define Items_from(i) _Items_from(i, NULL)
 REGISTER_REGISTRY(Items)
 #define REGISTER_ITEM(id, class) REGISTER(Items, ITEM, id, m_id, NEW(class))
index 811f716fb84bccad19e7cf9044c6f56ffafaa0d0..a022979a7065f7ee07c8cdfb0fc94c3ab9a0038a 100644 (file)
@@ -15,17 +15,33 @@ ENDCLASS(Inventory)
 
 REGISTER_NET_LINKED(ENT_CLIENT_INVENTORY)
 
+const int Inventory_groups_major = 16;
+const int Inventory_groups_minor = 8; // ceil(Items_MAX / Inventory_groups_major)
+
+#define G_MAJOR(id) (floor((id) / Inventory_groups_minor))
+#define G_MINOR(id) ((id) % Inventory_groups_minor)
+
 #ifdef CSQC
 NET_HANDLE(ENT_CLIENT_INVENTORY, bool isnew)
 {
     make_pure(this);
-    const int bits = ReadInt24_t();
-    FOREACH(Items, bits & BIT(it.m_id), {
-        .int fld = inv_items[it.m_id];
-        int prev = this.(fld);
-        int next = this.(fld) = ReadByte();
-        LOG_TRACEF("%s: %.0f -> %.0f", it.m_name, prev, next);
-    });
+    const int majorBits = ReadShort();
+    for (int i = 0; i < Inventory_groups_major; ++i) {
+        if (!(majorBits & BIT(i))) {
+            continue;
+        }
+        const int minorBits = ReadByte();
+        for (int j = 0; j < Inventory_groups_minor; ++j) {
+            if (!(minorBits & BIT(j))) {
+                continue;
+            }
+            const GameItem it = Items_from(Inventory_groups_minor * i + j);
+            .int fld = inv_items[it.m_id];
+            int prev = this.(fld);
+            int next = this.(fld) = ReadByte();
+            LOG_TRACEF("%s: %.0f -> %.0f", it.m_name, prev, next);
+        }
+    }
     return true;
 }
 #endif
@@ -34,22 +50,56 @@ NET_HANDLE(ENT_CLIENT_INVENTORY, bool isnew)
 void Inventory_Write(Inventory data)
 {
     if (!data) {
-        WriteInt24_t(MSG_ENTITY, 0);
+        WriteShort(MSG_ENTITY, 0);
         return;
     }
     TC(Inventory, data);
-    int bits = 0;
+
+    int majorBits = 0;
     FOREACH(Items, true, {
         .int fld = inv_items[it.m_id];
-        bits = BITSET(bits, BIT(it.m_id), data.inventory.(fld) != (data.inventory.(fld) = data.(fld)));
+        const bool changed = data.inventory.(fld) != data.(fld);
+        if (changed) {
+            majorBits = BITSET(majorBits, BIT(G_MAJOR(it.m_id)), true);
+        }
     });
-    WriteInt24_t(MSG_ENTITY, bits);
-    FOREACH(Items, bits & BIT(it.m_id), {
-        WriteByte(MSG_ENTITY, data.inv_items[it.m_id]);
+    WriteShort(MSG_ENTITY, majorBits);
+
+    int minorBits = 0;
+    int lastMaj = 0;
+    int maj = 0;
+    FOREACH(Items, majorBits & BIT(maj = G_MAJOR(it.m_id)), {
+        .int fld = inv_items[it.m_id];
+        const bool changed = data.inventory.(fld) != (data.inventory.(fld) = data.(fld));
+        if (changed) {
+            if (maj != lastMaj) {
+                lastMaj = maj;
+#define X() MACRO_BEGIN \
+    if (minorBits) { \
+        WriteByte(MSG_ENTITY, minorBits); \
+        for (int j = 0; j < Inventory_groups_minor; ++j) { \
+            if (!(minorBits & BIT(j))) { \
+                continue; \
+            } \
+            const GameItem it = Items_from(Inventory_groups_minor * maj + j); \
+            WriteByte(MSG_ENTITY, data.inv_items[it.m_id]); \
+        } \
+    } \
+MACRO_END
+                X();
+                minorBits = 0;
+            }
+            minorBits = BITSET(minorBits, BIT(G_MINOR(it.m_id)), true);
+        }
     });
+    X();
+#undef X
 }
 #endif
 
+#undef G_MAJOR
+#undef G_MINOR
+
 #ifdef SVQC
 bool Inventory_Send(Inventory this, Client to, int sf)
 {
index bac127059daa12c6db32695d90aea95cf22f28ff..f3aa0cec26b067f47244b96c4af521028b677991 100644 (file)
@@ -34,7 +34,6 @@ const int IT_SUPERWEAPON                              = BIT(21); // suit
 const int IT_STRENGTH                                  = BIT(22);
 
 // item masks
-const int IT_AMMO                              = IT_FUEL | IT_SHELLS | IT_NAILS | IT_ROCKETS | IT_CELLS | IT_PLASMA;
 const int IT_UNLIMITED_AMMO                    = IT_UNLIMITED_WEAPON_AMMO | IT_UNLIMITED_SUPERWEAPONS;
 const int IT_PICKUPMASK                        = IT_UNLIMITED_AMMO | IT_JETPACK | IT_FUEL_REGEN; // strength and invincible are handled separately
 
index b8c3bab21e77240e82dcef113826ab1b5b96c751..f0f789af3762ffcf1a9ebdf8e1b2697c945b9599 100644 (file)
@@ -34,7 +34,7 @@ void monster_dropitem(entity this, entity attacker)
        if(!this.candrop || !this.monster_loot)
                return;
 
-       vector org = this.origin + ((this.mins + this.maxs) * 0.5);
+       vector org = CENTER_OR_VIEWOFS(this);
        entity e = new(droppedweapon); // use weapon handling to remove it on touch
        e.spawnfunc_checked = true;
 
@@ -80,7 +80,7 @@ bool Monster_ValidTarget(entity this, entity targ)
 
        if((targ == this)
        || (autocvar_g_monsters_lineofsight && !checkpvs(this.origin + this.view_ofs, targ)) // enemy cannot be seen
-       || (IS_VEHICLE(targ) && !((get_monsterinfo(this.monsterid)).spawnflags & MON_FLAG_RANGED)) // melee vs vehicle is useless
+       || (IS_VEHICLE(targ) && !((Monsters_from(this.monsterid)).spawnflags & MON_FLAG_RANGED)) // melee vs vehicle is useless
        || (time < game_starttime) // monsters do nothing before match has started
        || (targ.takedamage == DAMAGE_NO)
        || (targ.items & IT_INVISIBILITY)
@@ -107,10 +107,8 @@ bool Monster_ValidTarget(entity this, entity targ)
        if(autocvar_g_monsters_target_infront || (this.spawnflags & MONSTERFLAG_INFRONT))
        if(this.enemy != targ)
        {
-               float dot;
-
                makevectors (this.angles);
-               dot = normalize (targ.origin - this.origin) * v_forward;
+               float dot = normalize (targ.origin - this.origin) * v_forward;
 
                if(dot <= autocvar_g_monsters_target_infront_range) { return false; }
        }
@@ -118,25 +116,25 @@ bool Monster_ValidTarget(entity this, entity targ)
        return true; // this target is valid!
 }
 
-entity Monster_FindTarget(entity mon)
+entity Monster_FindTarget(entity this)
 {
-       if(MUTATOR_CALLHOOK(MonsterFindTarget)) { return mon.enemy; } // Handled by a mutator
+       if(MUTATOR_CALLHOOK(MonsterFindTarget)) { return this.enemy; } // Handled by a mutator
 
        entity closest_target = NULL;
+       vector my_center = CENTER_OR_VIEWOFS(this);
 
        // find the closest acceptable target to pass to
-       FOREACH_ENTITY_RADIUS(mon.origin, mon.target_range, it.monster_attack,
+       FOREACH_ENTITY_RADIUS(this.origin, this.target_range, it.monster_attack,
        {
-               if(Monster_ValidTarget(mon, it))
+               if(Monster_ValidTarget(this, it))
                {
                        // if it's a player, use the view origin as reference (stolen from RadiusDamage functions in g_damage.qc)
-                       vector head_center = CENTER_OR_VIEWOFS(it);
-                       vector ent_center = CENTER_OR_VIEWOFS(mon);
+                       vector targ_center = CENTER_OR_VIEWOFS(it);
 
                        if(closest_target)
                        {
                                vector closest_target_center = CENTER_OR_VIEWOFS(closest_target);
-                               if(vlen2(ent_center - head_center) < vlen2(ent_center - closest_target_center))
+                               if(vlen2(my_center - targ_center) < vlen2(my_center - closest_target_center))
                                        { closest_target = it; }
                        }
                        else { closest_target = it; }
@@ -146,43 +144,43 @@ entity Monster_FindTarget(entity mon)
        return closest_target;
 }
 
-void monster_setupcolors(entity mon)
+void monster_setupcolors(entity this)
 {
-       if(IS_PLAYER(mon.realowner))
-               mon.colormap = mon.realowner.colormap;
-       else if(teamplay && mon.team)
-               mon.colormap = 1024 + (mon.team - 1) * 17;
+       if(IS_PLAYER(this.realowner))
+               this.colormap = this.realowner.colormap;
+       else if(teamplay && this.team)
+               this.colormap = 1024 + (this.team - 1) * 17;
        else
        {
-               if(mon.monster_skill <= MONSTER_SKILL_EASY)
-                       mon.colormap = 1029;
-               else if(mon.monster_skill <= MONSTER_SKILL_MEDIUM)
-                       mon.colormap = 1027;
-               else if(mon.monster_skill <= MONSTER_SKILL_HARD)
-                       mon.colormap = 1038;
-               else if(mon.monster_skill <= MONSTER_SKILL_INSANE)
-                       mon.colormap = 1028;
-               else if(mon.monster_skill <= MONSTER_SKILL_NIGHTMARE)
-                       mon.colormap = 1032;
+               if(this.monster_skill <= MONSTER_SKILL_EASY)
+                       this.colormap = 1029;
+               else if(this.monster_skill <= MONSTER_SKILL_MEDIUM)
+                       this.colormap = 1027;
+               else if(this.monster_skill <= MONSTER_SKILL_HARD)
+                       this.colormap = 1038;
+               else if(this.monster_skill <= MONSTER_SKILL_INSANE)
+                       this.colormap = 1028;
+               else if(this.monster_skill <= MONSTER_SKILL_NIGHTMARE)
+                       this.colormap = 1032;
                else
-                       mon.colormap = 1024;
+                       this.colormap = 1024;
        }
 }
 
-void monster_changeteam(entity ent, float newteam)
+void monster_changeteam(entity this, int newteam)
 {
        if(!teamplay) { return; }
 
-       ent.team = newteam;
-       ent.monster_attack = true; // new team, activate attacking
-       monster_setupcolors(ent);
+       this.team = newteam;
+       this.monster_attack = true; // new team, activate attacking
+       monster_setupcolors(this);
 
-       if(ent.sprite)
+       if(this.sprite)
        {
-               WaypointSprite_UpdateTeamRadar(ent.sprite, RADARICON_DANGER, ((newteam) ? Team_ColorRGB(newteam) : '1 0 0'));
+               WaypointSprite_UpdateTeamRadar(this.sprite, RADARICON_DANGER, ((newteam) ? Team_ColorRGB(newteam) : '1 0 0'));
 
-               ent.sprite.team = newteam;
-               ent.sprite.SendFlags |= 1;
+               this.sprite.team = newteam;
+               this.sprite.SendFlags |= 1;
        }
 }
 
@@ -295,10 +293,9 @@ void Monster_Sounds_Clear(entity this)
 
 bool Monster_Sounds_Load(entity this, string f, int first)
 {
-       float fh;
        string s;
        var .string field;
-       fh = fopen(f, FILE_READ);
+       float fh = fopen(f, FILE_READ);
        if(fh < 0)
        {
                LOG_TRACE("Monster sound file not found: ", f);
@@ -330,7 +327,7 @@ void Monster_Sounds_Update(entity this)
                Monster_Sounds_Load(this, get_monster_model_datafilename(this.model, 0, "sounds"), 0);
 }
 
-void Monster_Sound(entity this, .string samplefield, float sound_delay, float delaytoo, float chan)
+void Monster_Sound(entity this, .string samplefield, float sound_delay, bool delaytoo, float chan)
 {
        if(!autocvar_g_monsters_sounds) { return; }
 
@@ -384,7 +381,7 @@ bool Monster_Attack_Leap_Check(entity this, vector vel)
        this.velocity = vel;
        tracetoss(this, this);
        this.velocity = old;
-       if (trace_ent != this.enemy)
+       if(trace_ent != this.enemy)
                return false;
 
        return true;
@@ -397,12 +394,12 @@ bool Monster_Attack_Leap(entity this, vector anm, void(entity this, entity touch
 
        setanim(this, anm, false, true, false);
 
-       if(this.animstate_endtime > time && (this.flags & FL_MONSTER))
+       if(this.animstate_endtime > time && IS_MONSTER(this))
                this.attack_finished_single[0] = this.anim_finished = this.animstate_endtime;
        else
                this.attack_finished_single[0] = this.anim_finished = time + animtime;
 
-       if(this.flags & FL_MONSTER)
+       if(IS_MONSTER(this))
                this.state = MONSTER_ATTACK_RANGED;
        settouch(this, touchfunc);
        this.origin_z += 1;
@@ -414,14 +411,14 @@ bool Monster_Attack_Leap(entity this, vector anm, void(entity this, entity touch
 
 void Monster_Attack_Check(entity this, entity targ)
 {
-       if((this == NULL || targ == NULL)
+       if((!this || !targ)
        || (!this.monster_attackfunc)
        || (time < this.attack_finished_single[0])
        ) { return; }
 
        if(vdist(targ.origin - this.origin, <=, this.attack_range))
        {
-               bool attack_success = this.monster_attackfunc(MONSTER_ATTACK_MELEE, this, targ);
+               int attack_success = this.monster_attackfunc(MONSTER_ATTACK_MELEE, this, targ);
                if(attack_success == 1)
                        Monster_Sound(this, monstersound_melee, 0, false, CH_VOICE);
                else if(attack_success > 0)
@@ -430,7 +427,7 @@ void Monster_Attack_Check(entity this, entity targ)
 
        if(vdist(targ.origin - this.origin, >, this.attack_range))
        {
-               float attack_success = this.monster_attackfunc(MONSTER_ATTACK_RANGED, this, targ);
+               int attack_success = this.monster_attackfunc(MONSTER_ATTACK_RANGED, this, targ);
                if(attack_success == 1)
                        Monster_Sound(this, monstersound_melee, 0, false, CH_VOICE);
                else if(attack_success > 0)
@@ -458,7 +455,7 @@ void Monster_UpdateModel(entity this)
        this.anim_die2   = animfixfps(this, '9 1 0.01', '0 0 0');*/
 
        // then get the real values
-       Monster mon = get_monsterinfo(this.monsterid);
+       Monster mon = Monsters_from(this.monsterid);
        mon.mr_anim(mon, this);
 }
 
@@ -554,7 +551,8 @@ vector Monster_Move_Target(entity this, entity targ)
                targ_origin = WarpZone_RefSys_TransformOrigin(this.enemy, this, targ_origin); // origin of target as seen by the monster (us)
                WarpZone_TraceLine(this.origin, targ_origin, MOVE_NOMONSTERS, this);
 
-               if((this.enemy == NULL)
+               // cases where the enemy may have changed their state (don't need to check everything here)
+               if((!this.enemy)
                        || (IS_DEAD(this.enemy) || this.enemy.health < 1)
                        || (STAT(FROZEN, this.enemy))
                        || (this.enemy.flags & FL_NOTARGET)
@@ -695,8 +693,6 @@ void Monster_Move(entity this, float runspeed, float walkspeed, float stpspeed)
        // update goal entity if lost
        if(this.target2 && this.goalentity.targetname != this.target2) { this.goalentity = find(NULL, targetname, this.target2); }
 
-       entity targ;
-
        if(STAT(FROZEN, this) == 2)
        {
                this.revive_progress = bound(0, this.revive_progress + this.ticrate * this.revive_speed, 1);
@@ -781,7 +777,7 @@ void Monster_Move(entity this, float runspeed, float walkspeed, float stpspeed)
                }
        }
 
-       targ = this.goalentity;
+       entity targ = this.goalentity;
 
        if (MUTATOR_CALLHOOK(MonsterMove, this, runspeed, walkspeed, targ)
                || gameover
@@ -802,8 +798,7 @@ void Monster_Move(entity this, float runspeed, float walkspeed, float stpspeed)
        runspeed = bound(0, M_ARGV(1, float) * MONSTER_SKILLMOD(this), runspeed * 2.5); // limit maxspeed to prevent craziness
        walkspeed = bound(0, M_ARGV(2, float) * MONSTER_SKILLMOD(this), walkspeed * 2.5); // limit maxspeed to prevent craziness
 
-       if(teamplay)
-       if(autocvar_g_monsters_teams)
+       if(teamplay && autocvar_g_monsters_teams)
        if(DIFF_TEAM(this.monster_follow, this))
                this.monster_follow = NULL;
 
@@ -855,13 +850,12 @@ void Monster_Move(entity this, float runspeed, float walkspeed, float stpspeed)
 
        if(vdist(this.origin - this.moveto, >, 100))
        {
-               float do_run = (this.enemy || this.monster_moveto);
+               bool do_run = (this.enemy || this.monster_moveto);
                if(IS_ONGROUND(this) || ((this.flags & FL_FLY) || (this.flags & FL_SWIM)))
                        Monster_CalculateVelocity(this, this.moveto, this.origin, true, ((do_run) ? runspeed : walkspeed));
 
-               if(time > this.pain_finished) // TODO: use anim_finished instead!
+               if(time > this.pain_finished && time > this.anim_finished) // TODO: use anim_finished instead!?
                if(!this.state)
-               if(time > this.anim_finished)
                if(vdist(this.velocity, >, 10))
                        setanim(this, ((do_run) ? this.anim_run : this.anim_walk), true, false, false);
                else
@@ -876,8 +870,7 @@ void Monster_Move(entity this, float runspeed, float walkspeed, float stpspeed)
                        this.target2 = e.target;
 
                movelib_brake_simple(this, stpspeed);
-               if(time > this.anim_finished)
-               if(time > this.pain_finished)
+               if(time > this.anim_finished && time > this.pain_finished)
                if(!this.state)
                if(vdist(this.velocity, <=, 30))
                        setanim(this, this.anim_idle, true, false, false);
@@ -1032,7 +1025,7 @@ void Monster_Dead(entity this, entity attacker, float gibbed)
 
        CSQCModel_UnlinkEntity(this);
 
-       Monster mon = get_monsterinfo(this.monsterid);
+       Monster mon = Monsters_from(this.monsterid);
        mon.mr_death(mon, this);
 
        if(this.candrop && this.weapon)
@@ -1056,14 +1049,11 @@ void Monster_Damage(entity this, entity inflictor, entity attacker, float damage
        if(deathtype == DEATH_FALL.m_id && this.draggedby != NULL)
                return;
 
-       vector v;
-       float take, save;
-
-       v = healtharmor_applydamage(100, this.armorvalue / 100, deathtype, damage);
-       take = v_x;
-       save = v_y;
+       vector v = healtharmor_applydamage(100, this.armorvalue / 100, deathtype, damage);
+       float take = v.x;
+       //float save = v.y;
 
-       Monster mon = get_monsterinfo(this.monsterid);
+       Monster mon = Monsters_from(this.monsterid);
        take = mon.mr_pain(mon, this, take, attacker, deathtype);
 
        if(take)
@@ -1160,8 +1150,7 @@ void Monster_Move_2D(entity this, float mspeed, bool allow_jumpoff)
 
        movelib_move_simple_gravity(this, v_forward, mspeed, 1);
 
-       if(time > this.pain_finished)
-       if(time > this.attack_finished_single[0])
+       if(time > this.pain_finished && time > this.attack_finished_single[0])
        if(vdist(this.velocity, >, 10))
                setanim(this, this.anim_walk, true, false, false);
        else
@@ -1210,14 +1199,13 @@ void Monster_Think(entity this)
        setthink(this, Monster_Think);
        this.nextthink = time + this.ticrate;
 
-       if(this.monster_lifetime)
-       if(time >= this.monster_lifetime)
+       if(this.monster_lifetime && time >= this.monster_lifetime)
        {
                Damage(this, this, this, this.health + this.max_health, DEATH_KILL.m_id, this.origin, this.origin);
                return;
        }
 
-       Monster mon = get_monsterinfo(this.monsterid);
+       Monster mon = Monsters_from(this.monsterid);
        if(mon.mr_think(mon, this))
                Monster_Move(this, this.speed2, this.speed, this.stopspeed);
 
index 5f11777c2352b69d0ed4152ab1668e18dae3005b..a0017f94df23dd9a10fabc590af2f856ca074a42 100644 (file)
@@ -116,22 +116,22 @@ MUTATOR_HOOKFUNCTION(spawn_near_teammate, PlayerSpawn)
                                switch(i)
                                {
                                        case 0:
-                                               tracebox(it.origin, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), it.origin - v_forward * 64 + v_right * 128 + v_up * 64, MOVE_NOMONSTERS, it);
+                                               tracebox(it.origin, STAT(PL_MIN, player), STAT(PL_MAX, player), it.origin - v_forward * 64 + v_right * 128 + v_up * 64, MOVE_NOMONSTERS, it);
                                                break;
                                        case 1:
-                                               tracebox(it.origin, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), it.origin - v_forward * 64 - v_right * 128 + v_up * 64, MOVE_NOMONSTERS, it);
+                                               tracebox(it.origin, STAT(PL_MIN, player), STAT(PL_MAX, player), it.origin - v_forward * 64 - v_right * 128 + v_up * 64, MOVE_NOMONSTERS, it);
                                                break;
                                        case 2:
-                                               tracebox(it.origin, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), it.origin + v_right * 192 + v_up * 64, MOVE_NOMONSTERS, it);
+                                               tracebox(it.origin, STAT(PL_MIN, player), STAT(PL_MAX, player), it.origin + v_right * 192 + v_up * 64, MOVE_NOMONSTERS, it);
                                                break;
                                        case 3:
-                                               tracebox(it.origin, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), it.origin - v_right * 192 + v_up * 64, MOVE_NOMONSTERS, it);
+                                               tracebox(it.origin, STAT(PL_MIN, player), STAT(PL_MAX, player), it.origin - v_right * 192 + v_up * 64, MOVE_NOMONSTERS, it);
                                                break;
                                        case 4:
-                                               tracebox(it.origin, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), it.origin - v_forward * 128 + v_right * 64 + v_up * 64, MOVE_NOMONSTERS, it);
+                                               tracebox(it.origin, STAT(PL_MIN, player), STAT(PL_MAX, player), it.origin - v_forward * 128 + v_right * 64 + v_up * 64, MOVE_NOMONSTERS, it);
                                                break;
                                        case 5:
-                                               tracebox(it.origin, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), it.origin - v_forward * 128 - v_right * 64 + v_up * 64, MOVE_NOMONSTERS, it);
+                                               tracebox(it.origin, STAT(PL_MIN, player), STAT(PL_MAX, player), it.origin - v_forward * 128 - v_right * 64 + v_up * 64, MOVE_NOMONSTERS, it);
                                                break;
                                }
 
@@ -141,17 +141,17 @@ MUTATOR_HOOKFUNCTION(spawn_near_teammate, PlayerSpawn)
 
                                // 400 is about the height of a typical laser jump (in overkill)
                                // not traceline because we need space for the whole player, not just his origin
-                               tracebox(horizontal_trace_endpos, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), horizontal_trace_endpos - '0 0 400', MOVE_NORMAL, it);
+                               tracebox(horizontal_trace_endpos, STAT(PL_MIN, player), STAT(PL_MAX, player), horizontal_trace_endpos - '0 0 400', MOVE_NORMAL, it);
                                vector vectical_trace_endpos = trace_endpos;
                                //te_lightning1(NULL, horizontal_trace_endpos, vectical_trace_endpos);
                                if (trace_startsolid) goto skip; // inside another player
                                if (trace_fraction == 1.0) goto skip; // above void or too high
                                if (trace_dphitq3surfaceflags & Q3SURFACEFLAG_SKY) goto skip;
                                if (pointcontents(vectical_trace_endpos) != CONTENT_EMPTY) goto skip; // no lava or slime (or water which i assume would be annoying anyway)
-                               if (tracebox_hits_trigger_hurt(horizontal_trace_endpos, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), vectical_trace_endpos)) goto skip;
+                               if (tracebox_hits_trigger_hurt(horizontal_trace_endpos, STAT(PL_MIN, player), STAT(PL_MAX, player), vectical_trace_endpos)) goto skip;
 
                                // make sure the spawned player will have floor ahead (or at least a wall - he shouldn't fall as soon as he starts moving)
-                               vector floor_test_start = vectical_trace_endpos + v_up * STAT(PL_MAX, NULL).z + v_forward * STAT(PL_MAX, NULL).x; // top front of player's bbox - highest point we know is not inside solid
+                               vector floor_test_start = vectical_trace_endpos + v_up * STAT(PL_MAX, player).z + v_forward * STAT(PL_MAX, player).x; // top front of player's bbox - highest point we know is not inside solid
                                traceline(floor_test_start, floor_test_start + v_forward * 100 - v_up * 128, MOVE_NOMONSTERS, it);
                                //te_beam(NULL, floor_test_start, trace_endpos);
                                if (trace_fraction == 1.0) goto skip;
index a26441ee6e425118186595bf4fdcc3479a2dfa7a..bcb317b4abe305562183dfd2456c51e994d93acf 100644 (file)
@@ -282,10 +282,10 @@ void drawrotpic(vector org, float rot, string pic, vector sz, vector hotspot, ve
 
     // rotate them, and make them absolute
     rot = -rot; // rotate by the opposite angle, as our coordinate system is reversed
-    v1 = rotate(v1, rot) + org;
-    v2 = rotate(v2, rot) + org;
-    v3 = rotate(v3, rot) + org;
-    v4 = rotate(v4, rot) + org;
+    v1 = Rotate(v1, rot) + org;
+    v2 = Rotate(v2, rot) + org;
+    v3 = Rotate(v3, rot) + org;
+    v4 = Rotate(v4, rot) + org;
 
     // draw them
     R_BeginPolygon(pic, f);
@@ -319,9 +319,9 @@ void drawhealthbar(vector org, float rot, float h, vector sz, vector hotspot, fl
     up = '0 1 0';
 
     rot = -rot; // rotate by the opposite angle, as our coordinate system is reversed
-    o = rotate(o, rot) + org;
-    ri = rotate(ri, rot);
-    up = rotate(up, rot);
+    o = Rotate(o, rot) + org;
+    ri = Rotate(ri, rot);
+    up = Rotate(up, rot);
 
     owidth = width + 2 * border;
     o = o - up * (margin + border + theheight) + ri * (sz.x - owidth) * 0.5;
@@ -348,19 +348,19 @@ vector drawspritearrow(vector o, float ang, vector rgb, float a, float t)
 
     R_BeginPolygon("", DRAWFLAG_NORMAL);
     R_PolygonVertex(o,                                  '0 0 0', '0 0 0', a);
-    R_PolygonVertex(o + rotate(arrowY  - borderX, ang), '0 0 0', '0 0 0', a);
-    R_PolygonVertex(o + rotate(borderY - borderX, ang), '0 0 0', '0 0 0', a);
-    R_PolygonVertex(o + rotate(borderY + borderX, ang), '0 0 0', '0 0 0', a);
-    R_PolygonVertex(o + rotate(arrowY  + borderX, ang), '0 0 0', '0 0 0', a);
+    R_PolygonVertex(o + Rotate(arrowY  - borderX, ang), '0 0 0', '0 0 0', a);
+    R_PolygonVertex(o + Rotate(borderY - borderX, ang), '0 0 0', '0 0 0', a);
+    R_PolygonVertex(o + Rotate(borderY + borderX, ang), '0 0 0', '0 0 0', a);
+    R_PolygonVertex(o + Rotate(arrowY  + borderX, ang), '0 0 0', '0 0 0', a);
     R_EndPolygon();
 
     R_BeginPolygon("", DRAWFLAG_ADDITIVE);
-    R_PolygonVertex(o + rotate(eY * borderDiag, ang), '0 0 0', rgb, a);
-    R_PolygonVertex(o + rotate(arrowY - arrowX, ang), '0 0 0', rgb, a);
-    R_PolygonVertex(o + rotate(arrowY + arrowX, ang), '0 0 0', rgb, a);
+    R_PolygonVertex(o + Rotate(eY * borderDiag, ang), '0 0 0', rgb, a);
+    R_PolygonVertex(o + Rotate(arrowY - arrowX, ang), '0 0 0', rgb, a);
+    R_PolygonVertex(o + Rotate(arrowY + arrowX, ang), '0 0 0', rgb, a);
     R_EndPolygon();
 
-    return o + rotate(eY * (borderDiag+size+margin), ang);
+    return o + Rotate(eY * (borderDiag+size+margin), ang);
 }
 
 // returns location of sprite healthbar
index 26454152270150477da3a12c6edb48c22d6be231..58828c410195d1806ad16639a782a1fd89c67898 100644 (file)
@@ -115,7 +115,7 @@ void PM_ClientMovement_UpdateStatus(entity this)
                // wants to stand, if currently crouching we need to check for a low ceiling first
                if (IS_DUCKED(this))
                {
-                       tracebox(this.origin, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), this.origin, MOVE_NORMAL, this);
+                       tracebox(this.origin, STAT(PL_MIN, this), STAT(PL_MAX, this), this.origin, MOVE_NORMAL, this);
                        if (!trace_startsolid) UNSET_DUCKED(this);
                }
        }
@@ -803,5 +803,10 @@ void CSQC_ClientMovement_PlayerMove_Frame(entity this)
 
 #ifdef SVQC
        this.pm_frametime = frametime;
+#elif defined(CSQC)
+       if((ITEMS_STAT(this) & IT_USING_JETPACK) && !IS_DEAD(this) && !intermission)
+               this.csqcmodel_modelflags |= MF_ROCKET;
+       else
+               this.csqcmodel_modelflags &= ~MF_ROCKET;
 #endif
 }
index b3459a67b9e5dcacfc4a33c0ce03b6a0fd47f1fb..7649954b325e6c40b85eefd3691bb12859840060 100644 (file)
@@ -44,14 +44,14 @@ const int MAX_CL_STATS = 256;
 REGISTER_STAT(WEAPONS, vectori)
 REGISTER_STAT(WEAPONSINMAP, vectori)
 
-REGISTER_STAT(PL_VIEW_OFS, vector, autocvar_sv_player_viewoffset)
-REGISTER_STAT(PL_CROUCH_VIEW_OFS, vector, autocvar_sv_player_crouch_viewoffset)
+REGISTER_STAT(PL_VIEW_OFS, vector)
+REGISTER_STAT(PL_CROUCH_VIEW_OFS, vector)
 
-REGISTER_STAT(PL_MIN, vector, autocvar_sv_player_mins)
-REGISTER_STAT(PL_CROUCH_MIN, vector, autocvar_sv_player_crouch_mins)
+REGISTER_STAT(PL_MIN, vector)
+REGISTER_STAT(PL_CROUCH_MIN, vector)
 
-REGISTER_STAT(PL_MAX, vector, autocvar_sv_player_maxs)
-REGISTER_STAT(PL_CROUCH_MAX, vector, autocvar_sv_player_crouch_maxs)
+REGISTER_STAT(PL_MAX, vector)
+REGISTER_STAT(PL_CROUCH_MAX, vector)
 
 REGISTER_STAT(KH_KEYS, int)
 
index 5faa6dc939aa56728448719678c323d35d082585..9d89679e3be9f88817ea8abd9883774c36eca22a 100644 (file)
@@ -393,7 +393,7 @@ bool have_pickup_item(entity this)
                if(autocvar_g_pickup_items == 0)
                        return false;
                if(g_weaponarena)
-                       if(this.weapons || (this.items & IT_AMMO)) // no item or ammo pickups in weaponarena
+                       if(this.weapons || this.itemdef.instanceOfAmmo) // no item or ammo pickups in weaponarena
                                return false;
        }
        return true;
index edbe9c580a28ec33d50314236a3346f58feed121..5a279561d374c5c6b0d975e3a4105b5e2f322787 100644 (file)
@@ -277,7 +277,7 @@ void trigger_push_findtarget(entity this)
 {
        // first calculate a typical start point for the jump
        vector org = (this.absmin + this.absmax) * 0.5;
-       org_z = this.absmax.z - STAT(PL_MIN, NULL).z;
+       org.z = this.absmax.z - PL_MIN_CONST.z;
 
        if (this.target)
        {
@@ -288,7 +288,7 @@ void trigger_push_findtarget(entity this)
 #ifdef SVQC
                        entity e = spawn();
                        setorigin(e, org);
-                       setsize(e, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL));
+                       setsize(e, PL_MIN_CONST, PL_MAX_CONST);
                        e.velocity = trigger_push_calculatevelocity(org, t, this.height);
                        tracetoss(e, e);
                        if(e.move_movetype == MOVETYPE_NONE)
@@ -321,7 +321,7 @@ void trigger_push_findtarget(entity this)
        {
                entity e = spawn();
                setorigin(e, org);
-               setsize(e, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL));
+               setsize(e, PL_MIN_CONST, PL_MAX_CONST);
                e.velocity = this.movedir;
                tracetoss(e, e);
                waypoint_spawnforteleporter(this, trace_endpos, vlen(trace_endpos - org) / vlen(e.velocity));
index ddad35d025e68e973f0b0520dc09a70a9cd17f94..5a2f05a4832219fdc3ed9c51a3238c79de625f49 100644 (file)
@@ -44,7 +44,7 @@ METHOD(HunterKillerAttack, wr_think, void(entity thiswep, entity actor, .entity
        }
 }
 
-bool hk_is_valid_target(entity this, entity e_target);
+bool hk_is_valid_target(entity this, entity proj, entity targ);
 void turret_hk_missile_think(entity this)
 {
     vector vu, vd, vf, vl, vr, ve;  // Vector (direction)
@@ -53,10 +53,7 @@ void turret_hk_missile_think(entity this)
     float lt_for;   // Length of Trace FORwrad
     float lt_seek;  // Length of Trace SEEK (left, right, up down)
     float pt_seek;  // Pitch of Trace SEEK (How mutch to angele left, right up, down trace towards v_forward)
-    vector pre_pos;
     float myspeed;
-    entity e;
-    float ad,edist;
 
     this.nextthink = time + this.ticrate;
 
@@ -69,19 +66,17 @@ void turret_hk_missile_think(entity this)
     // Pick the closest valid target.
     if (!this.enemy)
     {
-        e = findradius(this.origin, 5000);
-        while (e)
+        // in this case, the lighter check is to validate it first, and check distance if it is valid
+        IL_EACH(g_damagedbycontents, hk_is_valid_target(this.owner, this, it),
         {
-            if (hk_is_valid_target(this, e))
-            {
-                if (!this.enemy)
-                    this.enemy = e;
-                else
-                    if (vlen2(this.origin - e.origin) < vlen2(this.origin - this.enemy.origin))
-                        this.enemy = e;
-            }
-            e = e.chain;
-        }
+            if(vdist(it.origin, >, 5000))
+                continue;
+
+            if(!this.enemy)
+                this.enemy = it;
+            else if(vlen2(this.origin - it.origin) < vlen2(this.origin - this.enemy.origin))
+                this.enemy = it;
+        });
     }
 
     this.angles = vectoangles(this.velocity);
@@ -91,16 +86,15 @@ void turret_hk_missile_think(entity this)
 
     if (this.enemy)
     {
-        edist = vlen(this.origin - this.enemy.origin);
         // Close enougth to do decent damage?
-        if ( edist <= (this.owner.shot_radius * 0.25) )
+        if(vdist(this.origin - this.enemy.origin, <=, (this.owner.shot_radius * 0.25)))
         {
             turret_projectile_explode(this);
             return;
         }
 
         // Get data on enemy position
-        pre_pos = this.enemy.origin +
+        vector pre_pos = this.enemy.origin +
                   this.enemy.velocity *
                   min((vlen(this.enemy.origin - this.origin) / vlen(this.velocity)),0.5);
 
@@ -111,12 +105,11 @@ void turret_hk_missile_think(entity this)
     }
     else
     {
-    edist = 0;
-    ve = '0 0 0';
+        ve = '0 0 0';
         fe = 0;
     }
 
-    if ((fe != 1) || (this.enemy == NULL) || (edist > 1000))
+    if ((fe != 1) || (this.enemy == NULL) || vdist(this.origin - this.enemy.origin, >, 1000))
     {
         myspeed = vlen(this.velocity);
 
@@ -129,7 +122,7 @@ void turret_hk_missile_think(entity this)
         ff = trace_fraction;
 
         // Find angular offset
-        ad = vlen(vectoangles(normalize(this.enemy.origin - this.origin)) - this.angles);
+        float ad = vlen(vectoangles(normalize(this.enemy.origin - this.origin)) - this.angles);
 
         // To close to something, Slow down!
         if ( ((ff < 0.7) || (ad > 4)) && (myspeed > (autocvar_g_turrets_unit_hk_shot_speed)) )
@@ -224,7 +217,7 @@ void turret_hk_missile_think(entity this)
 
 #ifdef TURRET_DEBUG_HK
     //if(this.atime < time) {
-    if ((fe <= 0.99)||(edist > 1000))
+    if ((fe <= 0.99)||vdist(this.origin - this.enemy.origin, >, 1000))
     {
         te_lightning2(NULL,this.origin, this.origin + vr * lt_seek);
         te_lightning2(NULL,this.origin, this.origin + vl * lt_seek);
@@ -246,35 +239,39 @@ void turret_hk_missile_think(entity this)
     UpdateCSQCProjectile(this);
 }
 
-bool hk_is_valid_target(entity this, entity e_target)
+bool hk_is_valid_target(entity this, entity proj, entity targ)
 {
-    if (e_target == NULL)
+    if (!targ)
+        return false;
+
+    // we know for sure pure entities are bad targets
+    if(is_pure(targ))
         return false;
 
     // If only this was used more..
-    if (e_target.flags & FL_NOTARGET)
+    if (targ.flags & FL_NOTARGET)
         return false;
 
     // Cant touch this
-    if ((e_target.takedamage == DAMAGE_NO) || (e_target.health < 0))
+    if ((targ.takedamage == DAMAGE_NO) || (targ.health < 0))
         return false;
 
     // player
-    if (IS_CLIENT(e_target))
+    if (IS_PLAYER(targ))
     {
-        if (this.owner.target_select_playerbias < 0)
+        if (this.target_select_playerbias < 0)
             return false;
 
-        if (IS_DEAD(e_target))
+        if (IS_DEAD(targ))
             return false;
     }
 
     // Missile
-    if ((e_target.flags & FL_PROJECTILE) && (this.owner.target_select_missilebias < 0))
+    if ((targ.flags & FL_PROJECTILE) && (this.target_select_missilebias < 0))
         return false;
 
     // Team check
-    if ((e_target.team == this.owner.team) || (this.owner.team == e_target.owner.team))
+    if ((targ.team == this.team) || (this.team == targ.owner.team))
         return false;
 
     return true;
index b165bb3e481551b5cf5261390832e2a50b55b764..9c8d05ce4e0fef38a8ecd06999c923f290d69804 100644 (file)
@@ -739,7 +739,8 @@ void vehicles_impact(entity this, float _minspeed, float _speedfac, float _maxpa
 // vehicle enter/exit handling
 vector vehicles_findgoodexit(entity this, vector prefer_spot)
 {
-       tracebox(this.origin + '0 0 32', STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), prefer_spot, MOVE_NORMAL, this.owner);
+       // TODO: we actually want the player's size here
+       tracebox(this.origin + '0 0 32', PL_MIN_CONST, PL_MAX_CONST, prefer_spot, MOVE_NORMAL, this.owner);
        if(trace_fraction == 1.0 && !trace_startsolid && !trace_allsolid)
                return prefer_spot;
 
@@ -751,7 +752,7 @@ vector vehicles_findgoodexit(entity this, vector prefer_spot)
                v = randomvec();
                v_z = 0;
                v = v2 + normalize(v) * mysize;
-               tracebox(v2, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), v, MOVE_NORMAL, this.owner);
+               tracebox(v2, PL_MIN_CONST, PL_MAX_CONST, v, MOVE_NORMAL, this.owner);
                if(trace_fraction == 1.0 && !trace_startsolid && !trace_allsolid)
                        return v;
        }
@@ -793,7 +794,7 @@ void vehicles_exit(entity vehic, bool eject)
                        WriteAngle(MSG_ONE, 0);
                }
 
-               setsize(player, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL));
+               setsize(player, STAT(PL_MIN,player), STAT(PL_MAX, player));
 
                player.takedamage               = DAMAGE_AIM;
                player.solid                    = SOLID_SLIDEBOX;
@@ -803,7 +804,7 @@ void vehicles_exit(entity vehic, bool eject)
                player.alpha                    = 1;
                player.PlayerPhysplug   = func_null;
                player.vehicle                  = NULL;
-               player.view_ofs         = STAT(PL_VIEW_OFS, NULL);
+               player.view_ofs         = STAT(PL_VIEW_OFS, player);
                player.event_damage     = PlayerDamage;
                player.hud                              = HUD_NORMAL;
                PS(player).m_switchweapon = vehic.m_switchweapon;
@@ -959,8 +960,8 @@ void vehicles_enter(entity pl, entity veh)
        veh.vehicle_hudmodel.viewmodelforclient = pl;
 
        pl.crouch = false;
-       pl.view_ofs = STAT(PL_VIEW_OFS, NULL);
-       setsize (pl, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL));
+       pl.view_ofs = STAT(PL_VIEW_OFS, pl);
+       setsize (pl, STAT(PL_MIN, pl), STAT(PL_MAX, pl));
 
        veh.event_damage        = vehicles_damage;
        veh.nextthink           = 0;
index 95cc74802ceab386bc8611a277e9c9f3bd4eec04..573e46aa77fa522973d97aca965f0d1388d7b4d4 100644 (file)
@@ -184,11 +184,11 @@ vector bumblebee_gunner_findgoodexit(vector prefer_spot, entity gunner, entity p
        //vector exitspot;
        float mysize;
 
-       tracebox(gunner.origin + '0 0 32', STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), prefer_spot, MOVE_NORMAL, player);
+       tracebox(gunner.origin + '0 0 32', STAT(PL_MIN, player), STAT(PL_MAX, player), prefer_spot, MOVE_NORMAL, player);
        if(trace_fraction == 1.0 && !trace_startsolid && !trace_allsolid)
                return prefer_spot;
 
-       mysize = 1.5 * vlen(STAT(PL_MAX, NULL) - STAT(PL_MIN, NULL)); // can't use gunner's size, as they don't have a size
+       mysize = 1.5 * vlen(STAT(PL_MAX, player) - STAT(PL_MIN, player)); // can't use gunner's size, as they don't have a size
        float i;
        vector v, v2;
        v2 = 0.5 * (gunner.absmin + gunner.absmax);
@@ -197,7 +197,7 @@ vector bumblebee_gunner_findgoodexit(vector prefer_spot, entity gunner, entity p
                v = randomvec();
                v_z = 0;
                v = v2 + normalize(v) * mysize;
-               tracebox(v2, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), v, MOVE_NORMAL, player);
+               tracebox(v2, STAT(PL_MIN, player), STAT(PL_MAX, player), v, MOVE_NORMAL, player);
                if(trace_fraction == 1.0 && !trace_startsolid && !trace_allsolid)
                        return v;
        }
@@ -224,7 +224,7 @@ void bumblebee_gunner_exit(entity this, int _exitflag)
        }
 
        CSQCVehicleSetup(player, HUD_NORMAL);
-       setsize(player, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL));
+       setsize(player, STAT(PL_MIN, player), STAT(PL_MAX, player));
 
        player.takedamage     = DAMAGE_AIM;
        player.solid          = SOLID_SLIDEBOX;
@@ -232,7 +232,7 @@ void bumblebee_gunner_exit(entity this, int _exitflag)
        player.effects       &= ~EF_NODRAW;
        player.alpha          = 1;
        player.PlayerPhysplug = func_null;
-       player.view_ofs       = STAT(PL_VIEW_OFS, NULL);
+       player.view_ofs       = STAT(PL_VIEW_OFS, player);
        player.event_damage   = PlayerDamage;
        player.hud            = HUD_NORMAL;
        player.teleportable       = TELEPORT_NORMAL;
index 3e4654fcbbcc41171454192188a8e1ef9f72f393..b998bc9ee8d41d42c7ee51b976cbe6cc4e63f7d3 100644 (file)
@@ -133,7 +133,8 @@ void W_Porto_Touch(entity this, entity toucher)
        norm = trace_plane_normal;
        if(trace_ent.iscreature)
        {
-               traceline(trace_ent.origin, trace_ent.origin + '0 0 2' * STAT(PL_MIN, NULL).z, MOVE_WORLDONLY, this);
+               // TODO: why not use entity size?
+               traceline(trace_ent.origin, trace_ent.origin + '0 0 2' * PL_MIN_CONST.z, MOVE_WORLDONLY, this);
                if(trace_fraction >= 1)
                        return;
                if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_SLICK || trace_dphitcontents & DPCONTENTS_PLAYERCLIP)
index 9ae0c6069ab7b748b8f63a8c4c147891533ec8cf..d45cf31cb3bf957ac556d8356d152ead0a2bf382 100644 (file)
@@ -283,7 +283,7 @@ METHOD(Shotgun, wr_think, void(entity thiswep, entity actor, .entity weaponentit
 }
 METHOD(Shotgun, wr_setup, void(entity thiswep, entity actor))
 {
-    actor.ammo_field = ammo_none;
+    actor.ammo_field = ammo_shells;
 }
 METHOD(Shotgun, wr_checkammo1, bool(entity thiswep, entity actor))
 {
index e11e4d8d5211aacc6e6d6e483afd0fe0ac45ea88..91042b613b7a425c8fc354a395a2392108a4697e 100644 (file)
@@ -215,24 +215,24 @@ void W_Vaporizer_Attack(Weapon thiswep, entity actor, .entity weaponentity)
        W_DecreaseAmmo(thiswep, actor, ((g_instagib) ? 1 : WEP_CVAR_PRI(vaporizer, ammo)));
 }
 
-void W_RocketMinsta_Laser_Explode (entity this)
+void W_RocketMinsta_Laser_Explode (entity this, entity directhitentity)
 {
-       if(other.takedamage == DAMAGE_AIM)
-               if(IS_PLAYER(other))
-                       if(DIFF_TEAM(this.realowner, other))
-                               if(!IS_DEAD(other))
-                                       if(IsFlying(other))
+       if(directhitentity.takedamage == DAMAGE_AIM)
+               if(IS_PLAYER(directhitentity))
+                       if(DIFF_TEAM(this.realowner, directhitentity))
+                               if(!IS_DEAD(directhitentity))
+                                       if(IsFlying(directhitentity))
                                                Send_Notification(NOTIF_ONE, this.realowner, MSG_ANNCE, ANNCE_ACHIEVEMENT_ELECTROBITCH);
 
        this.event_damage = func_null;
        this.takedamage = DAMAGE_NO;
-       RadiusDamage (this, this.realowner, this.rm_damage, this.rm_edmg, autocvar_g_rm_laser_radius, NULL, NULL, this.rm_force, this.projectiledeathtype, other);
+       RadiusDamage (this, this.realowner, this.rm_damage, this.rm_edmg, autocvar_g_rm_laser_radius, NULL, NULL, this.rm_force, this.projectiledeathtype, directhitentity);
        delete(this);
 }
 
 void W_RocketMinsta_Laser_Explode_use(entity this, entity actor, entity trigger)
 {
-       W_RocketMinsta_Laser_Explode(this);
+       W_RocketMinsta_Laser_Explode(this, trigger); // we probably don't want trigger used here, but this matches closest to old behaviour
 }
 
 void W_RocketMinsta_Laser_Touch(entity this, entity toucher)
index 66613b53229ad6ef53d34a9ad43bc0b0ed413abd..9e26e70fb7424ff07d3fbf79747bffe218c1dd4f 100644 (file)
@@ -109,15 +109,15 @@ void CSQCPlayer_SetMinsMaxs(entity this)
 {
        if (IS_DUCKED(this) || !this.isplayermodel)
        {
-               this.mins = STAT(PL_CROUCH_MIN, NULL);
-               this.maxs = STAT(PL_CROUCH_MAX, NULL);
-               this.view_ofs = STAT(PL_CROUCH_VIEW_OFS, NULL);
+               this.mins = STAT(PL_CROUCH_MIN, this);
+               this.maxs = STAT(PL_CROUCH_MAX, this);
+               this.view_ofs = STAT(PL_CROUCH_VIEW_OFS, this);
        }
        else
        {
-               this.mins = STAT(PL_MIN, NULL);
-               this.maxs = STAT(PL_MAX, NULL);
-               this.view_ofs = STAT(PL_VIEW_OFS, NULL);
+               this.mins = STAT(PL_MIN, this);
+               this.maxs = STAT(PL_MAX, this);
+               this.view_ofs = STAT(PL_VIEW_OFS, this);
        }
 }
 
@@ -226,8 +226,8 @@ void CSQCPlayer_SetCamera()
 {
        const vector v0 = ((intermission && !autocvar_cl_movement_intermissionrunning) ? '0 0 0' : pmove_vel); // TRICK: pmove_vel is set by the engine when we get here. No need to network velocity
        const float vh = STAT(VIEWHEIGHT);
-       const vector pl_viewofs = STAT(PL_VIEW_OFS, NULL);
-       const vector pl_viewofs_crouch = STAT(PL_CROUCH_VIEW_OFS, NULL);
+       const vector pl_viewofs = STAT(PL_VIEW_OFS);
+       const vector pl_viewofs_crouch = STAT(PL_CROUCH_VIEW_OFS);
        const entity e = csqcplayer;
        if (e)
        {
index bb363c12ef26ba5b5dd765200ed08f28dc99519f..0a887cfebb03c4544df88a8d0316bd6f8aa4ab8d 100644 (file)
@@ -101,7 +101,7 @@ noref vector _vec2;
 noref vector _vec3;
 #define vec3(_x, _y, _z) (_vec3.x = (_x), _vec3.y = (_y), _vec3.z = (_z), _vec3)
 
-vector rotate(vector v, float a)
+vector Rotate(vector v, float a)
 {
        float a_sin = sin(a), a_cos = cos(a);
        vector r = '0 0 0';
index 816120b074981c6f897763bd8550cfb5fc916203..a28b0863861891b8c6e9361916b628f4926c65ba 100644 (file)
                PERSON(Zac "Mario" Jardine) \
        NL() \
        TITLE(_("Extended Team")) \
+               PERSON(AllieWay) \
                PERSON(Antonio "terencehill" Piu) \
                PERSON(Archer) \
                PERSON(BuddyFriendGuy) \
                PERSON(Debugger) \
+               PERSON(Diomedes) \
+               PERSON(Freddy) \
                PERSON(GATTS) \
                PERSON(Halogene) \
                PERSON(IDWMaster) \
                PERSON(Jan "zykure" Behrens) \
                PERSON(JH0nny) \
-               PERSON(Luigi) \
+               PERSON(Jubilant) \
                PERSON(Łukasz "kuniu the frogg" Polek) \
+               PERSON(martin-t) \
                PERSON(Matthias "matthiaskrgr" Krüger) \
                PERSON(Mattia "Melanosuchus" Basaglia) \
                PERSON(MrBougo) \
        FUNCTION(_("Level Design")) \
                PERSON(Amadeusz "amade/proraide" Sławiński) \
                PERSON(Ben "MooKow" Banker) \
-               PERSON(Calinou) \
                PERSON(Cortez) \
                PERSON(Cuinn "Cuinnton" Herrick) \
                PERSON(Debugger) \
+               PERSON(Hugo "Calinou" Locurcio) \
                PERSON(Jakob "tZork" Markström Gröhn) \
                PERSON(Konrad "Justin" Slawinski) \
                PERSON(Maddin) \
                        PERSON(Mihail "meequz" Varantsou) \
                NL() \
                FUNCTION(_("Bulgarian")) \
+                       PERSON(Alexander "alex4o" Bonin) \
+                       PERSON(ifohancroft) \
                        PERSON(lokster) \
                        PERSON(set_killer) \
+                       PERSON(ubone) \
                NL() \
                FUNCTION(_("Chinese (China)")) \
-                       PERSON(Antonidas) \
                        PERSON(kalawore) \
                        PERSON(sapphireliu) \
                NL() \
+               FUNCTION(_("Chinese (Taiwan)")) \
+                       PERSON(Alisha) \
+                       PERSON(Armcoon) \
+                       PERSON(Jeff "s8321414" Huang) \
+               NL() \
+               FUNCTION(_("Cornish")) \
+                       PERSON(Nicky "nrowe" Rowe) \
+               NL() \
                FUNCTION(_("Czech")) \
                        PERSON(shogun assassin/woky) \
                        PERSON(Superovoce) \
                NL() \
                FUNCTION(_("Dutch")) \
                        PERSON(Alexander "freefang" van Dam) \
+                       PERSON(Jonathan "Jonakeys" van der Steege) \
                        PERSON(PinkRobot) \
                        PERSON(vegiburger) \
                NL() \
                FUNCTION(_("English (Australia)")) \
                        PERSON(Laurene "sunflowers" Albrand) \
+                       PERSON(Stuart "Cefiar" Young) \
                        PERSON(Zac "Mario" Jardine) \
                NL() \
                FUNCTION(_("Finnish")) \
+                       PERSON(Jonas "PowaTree" Sahlberg) \
                        PERSON(Henry "Exitium" Sanmark) \
                        PERSON(Rasmus "FruitieX" Eskola) \
                NL() \
                FUNCTION(_("French")) \
-                       PERSON(Calinou) \
+                       PERSON(Hugo "Calinou" Locurcio) \
+                       PERSON(Kim "coughingmouse" Lee) \
                        PERSON(Maxime "Taximus" Paradis) \
                        PERSON(RedGuff) \
+                       PERSON(Thomas "illwieckz" Debesse) \
                        PERSON(Yannick "SpiKe" Le Guen) \
                NL() \
                FUNCTION(_("German")) \
                        PERSON(Erik "Ablu" Schilling) \
                        PERSON(Jope "Sless" Withers) \
                        PERSON(Marvin "Mirio" Beck) \
+                       PERSON(Paul "Snapper") \
                        PERSON(Rudolf "divVerent" Polzer) \
+                       PERSON(Wuzzy) \
                        PERSON(Yepoleb) \
                NL() \
                FUNCTION(_("Greek")) \
                        PERSON(stdi) \
                        PERSON(XCostaX) \
                NL() \
+               FUNCTION(_("Kazakh")) \
+                       PERSON("Артем \"bystrov.arterm\" Быстров") \
+               NL() \
+               FUNCTION(_("Korean")) \
+                       PERSON(Jisoo "s6e9x" Lim) \
+                       PERSON(Kim "coughingmouse" Lee) \
+               NL() \
                FUNCTION(_("Polish")) \
                        PERSON(4m) \
                        PERSON(Alex "tiprogrammierer.alex" Progger) \
                        PERSON(Amadeusz "amade/proraide" Sławiński) \
+                       PERSON(Artur "artur9010" Motyka) \
+                       PERSON(Jakub "KubeQ11" Pędziszewski) \
                NL() \
                FUNCTION(_("Portuguese")) \
+                       PERSON(Ivan Paulos "greylica" Tomé) \
+                       PERSON(Jean Trindade "Muleke_Trairao" Pereira) \
                        PERSON(Ricardo Manuel "Hellgardia" da Cruz Coelho da Silva) \
                        PERSON(xXxCHAOTICxXx) \
                NL() \
                        PERSON(Adrian-Ciprian "adrian.tinjala" Tînjală) \
                        PERSON(BusterDBK) \
                        PERSON(Mircea "Taoki" Kitsune) \
+                       PERSON(Sorin "unic_sorin" Botirla) \
                        PERSON(Tudor "TropiKo" Ionel) \
                NL() \
                FUNCTION(_("Russian")) \
                        PERSON(Alex "alextalker7" Talker) \
                        PERSON(Alexandr "zrg") \
                        PERSON(Andrei "adem4ik" Stepanov) \
+                       PERSON(Andrey "dekrY" P.) \
                        PERSON(gravicappa) \
                        PERSON(Hot Dog) \
                        PERSON(Lord Canistra) \
                        PERSON(marcus256) \
                NL() \
                FUNCTION(_("Ukrainian")) \
+                       PERSON(Dmitro "Gamebot" Sokhin) \
                        PERSON(Oleh "BlaXpirit" Prypin) \
                        PERSON(Vasyl "Harmata" Melnyk) \
                        PERSON(Yuriy "herrniemand" Ackermann) \
index 3359f13b120f2e40178127ddef25c685ea2e5bea..95bf71531023a4864807c373a8d76fe84eb46013 100644 (file)
@@ -3,6 +3,7 @@
 
 #include "bot/_mod.inc"
 #include "command/_mod.inc"
+#include "compat/_mod.inc"
 #include "mutators/_mod.inc"
 #include "pathlib/_mod.inc"
 #include "weapons/_mod.inc"
index 4ecc610c7d9184f8cf93a510f468297c080ed223..eb74529a64daf066777af19f3f5b27faae7b38e8 100644 (file)
@@ -30,6 +30,3 @@
 #endif
 #include <server/teamplay.qc>
 #include <server/tests.qc>
-#include <server/t_halflife.qc>
-#include <server/t_quake.qc>
-#include <server/t_quake3.qc>
index 8162606c7834c5c1103648ec2b7cb22977cf2c26..a0d160d57c31194100a4951913721c7449da2da3 100644 (file)
@@ -30,6 +30,3 @@
 #endif
 #include <server/teamplay.qh>
 #include <server/tests.qh>
-#include <server/t_halflife.qh>
-#include <server/t_quake.qh>
-#include <server/t_quake3.qh>
index af6aa3f2a9fba065fb3587c7c544762af9b6aeee..d211397d3bb057d108e97852fe212ce6d9d7f6d3 100644 (file)
@@ -474,7 +474,7 @@ void havocbot_movetogoal(entity this)
 
                // Flying
                PHYS_INPUT_BUTTON_HOOK(this) = true;
-               if(this.navigation_jetpack_point.z - STAT(PL_MAX, NULL).z + STAT(PL_MIN, NULL).z < this.origin.z)
+               if(this.navigation_jetpack_point.z - STAT(PL_MAX, this).z + STAT(PL_MIN, this).z < this.origin.z)
                {
                        this.movement_x = dir * v_forward * maxspeed;
                        this.movement_y = dir * v_right * maxspeed;
index 83077e1d400707a97c757599082b426bc656937c..4c8982e9457a22d9614a6d4aed2d2bec00ab46fa 100644 (file)
@@ -360,12 +360,12 @@ float navigation_waypoint_will_link(vector v, vector org, entity ent, float walk
                {
                        if (walkfromwp)
                        {
-                               if (tracewalk(ent, v, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), org, bot_navigation_movemode))
+                               if (tracewalk(ent, v, PL_MIN_CONST, PL_MAX_CONST, org, bot_navigation_movemode))
                                        return true;
                        }
                        else
                        {
-                               if (tracewalk(ent, org, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), v, bot_navigation_movemode))
+                               if (tracewalk(ent, org, PL_MIN_CONST, PL_MAX_CONST, v, bot_navigation_movemode))
                                        return true;
                        }
                }
@@ -387,7 +387,7 @@ entity navigation_findnearestwaypoint_withdist_except(entity ent, float walkfrom
        });
 
        vector org = ent.origin + 0.5 * (ent.mins + ent.maxs);
-       org.z = ent.origin.z + ent.mins.z - STAT(PL_MIN, NULL).z; // player height
+       org.z = ent.origin.z + ent.mins.z - PL_MIN_CONST.z; // player height
        // TODO possibly make other code have the same support for bboxes
        if(ent.tag_entity)
                org = org + ent.tag_entity.origin;
@@ -684,7 +684,7 @@ void navigation_routerating(entity this, entity e, float f, float rangebias)
                        float zdistance, xydistance, cost, t, fuel;
                        vector down, npa, npb;
 
-                       down = '0 0 -1' * (STAT(PL_MAX, NULL).z - STAT(PL_MIN, NULL).z) * 10;
+                       down = '0 0 -1' * (STAT(PL_MAX, this).z - STAT(PL_MIN, this).z) * 10;
 
                        do{
                                npa = pointa + down;
@@ -842,7 +842,7 @@ bool navigation_routetogoal(entity this, entity e, vector startposition)
                return true;
 
        // if it can reach the goal there is nothing more to do
-       if (tracewalk(this, startposition, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), (e.absmin + e.absmax) * 0.5, bot_navigation_movemode))
+       if (tracewalk(this, startposition, STAT(PL_MIN, this), STAT(PL_MAX, this), (e.absmin + e.absmax) * 0.5, bot_navigation_movemode))
                return true;
 
        // see if there are waypoints describing a path to the item
@@ -1051,7 +1051,7 @@ void navigation_unstuck(entity this)
                // evaluate the next goal on the queue
                float d = vlen2(this.origin - bot_waypoint_queue_goal.origin);
                LOG_DEBUG(this.netname, " evaluating ", bot_waypoint_queue_goal.classname, " with distance ", ftos(d));
-               if(tracewalk(bot_waypoint_queue_goal, this.origin, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), bot_waypoint_queue_goal.origin, bot_navigation_movemode))
+               if(tracewalk(bot_waypoint_queue_goal, this.origin, STAT(PL_MIN, this), STAT(PL_MAX, this), bot_waypoint_queue_goal.origin, bot_navigation_movemode))
                {
                        if( d > bot_waypoint_queue_bestgoalrating)
                        {
index 0f8999a8d17f7cbb5c58017a28096c31b4178b9a..1e03bf5e1bd651e086ee22fdeef485bf76621ae6 100644 (file)
@@ -61,7 +61,7 @@ entity waypoint_spawn(vector m1, vector m2, float f)
 
        if(!w.wpisbox)
        {
-               setsize(w, STAT(PL_MIN, NULL) - '1 1 0', STAT(PL_MAX, NULL) + '1 1 0');
+               setsize(w, PL_MIN_CONST - '1 1 0', PL_MAX_CONST + '1 1 0');
                if(!move_out_of_solid(w))
                {
                        if(!(f & WAYPOINTFLAG_GENERATED))
@@ -216,7 +216,7 @@ void waypoint_think(entity this)
                        navigation_testtracewalk = 0;
                        if (!this.wpisbox)
                        {
-                               tracebox(sv - STAT(PL_MIN, NULL).z * '0 0 1', STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), sv, false, this);
+                               tracebox(sv - PL_MIN_CONST.z * '0 0 1', PL_MIN_CONST, PL_MAX_CONST, sv, false, this);
                                if (!trace_startsolid)
                                {
                                        //dprint("sv deviation", vtos(trace_endpos - sv), "\n");
@@ -225,7 +225,7 @@ void waypoint_think(entity this)
                        }
                        if (!it.wpisbox)
                        {
-                               tracebox(ev - STAT(PL_MIN, NULL).z * '0 0 1', STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), ev, false, it);
+                               tracebox(ev - PL_MIN_CONST.z * '0 0 1', PL_MIN_CONST, PL_MAX_CONST, ev, false, it);
                                if (!trace_startsolid)
                                {
                                        //dprint("ev deviation", vtos(trace_endpos - ev), "\n");
@@ -234,11 +234,11 @@ void waypoint_think(entity this)
                        }
                        //traceline(this.origin, it.origin, false, NULL);
                        //if (trace_fraction == 1)
-                       if (!this.wpisbox && tracewalk(this, sv, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), ev, MOVE_NOMONSTERS))
+                       if (!this.wpisbox && tracewalk(this, sv, PL_MIN_CONST, PL_MAX_CONST, ev, MOVE_NOMONSTERS))
                                waypoint_addlink(this, it);
                        else
                                relink_walkculled += 0.5;
-                       if (!it.wpisbox && tracewalk(it, ev, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), sv, MOVE_NOMONSTERS))
+                       if (!it.wpisbox && tracewalk(it, ev, PL_MIN_CONST, PL_MAX_CONST, sv, MOVE_NOMONSTERS))
                                waypoint_addlink(it, this);
                        else
                                relink_walkculled += 0.5;
@@ -685,7 +685,7 @@ float waypoint_loadall()
 
 vector waypoint_fixorigin(vector position)
 {
-       tracebox(position + '0 0 1' * (1 - STAT(PL_MIN, NULL).z), STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), position + '0 0 -512', MOVE_NOMONSTERS, NULL);
+       tracebox(position + '0 0 1' * (1 - PL_MIN_CONST.z), PL_MIN_CONST, PL_MAX_CONST, position + '0 0 -512', MOVE_NOMONSTERS, NULL);
        if(trace_fraction < 1)
                position = trace_endpos;
        //traceline(position, position + '0 0 -512', MOVE_NOMONSTERS, NULL);
@@ -833,7 +833,7 @@ void botframe_showwaypointlinks()
 
 float botframe_autowaypoints_fixdown(vector v)
 {
-       tracebox(v, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), v + '0 0 -64', MOVE_NOMONSTERS, NULL);
+       tracebox(v, PL_MIN_CONST, PL_MAX_CONST, v + '0 0 -64', MOVE_NOMONSTERS, NULL);
        if(trace_fraction >= 1)
                return 0;
        return 1;
index cf8a4569b30549598c800adf29d8a720d2cdb6e0..3d569222cd25d29238562501d6ae78a9633d7058 100644 (file)
@@ -444,7 +444,7 @@ float CheatCommand(entity this, int argc)
                        e.nextthink = time;
                        e.solid = 0; // nothing special
                        setmodel(e, MDL_MARKER);
-                       setsize(e, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL));
+                       setsize(e, STAT(PL_MIN, this), STAT(PL_MAX, this));
                        e.skin = 2;
                        if(argc == 3)
                                e.cnt = stof(argv(1));
index 9583118ceacae67335fc8ff8612e17d3b4bd97e5..d4a3e9febfa359aef00e37995c6b56961d0a8a25 100644 (file)
@@ -236,7 +236,7 @@ void PutObserverInServer(entity this)
         this.angles_z = 0;
         this.fixangle = true;
         // offset it so that the spectator spawns higher off the ground, looks better this way
-        setorigin(this, spot.origin + STAT(PL_VIEW_OFS, NULL));
+        setorigin(this, spot.origin + STAT(PL_VIEW_OFS, this));
         this.prevorigin = this.origin;
         if (IS_REAL_CLIENT(this))
         {
@@ -253,7 +253,7 @@ void PutObserverInServer(entity this)
                FixPlayermodel(this);
         }
         setmodel(this, MDL_Null);
-        setsize(this, STAT(PL_CROUCH_MIN, NULL), STAT(PL_CROUCH_MAX, NULL));
+        setsize(this, STAT(PL_CROUCH_MIN, this), STAT(PL_CROUCH_MAX, this));
         this.view_ofs = '0 0 0';
     }
 
index 5017e81aba03014d4d325c3ddbb56fe0b9e36e2e..d01448aad81ca4d022f415c42d12759eebff606a 100644 (file)
@@ -242,16 +242,22 @@ string getmaplist()
        return sprintf("^7Maps in list: %s\n", maplist);
 }
 
-
+const int LSMAPS_MAX = 250;
 string getlsmaps()
 {
        string lsmaps = "", col;
-       float i, newmaps = 0;
+       bool newmaps = false;
+       int added = 0;
 
-       for (i = 0; i < MapInfo_count; ++i)
+       for (int i = 0; i < MapInfo_count; ++i)
        {
                if ((MapInfo_Get_ByID(i)) && !(MapInfo_Map_flags & MapInfo_ForbiddenFlags()))
                {
+                       ++added;
+
+                       if(added > LSMAPS_MAX)
+                               continue; // we still get the added count, but skip the actual processing
+
                        // todo: Check by play count of maps for other game types?
                        if (
                            (g_race && !stof(db_get(ServerProgsDB, strcat(MapInfo_Map_bspname, RACE_RECORD, "time"))))
@@ -271,19 +277,22 @@ string getlsmaps()
                }
        }
 
+       if(added > LSMAPS_MAX)
+               lsmaps = sprintf("%s^7(%d not listed)", lsmaps, added - LSMAPS_MAX);
+
        MapInfo_ClearTemps();
-       return sprintf("^7Maps available (%d)%s: %s\n", tokenize_console(lsmaps), (newmaps ? " (New maps have asterisks marked in blue)" : ""), lsmaps);
+       return sprintf("^7Maps available (%d)%s: %s\n", added, (newmaps ? " (New maps have asterisks marked in blue)" : ""), lsmaps);
 }
 
 string getmonsterlist()
 {
-       string monsterlist = "", col;
+       string monsterlist = "";
 
-       for (int i = MON_FIRST; i <= MON_LAST; ++i)
+       FOREACH(Monsters, it != MON_Null,
        {
-               if (i % 2) col = "^2"; else col = "^3";
-               monsterlist = sprintf("%s%s%s ", monsterlist, col, (get_monsterinfo(i)).netname);
-       }
+               string col = ((i % 2) ? "^2" : "^3");
+               monsterlist = sprintf("%s%s%s ", monsterlist, col, it.netname);
+       });
 
        return sprintf("^7Monsters available: %s\n", monsterlist);
 }
index 76e913500db7b53fafe4df3ee69c8f6d35e4c06b..55879fd35b1f51eb55a28838fd522aeee6376b59 100644 (file)
@@ -1528,15 +1528,15 @@ void GameCommand_trace(float request, float argc)
                                                start = stov(vtos(start));
                                                end = stov(vtos(end));
 
-                                               tracebox(start, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), end, MOVE_NOMONSTERS, NULL);
+                                               tracebox(start, PL_MIN_CONST, PL_MAX_CONST, end, MOVE_NOMONSTERS, NULL);
                                                if (!trace_startsolid && trace_fraction < 1)
                                                {
                                                        p = trace_endpos;
-                                                       tracebox(p, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), p, MOVE_NOMONSTERS, NULL);
+                                                       tracebox(p, PL_MIN_CONST, PL_MAX_CONST, p, MOVE_NOMONSTERS, NULL);
                                                        if (trace_startsolid)
                                                        {
                                                                rint(42);  // do an engine breakpoint on VM_rint so you can get the trace that errnoeously returns startsolid
-                                                               tracebox(start, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), end, MOVE_NOMONSTERS, NULL);
+                                                               tracebox(start, PL_MIN_CONST, PL_MAX_CONST, end, MOVE_NOMONSTERS, NULL);
 
                                                                // how much do we need to back off?
                                                                safe = 1;
@@ -1544,7 +1544,7 @@ void GameCommand_trace(float request, float argc)
                                                                for ( ; ; )
                                                                {
                                                                        pos = p * (1 - (safe + unsafe) * 0.5) + start * ((safe + unsafe) * 0.5);
-                                                                       tracebox(pos, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), pos, MOVE_NOMONSTERS, NULL);
+                                                                       tracebox(pos, PL_MIN_CONST, PL_MAX_CONST, pos, MOVE_NOMONSTERS, NULL);
                                                                        if (trace_startsolid)
                                                                        {
                                                                                if ((safe + unsafe) * 0.5 == unsafe) break;
@@ -1560,7 +1560,7 @@ void GameCommand_trace(float request, float argc)
                                                                LOG_INFO("safe distance to back off: ", ftos(safe * vlen(p - start)), "qu\n");
                                                                LOG_INFO("unsafe distance to back off: ", ftos(unsafe * vlen(p - start)), "qu\n");
 
-                                                               tracebox(p, STAT(PL_MIN, NULL) + '0.1 0.1 0.1', STAT(PL_MAX, NULL) - '0.1 0.1 0.1', p, MOVE_NOMONSTERS, NULL);
+                                                               tracebox(p, PL_MIN_CONST + '0.1 0.1 0.1', PL_MAX_CONST - '0.1 0.1 0.1', p, MOVE_NOMONSTERS, NULL);
                                                                if (trace_startsolid) LOG_INFO("trace_endpos much in solid when tracing from ", vtos(start), " to ", vtos(end), " endpos ", vtos(p), "\n");
                                                                else LOG_INFO("trace_endpos just in solid when tracing from ", vtos(start), " to ", vtos(end), " endpos ", vtos(p), "\n");
                                                                if (++hitcount >= 10) break;
@@ -1574,7 +1574,7 @@ void GameCommand_trace(float request, float argc)
                                                                {
                                                                        q = p + normalize(end - p) * (dq + dqf);
                                                                        if (q == q0) break;
-                                                                       tracebox(p, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), q, MOVE_NOMONSTERS, NULL);
+                                                                       tracebox(p, PL_MIN_CONST, PL_MAX_CONST, q, MOVE_NOMONSTERS, NULL);
                                                                        if (trace_startsolid) error("THIS ONE cannot happen");
                                                                        if (trace_fraction > 0) dq += dqf * trace_fraction;
                                                                        dqf *= 0.5;
diff --git a/qcsrc/server/compat/_mod.inc b/qcsrc/server/compat/_mod.inc
new file mode 100644 (file)
index 0000000..69d031e
--- /dev/null
@@ -0,0 +1,5 @@
+// generated file; do not modify
+#include <server/compat/halflife.qc>
+#include <server/compat/quake.qc>
+#include <server/compat/quake3.qc>
+#include <server/compat/wop.qc>
diff --git a/qcsrc/server/compat/_mod.qh b/qcsrc/server/compat/_mod.qh
new file mode 100644 (file)
index 0000000..bd65858
--- /dev/null
@@ -0,0 +1,5 @@
+// generated file; do not modify
+#include <server/compat/halflife.qh>
+#include <server/compat/quake.qh>
+#include <server/compat/quake3.qh>
+#include <server/compat/wop.qh>
diff --git a/qcsrc/server/compat/halflife.qc b/qcsrc/server/compat/halflife.qc
new file mode 100644 (file)
index 0000000..74e5013
--- /dev/null
@@ -0,0 +1,35 @@
+#include "halflife.qh"
+.float  roomtype;
+.float  radius;
+.float  pitch;
+.float  renderamt;
+.float  rendermode;
+.vector rendercolor;
+
+spawnfunc(weapon_crossbow) {}
+spawnfunc(weapon_handgrenade) {}
+spawnfunc(ammo_crossbow) {}
+spawnfunc(ammo_9mmclip) {}
+spawnfunc(ammo_gaussclip) {}
+spawnfunc(weapon_rpg) {}
+spawnfunc(weapon_357) {}
+void ammo_ARgrenades() {}
+spawnfunc(item_battery) {}
+spawnfunc(ammo_rpgclip) {}
+void weapon_9mmAR() {}
+spawnfunc(weapon_tripmine) {}
+spawnfunc(weapon_snark) {}
+spawnfunc(ammo_buckshot) {}
+void ammo_9mmAR() {}
+spawnfunc(ammo_357) {}
+spawnfunc(weapon_gauss) {}
+spawnfunc(weapon_hornetgun) {}
+//spawnfunc(weapon_shotgun) {}
+spawnfunc(item_healthkit) {}
+spawnfunc(item_longjump) {}
+spawnfunc(item_antidote) {}
+spawnfunc(func_recharge) {}
+spawnfunc(info_node) {}
+spawnfunc(env_sound) {}
+spawnfunc(light_spot) {}
+spawnfunc(func_healthcharger) {}
diff --git a/qcsrc/server/compat/halflife.qh b/qcsrc/server/compat/halflife.qh
new file mode 100644 (file)
index 0000000..6f70f09
--- /dev/null
@@ -0,0 +1 @@
+#pragma once
diff --git a/qcsrc/server/compat/quake.qc b/qcsrc/server/compat/quake.qc
new file mode 100644 (file)
index 0000000..539042d
--- /dev/null
@@ -0,0 +1,30 @@
+#include "quake.qh"
+
+#include <common/weapons/_all.qh>
+
+spawnfunc(weapon_electro);
+spawnfunc(weapon_hagar);
+spawnfunc(weapon_machinegun);
+spawnfunc(item_bullets);
+spawnfunc(item_armor_mega);
+spawnfunc(item_health_mega);
+spawnfunc(item_health_medium);
+
+//***********************
+//QUAKE 1 ENTITIES - So people can play quake1 maps with the xonotic weapons
+//***********************
+spawnfunc(weapon_nailgun) {spawnfunc_weapon_electro(this);}
+spawnfunc(weapon_supernailgun) {spawnfunc_weapon_hagar(this);}
+spawnfunc(weapon_supershotgun) {spawnfunc_weapon_machinegun(this);}
+
+spawnfunc(item_spikes) {spawnfunc_item_bullets(this);}
+//spawnfunc(item_armor1) {spawnfunc_item_armor_medium(this);}  // FIXME: in Quake this is green armor, in Xonotic maps it is an armor shard
+spawnfunc(item_armor2) {spawnfunc_item_armor_mega(this);}
+spawnfunc(item_armorInv) {spawnfunc_item_armor_mega(this);} // TODO: make sure we actually want this
+spawnfunc(item_health) {if (this.spawnflags & 2) spawnfunc_item_health_mega(this);else spawnfunc_item_health_medium(this);}
+
+//spawnfunc_item_spikes
+//spawnfunc_item_health
+
+
+
diff --git a/qcsrc/server/compat/quake.qh b/qcsrc/server/compat/quake.qh
new file mode 100644 (file)
index 0000000..6f70f09
--- /dev/null
@@ -0,0 +1 @@
+#pragma once
diff --git a/qcsrc/server/compat/quake3.qc b/qcsrc/server/compat/quake3.qc
new file mode 100644 (file)
index 0000000..1c53de3
--- /dev/null
@@ -0,0 +1,208 @@
+#include "quake3.qh"
+
+#include <common/weapons/_all.qh>
+
+spawnfunc(weapon_crylink);
+spawnfunc(weapon_electro);
+spawnfunc(weapon_hagar);
+spawnfunc(weapon_machinegun);
+spawnfunc(weapon_vortex);
+
+spawnfunc(target_items);
+
+spawnfunc(item_bullets);
+spawnfunc(item_cells);
+spawnfunc(item_rockets);
+spawnfunc(item_shells);
+
+spawnfunc(item_jetpack);
+
+spawnfunc(item_armor_big);
+spawnfunc(item_armor_mega);
+spawnfunc(item_armor_small);
+
+spawnfunc(item_health_medium);
+spawnfunc(item_health_mega);
+
+//***********************
+//QUAKE 3 ENTITIES - So people can play quake3 maps with the xonotic weapons
+//***********************
+
+// NOTE: for best experience, you need to swap MGs with SGs in the map or it won't have a MG
+
+// SG -> SG
+spawnfunc(ammo_shells)         { spawnfunc_item_shells(this);         }
+
+// MG -> MG
+spawnfunc(ammo_bullets)        { spawnfunc_item_bullets(this);        }
+
+// GL -> Mortar
+spawnfunc(ammo_grenades)       { spawnfunc_item_rockets(this);        }
+
+// LG -> Lightning
+spawnfunc(weapon_lightning)    { spawnfunc_weapon_electro(this);      }
+spawnfunc(ammo_lightning)      { spawnfunc_item_cells(this);          }
+
+// Plasma -> Hagar
+spawnfunc(weapon_plasmagun)    { spawnfunc_weapon_hagar(this);        }
+spawnfunc(ammo_cells)          { spawnfunc_item_rockets(this);        }
+
+// Rail -> Vortex
+spawnfunc(weapon_railgun)      { spawnfunc_weapon_vortex(this);          }
+spawnfunc(ammo_slugs)          { spawnfunc_item_cells(this);          }
+
+// BFG -> Crylink
+spawnfunc(weapon_bfg)          { spawnfunc_weapon_crylink(this);      }
+spawnfunc(ammo_bfg)            { spawnfunc_item_cells(this);          }
+
+// RL -> RL
+spawnfunc(ammo_rockets)        { spawnfunc_item_rockets(this);        }
+
+// Armor
+spawnfunc(item_armor_body)     { spawnfunc_item_armor_mega(this);    }
+spawnfunc(item_armor_combat)   { spawnfunc_item_armor_big(this);      }
+spawnfunc(item_armor_shard)    { spawnfunc_item_armor_small(this);    }
+spawnfunc(item_enviro)         { spawnfunc_item_invincible(this);     }
+
+.float wait;
+.float delay;
+
+// weapon remove ent from df
+void target_init_verify(entity this)
+{
+       entity trigger, targ;
+       for(trigger = NULL; (trigger = find(trigger, classname, "trigger_multiple")); )
+               for(targ = NULL; (targ = find(targ, targetname, trigger.target)); )
+                       if (targ.classname == "target_init" || targ.classname == "target_give" || targ.classname == "target_items")
+                       {
+                               trigger.wait = 0;
+                               trigger.delay = 0;
+                               targ.wait = 0;
+                               targ.delay = 0;
+
+                               //setsize(targ, trigger.mins, trigger.maxs);
+                               //setorigin(targ, trigger.origin);
+                               //remove(trigger);
+                       }
+}
+
+spawnfunc(target_init)
+{
+       this.spawnflags = 0; // remove all weapons except the ones listed below
+       this.netname = "shotgun"; // keep these weapons through the remove trigger
+       spawnfunc_target_items(this);
+       InitializeEntity(this, target_init_verify, INITPRIO_FINDTARGET);
+}
+
+// weapon give ent from defrag
+void target_give_init(entity this)
+{
+       IL_EACH(g_items, it.targetname == this.target,
+       {
+               if (it.classname == "weapon_rocketlauncher" || it.classname == "weapon_devastator") {
+                       this.ammo_rockets += it.count * WEP_CVAR(devastator, ammo);
+                       this.netname = "devastator";
+               }
+               else if (it.classname == "weapon_plasmagun") {
+                       this.ammo_rockets += it.count * WEP_CVAR_PRI(hagar, ammo); // WEAPONTODO
+                       if(this.netname == "")
+                               this.netname = "hagar";
+                       else
+                               this.netname = strcat(this.netname, " hagar");
+               }
+               else if (it.classname == "weapon_bfg") {
+                       this.ammo_cells += it.count * WEP_CVAR_PRI(crylink, ammo);
+                       if(this.netname == "")
+                               this.netname = "crylink";
+                       else
+                               this.netname = strcat(this.netname, " crylink");
+               }
+               else if (it.classname == "weapon_grenadelauncher" || it.classname == "weapon_mortar") {
+                       this.ammo_rockets += it.count * WEP_CVAR_PRI(mortar, ammo); // WEAPONTODO
+                       if(this.netname == "")
+                               this.netname = "mortar";
+                       else
+                               this.netname = strcat(this.netname, " mortar");
+               }
+               else if (it.classname == "item_armor_body")
+                       this.armorvalue = 100;
+               else if (it.classname == "item_health_mega")
+                       this.health = 200;
+               //remove(it); // removing ents in init functions causes havoc, workaround:
+        setthink(it, SUB_Remove);
+        it.nextthink = time;
+       });
+       this.spawnflags = 2;
+       spawnfunc_target_items(this);
+       InitializeEntity(this, target_init_verify, INITPRIO_FINDTARGET);
+}
+
+spawnfunc(target_give)
+{
+       InitializeEntity(this, target_give_init, INITPRIO_FINDTARGET);
+}
+
+//spawnfunc(item_flight)       /* handled by jetpack */
+//spawnfunc(item_haste)        /* handled by buffs mutator */
+//spawnfunc(item_health)       /* handled in t_quake.qc */
+//spawnfunc(item_health_large) /* handled in t_items.qc */
+//spawnfunc(item_health_small) /* handled in t_items.qc */
+//spawnfunc(item_health_mega)  /* handled in t_items.qc */
+//spawnfunc(item_invis)        /* handled by buffs mutator */
+//spawnfunc(item_regen)        /* handled by buffs mutator */
+
+// CTF spawnfuncs handled in mutators/gamemode_ctf.qc now
+
+spawnfunc(item_flight)
+{
+       spawnfunc_item_jetpack(this);
+}
+
+.float notteam;
+.float notsingle;
+.float notfree;
+.float notq3a;
+.float notta;
+.string gametype;
+bool DoesQ3ARemoveThisEntity(entity this)
+{
+       // Q3 style filters (DO NOT USE, THIS IS COMPAT ONLY)
+
+       if(this.notq3a)
+               if(!teamplay || g_tdm || g_ctf)
+                       return true;
+
+       if(this.notta)
+               if (!(!teamplay || g_tdm || g_ctf))
+                       return true;
+
+       if(this.notsingle)
+               if(maxclients == 1)
+                       return true;
+
+       if(this.notteam)
+               if(teamplay)
+                       return true;
+
+       if(this.notfree)
+               if(!teamplay)
+                       return true;
+
+       if(this.gametype)
+       {
+               string gametypename;
+               // static char *gametypeNames[] = {"ffa", "tournament", "single", "team", "ctf", "oneflag", "obelisk", "harvester", "teamtournament"}
+               gametypename = "ffa";
+               if(teamplay)
+                       gametypename = "team";
+               if(g_ctf)
+                       gametypename = "ctf";
+               if(maxclients == 1)
+                       gametypename = "single";
+               // we do not have the other types (oneflag, obelisk, harvester, teamtournament)
+               if(strstrofs(this.gametype, gametypename, 0) < 0)
+                       return true;
+       }
+
+       return false;
+}
diff --git a/qcsrc/server/compat/quake3.qh b/qcsrc/server/compat/quake3.qh
new file mode 100644 (file)
index 0000000..6f70f09
--- /dev/null
@@ -0,0 +1 @@
+#pragma once
diff --git a/qcsrc/server/compat/wop.qc b/qcsrc/server/compat/wop.qc
new file mode 100644 (file)
index 0000000..6d53e18
--- /dev/null
@@ -0,0 +1,62 @@
+#include "wop.qh"
+
+#include <common/weapons/_all.qh>
+// #include <server/mutators/gamemode.qh>
+
+spawnfunc(weapon_arc);
+spawnfunc(weapon_crylink);
+spawnfunc(weapon_electro);
+spawnfunc(weapon_mortar);
+spawnfunc(weapon_hagar);
+spawnfunc(weapon_machinegun);
+spawnfunc(weapon_devastator);
+spawnfunc(weapon_shotgun);
+spawnfunc(weapon_vortex);
+
+spawnfunc(item_armor_big);
+spawnfunc(item_armor_mega);
+spawnfunc(item_armor_small);
+
+spawnfunc(item_bullets);
+spawnfunc(item_cells);
+spawnfunc(item_quad);
+spawnfunc(item_rockets);
+spawnfunc(item_shells);
+
+spawnfunc(item_jetpack);
+
+spawnfunc(item_haste);
+spawnfunc(item_health_medium);
+spawnfunc(item_health_mega);
+spawnfunc(item_invis);
+spawnfunc(item_medic);
+
+//***********************
+//WORD OF PADMAN ENTITIES - So people can play wop maps with the xonotic weapons
+//***********************
+
+spawnfunc(weapon_punchy)       { spawnfunc_weapon_arc(this);                   }
+spawnfunc(weapon_nipper)       { spawnfunc_weapon_machinegun(this);    }
+spawnfunc(weapon_pumper)       { spawnfunc_weapon_shotgun(this);               }
+spawnfunc(weapon_boaster)      { spawnfunc_weapon_electro(this);               }
+spawnfunc(weapon_splasher)     { spawnfunc_weapon_vortex(this);                }
+spawnfunc(weapon_bubbleg)      { spawnfunc_weapon_hagar(this);                 }
+spawnfunc(weapon_balloony)     { spawnfunc_weapon_mortar(this);                }
+spawnfunc(weapon_betty)                { spawnfunc_weapon_devastator(this);    }
+spawnfunc(weapon_imperius)     { spawnfunc_weapon_crylink(this);               }
+
+spawnfunc(ammo_pumper)         { spawnfunc_item_shells(this);                  }
+spawnfunc(ammo_nipper)         { spawnfunc_item_bullets(this);                 }
+spawnfunc(ammo_balloony)       { spawnfunc_item_rockets(this);                 }
+spawnfunc(ammo_bubbleg)                { spawnfunc_item_rockets(this);                 }
+spawnfunc(ammo_boaster)                { spawnfunc_item_cells(this);                   }
+spawnfunc(ammo_betty)          { spawnfunc_item_rockets(this);                 }
+spawnfunc(ammo_imperius)       { spawnfunc_item_cells(this);                   }
+
+spawnfunc(item_padpower)       { spawnfunc_item_quad(this);                    }
+spawnfunc(item_climber)                { spawnfunc_item_invincible(this);              }
+spawnfunc(item_speedy)         { spawnfunc_item_haste(this);                   }
+spawnfunc(item_jump)           { spawnfunc_item_jetpack(this);                 }
+spawnfunc(item_visionless)     { spawnfunc_item_invis(this);                   }
+spawnfunc(item_revival)                { spawnfunc_item_medic(this);                   }
+spawnfunc(item_armor_padshield)        { spawnfunc_item_armor_mega(this);      }
diff --git a/qcsrc/server/compat/wop.qh b/qcsrc/server/compat/wop.qh
new file mode 100644 (file)
index 0000000..6f70f09
--- /dev/null
@@ -0,0 +1 @@
+#pragma once
index 8a10a6d7525f5c973367b7adef18c16546cfd8a6..9b36010fec98015253b4e4a92d38054f1d13fed4 100644 (file)
@@ -554,7 +554,7 @@ IMPULSE(navwaypoint_unreachable)
        IL_EACH(g_spawnpoints, true,
        {
                vector org = it.origin;
-               tracebox(it.origin, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), it.origin - '0 0 512', MOVE_NOMONSTERS, NULL);
+               tracebox(it.origin, PL_MIN_CONST, PL_MAX_CONST, it.origin - '0 0 512', MOVE_NOMONSTERS, NULL);
                setorigin(it, trace_endpos);
                if (navigation_findnearestwaypoint(it, false))
                {
index 2ea425692c1d5ead09c22889c91237190e8f1321..b5a6014462ea141adf7379172adf8fb9a853cd2c 100644 (file)
@@ -270,14 +270,14 @@ void MapVote_SendPicture(entity to, int id)
 
 void MapVote_WriteMask()
 {
-       float i;
        if ( mapvote_count < 24 )
        {
-               float mask,power;
-               mask = 0;
-               for(i = 0, power = 1; i < mapvote_count; ++i, power *= 2)
-                       if(mapvote_maps_flags[i] & GTV_AVAILABLE )
-                               mask |= power;
+               int mask = 0;
+               for(int j = 0; j < mapvote_count; ++j)
+               {
+                       if(mapvote_maps_flags[j] & GTV_AVAILABLE)
+                               mask |= BIT(j);
+               }
 
                if(mapvote_count < 8)
                        WriteByte(MSG_ENTITY, mask);
@@ -288,8 +288,8 @@ void MapVote_WriteMask()
        }
        else
        {
-               for ( i = 0; i < mapvote_count; ++i )
-                       WriteByte(MSG_ENTITY, mapvote_maps_flags[i]);
+               for (int j = 0; j < mapvote_count; ++j)
+                       WriteByte(MSG_ENTITY, mapvote_maps_flags[j]);
        }
 }
 
index d2aff2ae7bbc53d7378372b3aac05033ecb826a7..39c42a55695f3e585ecf9f440fe89435d382342b 100644 (file)
@@ -229,10 +229,15 @@ string formatmessage(entity this, string msg)
        n = 7;
 
        ammoitems = "batteries";
-       if(this.items & ITEM_Plasma.m_itemid) ammoitems = ITEM_Plasma.m_name;
-       if(this.items & ITEM_Cells.m_itemid) ammoitems = ITEM_Cells.m_name;
-       if(this.items & ITEM_Rockets.m_itemid) ammoitems = ITEM_Rockets.m_name;
-       if(this.items & ITEM_Shells.m_itemid) ammoitems = ITEM_Shells.m_name;
+       switch((PS(this).m_weapon).ammo_field)
+       {
+               case ammo_shells:  ammoitems = ITEM_Shells.m_name;      break;
+               case ammo_nails:   ammoitems = ITEM_Bullets.m_name;     break;
+               case ammo_rockets: ammoitems = ITEM_Rockets.m_name;     break;
+               case ammo_cells:   ammoitems = ITEM_Cells.m_name;       break;
+               case ammo_plasma:  ammoitems = ITEM_Plasma.m_name;      break;
+               case ammo_fuel:    ammoitems = ITEM_JetpackFuel.m_name; break;
+       }
 
        WarpZone_crosshair_trace(this);
        cursor = trace_endpos;
index 27fd46b88524ebc6eecd712634b4ea8af0296f37..d1c97bd2856f90d2e227f1deb65f1e314a676227 100644 (file)
@@ -2592,6 +2592,14 @@ spawnfunc(team_CTF_bluespawn)  { spawnfunc_info_player_team2(this);  }
 spawnfunc(team_CTF_neutralflag)        { spawnfunc_item_flag_neutral(this);  }
 spawnfunc(team_neutralobelisk) { spawnfunc_item_flag_neutral(this);  }
 
+// compatibility for wop maps
+spawnfunc(team_redplayer)      { spawnfunc_info_player_team1(this);  }
+spawnfunc(team_blueplayer)     { spawnfunc_info_player_team2(this);  }
+spawnfunc(team_ctl_redlolly)   { spawnfunc_item_flag_team1(this);    }
+spawnfunc(team_CTL_redlolly)   { spawnfunc_item_flag_team1(this);    }
+spawnfunc(team_ctl_bluelolly)  { spawnfunc_item_flag_team2(this);    }
+spawnfunc(team_CTL_bluelolly)  { spawnfunc_item_flag_team2(this);    }
+
 
 // ==============
 // Initialization
index 2aede9204052148d1dee08243f137e5379be642f..5bfbe676e6d7566127075915c37f0527e6540d60 100644 (file)
@@ -277,7 +277,7 @@ void kh_Key_Detach(entity key) // runs every time a key is dropped or lost. Runs
        }
        // in any case:
        setattachment(key, NULL, "");
-       setorigin(key, key.owner.origin + '0 0 1' * (STAT(PL_MIN, NULL).z - KH_KEY_MIN_z));
+       setorigin(key, key.owner.origin + '0 0 1' * (STAT(PL_MIN, key.owner).z - KH_KEY_MIN_z));
        key.angles = key.owner.angles;
 #else
        setorigin(key, key.owner.origin + key.origin.z * '0 0 1');
index 12083e423cb573b940c3c82c9453450447f6c096..1656b1400e171b5ed696ed726f8353787d5adaf8 100644 (file)
@@ -208,8 +208,8 @@ float Portal_FindSafeOrigin(entity portal)
 {
        vector o;
        o = portal.origin;
-       portal.mins = STAT(PL_MIN, NULL) - SAFERNUDGE;
-       portal.maxs = STAT(PL_MAX, NULL) + SAFERNUDGE;
+       portal.mins = PL_MIN_CONST - SAFERNUDGE;
+       portal.maxs = PL_MAX_CONST + SAFERNUDGE;
        fixedmakevectors(portal.mangle);
        portal.origin += 16 * v_forward;
        if(!move_out_of_solid(portal))
index 87776d4794bca8099a766b92d709e3c51a7a5923..a3cbc685f2be9d3164ce3526d7932a9f962b7a54 100644 (file)
@@ -913,7 +913,7 @@ spawnfunc(trigger_race_checkpoint)
                settouch(this, checkpoint_touch);
 
        o = (this.absmin + this.absmax) * 0.5;
-       tracebox(o, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), o - '0 0 1' * (o.z - this.absmin.z), MOVE_NORMAL, this);
+       tracebox(o, PL_MIN_CONST, PL_MAX_CONST, o - '0 0 1' * (o.z - this.absmin.z), MOVE_NORMAL, this);
        waypoint_spawnforitem_force(this, trace_endpos);
        this.nearestwaypointtimeout = time + 1000000000;
 
@@ -972,7 +972,7 @@ spawnfunc(target_checkpoint) // defrag entity
        if(is_trigger)
        {
                org = (this.absmin + this.absmax) * 0.5;
-               tracebox(org, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), org - '0 0 1' * (org.z - this.absmin.z), MOVE_NORMAL, this);
+               tracebox(org, PL_MIN_CONST, PL_MAX_CONST, org - '0 0 1' * (org.z - this.absmin.z), MOVE_NORMAL, this);
                waypoint_spawnforitem_force(this, trace_endpos);
                this.nearestwaypointtimeout = time + 1000000000;
        }
diff --git a/qcsrc/server/t_halflife.qc b/qcsrc/server/t_halflife.qc
deleted file mode 100644 (file)
index 7719542..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-#include "t_halflife.qh"
-.float  roomtype;
-.float  radius;
-.float  pitch;
-.float  renderamt;
-.float  rendermode;
-.vector rendercolor;
-
-spawnfunc(weapon_crossbow) {}
-spawnfunc(weapon_handgrenade) {}
-spawnfunc(ammo_crossbow) {}
-spawnfunc(ammo_9mmclip) {}
-spawnfunc(ammo_gaussclip) {}
-spawnfunc(weapon_rpg) {}
-spawnfunc(weapon_357) {}
-void ammo_ARgrenades() {}
-spawnfunc(item_battery) {}
-spawnfunc(ammo_rpgclip) {}
-void weapon_9mmAR() {}
-spawnfunc(weapon_tripmine) {}
-spawnfunc(weapon_snark) {}
-spawnfunc(ammo_buckshot) {}
-void ammo_9mmAR() {}
-spawnfunc(ammo_357) {}
-spawnfunc(weapon_gauss) {}
-spawnfunc(weapon_hornetgun) {}
-//spawnfunc(weapon_shotgun) {}
-spawnfunc(item_healthkit) {}
-spawnfunc(item_longjump) {}
-spawnfunc(item_antidote) {}
-spawnfunc(func_recharge) {}
-spawnfunc(info_node) {}
-spawnfunc(env_sound) {}
-spawnfunc(light_spot) {}
-spawnfunc(func_healthcharger) {}
diff --git a/qcsrc/server/t_halflife.qh b/qcsrc/server/t_halflife.qh
deleted file mode 100644 (file)
index 6f70f09..0000000
+++ /dev/null
@@ -1 +0,0 @@
-#pragma once
diff --git a/qcsrc/server/t_quake.qc b/qcsrc/server/t_quake.qc
deleted file mode 100644 (file)
index 7a277df..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-#include "t_quake.qh"
-
-#include <common/weapons/_all.qh>
-
-spawnfunc(weapon_electro);
-spawnfunc(weapon_hagar);
-spawnfunc(weapon_machinegun);
-spawnfunc(item_bullets);
-spawnfunc(item_armor_mega);
-spawnfunc(item_health_mega);
-spawnfunc(item_health_medium);
-
-//***********************
-//QUAKE 1 ENTITIES - So people can play quake1 maps with the xonotic weapons
-//***********************
-spawnfunc(weapon_nailgun) {spawnfunc_weapon_electro(this);}
-spawnfunc(weapon_supernailgun) {spawnfunc_weapon_hagar(this);}
-spawnfunc(weapon_supershotgun) {spawnfunc_weapon_machinegun(this);}
-
-spawnfunc(item_spikes) {spawnfunc_item_bullets(this);}
-//spawnfunc(item_armor1) {spawnfunc_item_armor_medium(this);}  // FIXME: in Quake this is green armor, in Xonotic maps it is an armor shard
-spawnfunc(item_armor2) {spawnfunc_item_armor_mega(this);}
-spawnfunc(item_armorInv) {spawnfunc_item_armor_mega(this);} // TODO: make sure we actually want this
-spawnfunc(item_health) {if (this.spawnflags & 2) spawnfunc_item_health_mega(this);else spawnfunc_item_health_medium(this);}
-
-//spawnfunc_item_spikes
-//spawnfunc_item_health
-
-
-
diff --git a/qcsrc/server/t_quake.qh b/qcsrc/server/t_quake.qh
deleted file mode 100644 (file)
index 6f70f09..0000000
+++ /dev/null
@@ -1 +0,0 @@
-#pragma once
diff --git a/qcsrc/server/t_quake3.qc b/qcsrc/server/t_quake3.qc
deleted file mode 100644 (file)
index 85ec325..0000000
+++ /dev/null
@@ -1,208 +0,0 @@
-#include "t_quake3.qh"
-
-#include <common/weapons/_all.qh>
-
-spawnfunc(weapon_crylink);
-spawnfunc(weapon_electro);
-spawnfunc(weapon_hagar);
-spawnfunc(weapon_machinegun);
-spawnfunc(weapon_vortex);
-
-spawnfunc(target_items);
-
-spawnfunc(item_bullets);
-spawnfunc(item_cells);
-spawnfunc(item_rockets);
-spawnfunc(item_shells);
-
-spawnfunc(item_jetpack);
-
-spawnfunc(item_armor_big);
-spawnfunc(item_armor_mega);
-spawnfunc(item_armor_small);
-
-spawnfunc(item_health_medium);
-spawnfunc(item_health_mega);
-
-//***********************
-//QUAKE 3 ENTITIES - So people can play quake3 maps with the xonotic weapons
-//***********************
-
-// NOTE: for best experience, you need to swap MGs with SGs in the map or it won't have a MG
-
-// SG -> SG
-spawnfunc(ammo_shells)         { spawnfunc_item_shells(this);         }
-
-// MG -> MG
-spawnfunc(ammo_bullets)        { spawnfunc_item_bullets(this);        }
-
-// GL -> Mortar
-spawnfunc(ammo_grenades)       { spawnfunc_item_rockets(this);        }
-
-// LG -> Lightning
-spawnfunc(weapon_lightning)    { spawnfunc_weapon_electro(this);      }
-spawnfunc(ammo_lightning)      { spawnfunc_item_cells(this);          }
-
-// Plasma -> Hagar
-spawnfunc(weapon_plasmagun)    { spawnfunc_weapon_hagar(this);        }
-spawnfunc(ammo_cells)          { spawnfunc_item_rockets(this);        }
-
-// Rail -> Vortex
-spawnfunc(weapon_railgun)      { spawnfunc_weapon_vortex(this);          }
-spawnfunc(ammo_slugs)          { spawnfunc_item_cells(this);          }
-
-// BFG -> Crylink
-spawnfunc(weapon_bfg)          { spawnfunc_weapon_crylink(this);      }
-spawnfunc(ammo_bfg)            { spawnfunc_item_cells(this);          }
-
-// RL -> RL
-spawnfunc(ammo_rockets)        { spawnfunc_item_rockets(this);        }
-
-// Armor
-spawnfunc(item_armor_body)     { spawnfunc_item_armor_mega(this);    }
-spawnfunc(item_armor_combat)   { spawnfunc_item_armor_big(this);      }
-spawnfunc(item_armor_shard)    { spawnfunc_item_armor_small(this);    }
-spawnfunc(item_enviro)         { spawnfunc_item_invincible(this);     }
-
-.float wait;
-.float delay;
-
-// weapon remove ent from df
-void target_init_verify(entity this)
-{
-       entity trigger, targ;
-       for(trigger = NULL; (trigger = find(trigger, classname, "trigger_multiple")); )
-               for(targ = NULL; (targ = find(targ, targetname, trigger.target)); )
-                       if (targ.classname == "target_init" || targ.classname == "target_give" || targ.classname == "target_items")
-                       {
-                               trigger.wait = 0;
-                               trigger.delay = 0;
-                               targ.wait = 0;
-                               targ.delay = 0;
-
-                               //setsize(targ, trigger.mins, trigger.maxs);
-                               //setorigin(targ, trigger.origin);
-                               //remove(trigger);
-                       }
-}
-
-spawnfunc(target_init)
-{
-       this.spawnflags = 0; // remove all weapons except the ones listed below
-       this.netname = "shotgun"; // keep these weapons through the remove trigger
-       spawnfunc_target_items(this);
-       InitializeEntity(this, target_init_verify, INITPRIO_FINDTARGET);
-}
-
-// weapon give ent from defrag
-void target_give_init(entity this)
-{
-       IL_EACH(g_items, it.targetname == this.target,
-       {
-               if (it.classname == "weapon_rocketlauncher" || it.classname == "weapon_devastator") {
-                       this.ammo_rockets += it.count * WEP_CVAR(devastator, ammo);
-                       this.netname = "devastator";
-               }
-               else if (it.classname == "weapon_plasmagun") {
-                       this.ammo_rockets += it.count * WEP_CVAR_PRI(hagar, ammo); // WEAPONTODO
-                       if(this.netname == "")
-                               this.netname = "hagar";
-                       else
-                               this.netname = strcat(this.netname, " hagar");
-               }
-               else if (it.classname == "weapon_bfg") {
-                       this.ammo_cells += it.count * WEP_CVAR_PRI(crylink, ammo);
-                       if(this.netname == "")
-                               this.netname = "crylink";
-                       else
-                               this.netname = strcat(this.netname, " crylink");
-               }
-               else if (it.classname == "weapon_grenadelauncher" || it.classname == "weapon_mortar") {
-                       this.ammo_rockets += it.count * WEP_CVAR_PRI(mortar, ammo); // WEAPONTODO
-                       if(this.netname == "")
-                               this.netname = "mortar";
-                       else
-                               this.netname = strcat(this.netname, " mortar");
-               }
-               else if (it.classname == "item_armor_body")
-                       this.armorvalue = 100;
-               else if (it.classname == "item_health_mega")
-                       this.health = 200;
-               //remove(it); // removing ents in init functions causes havoc, workaround:
-        setthink(it, SUB_Remove);
-        it.nextthink = time;
-       });
-       this.spawnflags = 2;
-       spawnfunc_target_items(this);
-       InitializeEntity(this, target_init_verify, INITPRIO_FINDTARGET);
-}
-
-spawnfunc(target_give)
-{
-       InitializeEntity(this, target_give_init, INITPRIO_FINDTARGET);
-}
-
-//spawnfunc(item_flight)       /* handled by jetpack */
-//spawnfunc(item_haste)        /* handled by buffs mutator */
-//spawnfunc(item_health)       /* handled in t_quake.qc */
-//spawnfunc(item_health_large) /* handled in t_items.qc */
-//spawnfunc(item_health_small) /* handled in t_items.qc */
-//spawnfunc(item_health_mega)  /* handled in t_items.qc */
-//spawnfunc(item_invis)        /* handled by buffs mutator */
-//spawnfunc(item_regen)        /* handled by buffs mutator */
-
-// CTF spawnfuncs handled in mutators/gamemode_ctf.qc now
-
-spawnfunc(item_flight)
-{
-       spawnfunc_item_jetpack(this);
-}
-
-.float notteam;
-.float notsingle;
-.float notfree;
-.float notq3a;
-.float notta;
-.string gametype;
-bool DoesQ3ARemoveThisEntity(entity this)
-{
-       // Q3 style filters (DO NOT USE, THIS IS COMPAT ONLY)
-
-       if(this.notq3a)
-               if(!teamplay || g_tdm || g_ctf)
-                       return true;
-
-       if(this.notta)
-               if (!(!teamplay || g_tdm || g_ctf))
-                       return true;
-
-       if(this.notsingle)
-               if(maxclients == 1)
-                       return true;
-
-       if(this.notteam)
-               if(teamplay)
-                       return true;
-
-       if(this.notfree)
-               if(!teamplay)
-                       return true;
-
-       if(this.gametype)
-       {
-               string gametypename;
-               // static char *gametypeNames[] = {"ffa", "tournament", "single", "team", "ctf", "oneflag", "obelisk", "harvester", "teamtournament"}
-               gametypename = "ffa";
-               if(teamplay)
-                       gametypename = "team";
-               if(g_ctf)
-                       gametypename = "ctf";
-               if(maxclients == 1)
-                       gametypename = "single";
-               // we do not have the other types (oneflag, obelisk, harvester, teamtournament)
-               if(strstrofs(this.gametype, gametypename, 0) < 0)
-                       return true;
-       }
-
-       return false;
-}
diff --git a/qcsrc/server/t_quake3.qh b/qcsrc/server/t_quake3.qh
deleted file mode 100644 (file)
index 6f70f09..0000000
+++ /dev/null
@@ -1 +0,0 @@
-#pragma once
index 7dbdae6838cb2d5adcd632b9f67404b1f9359021..ad479824ec76f654a21877f546b0c273a4fff525 100644 (file)
@@ -447,7 +447,6 @@ void W_WeaponFrame(Player actor, .entity weaponentity)
                PS(actor).m_switchingweapon = WEP_Null;
                this.state = WS_CLEAR;
                actor.weaponname = "";
-               // actor.items &= ~IT_AMMO;
                return;
        }