]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'master' into bones_was_here/q3compat
authorbones_was_here <bones_was_here@yahoo.com.au>
Tue, 14 Jul 2020 10:44:43 +0000 (20:44 +1000)
committerbones_was_here <bones_was_here@yahoo.com.au>
Tue, 14 Jul 2020 10:44:43 +0000 (20:44 +1000)
19 files changed:
qcsrc/common/items/item/ammo.qc
qcsrc/common/mapobjects/func/button.qc
qcsrc/common/mapobjects/func/door.qc
qcsrc/common/mapobjects/trigger/hurt.qc
qcsrc/common/mapobjects/trigger/jumppads.qc
qcsrc/common/mapobjects/trigger/multi.qc
qcsrc/common/mutators/mutator/buffs/all.inc
qcsrc/common/physics/player.qc
qcsrc/common/stats.qh
qcsrc/common/weapons/weapon/shockwave.qc
qcsrc/common/weapons/weapon/shotgun.qc
qcsrc/common/weapons/weapon/shotgun.qh
qcsrc/server/autocvars.qh
qcsrc/server/client.qc
qcsrc/server/compat/quake.qc
qcsrc/server/compat/quake3.qc
qcsrc/server/compat/quake3.qh
qcsrc/server/g_world.qc
xonotic-server.cfg

index 739d94aca1e8b3fb9954ce8a278570f96c6363cf..48ca0ddab6947f2dd320a96d5644983f4a055ee4 100644 (file)
@@ -1,14 +1,2 @@
 #include "ammo.qh"
 
-#ifdef SVQC
-
-METHOD(Shells, m_spawnfunc_hookreplace, GameItem(Shells this, entity e))
-{
-       if (autocvar_sv_q3acompat_machineshotgunswap && !Item_IsLoot(e))
-       {
-               return ITEM_Bullets;
-       }
-       return this;
-}
-
-#endif
index 423ac5e7b6d927f9fa2f8cdd42cf9797fe6b2f56..c716b400c86985e1260faa8aeaad2f85ab8bbbb1 100644 (file)
@@ -206,8 +206,8 @@ spawnfunc(func_button)
        if (!this.lip)
                this.lip = 4;
 
-       if(this.wait == -1 && autocvar_sv_q3defragcompat)
-               this.wait = 0.1; // compatibility for q3df: "instant" return
+       if(this.wait < 0 && q3compat)
+               this.wait = 0.1; // compatibility for q3: -1 = return immediately
 
     if(this.noise != "")
         precache_sound(this.noise);
index 11196ab38d7f2bbcce2418a3bfd3f201be84bed4..48e11ad87bc528c3867b12312a7aa24c86f6710f 100644 (file)
@@ -737,7 +737,7 @@ spawnfunc(func_door)
         }
         else if (!this.speed)
         {
-               if (autocvar_sv_q3defragcompat)
+               if (q3compat)
                        this.speed = 400;
                else
                        this.speed = 100;
index 8c21c509c5643419bb937d1d4170a81d711f12df..19447c41b99d2f3b563264f75601b85d50a2eae0 100644 (file)
@@ -25,7 +25,7 @@ void trigger_hurt_touch(entity this, entity toucher)
                if (toucher.triggerhurttime < time)
                {
                        EXACTTRIGGER_TOUCH(this, toucher);
-                       toucher.triggerhurttime = time + ((autocvar_sv_q3defragcompat && !(this.spawnflags & HURT_SLOW)) ? 0.1 : 1);
+                       toucher.triggerhurttime = time + ((q3compat && !(this.spawnflags & HURT_SLOW)) ? 0.1 : 1);
 
                        entity own;
                        own = this.enemy;
@@ -66,7 +66,7 @@ spawnfunc(trigger_hurt)
        this.use = trigger_hurt_use;
        this.enemy = world; // I hate you all
        if (!this.dmg)
-               this.dmg = ((autocvar_sv_q3defragcompat) ? 5 : 10000);
+               this.dmg = ((q3compat) ? 5 : 10000);
        if (this.message == "")
                this.message = "was in the wrong place";
        if (this.message2 == "")
index 2c160eae95e8a05e75f1ead2512b81c257716242..66daba8307cfb693fb8acca30768fd6795c55a93 100644 (file)
@@ -135,7 +135,7 @@ bool jumppad_push(entity this, entity targ)
 
        vector org = targ.origin;
 #ifdef SVQC
-       if(autocvar_sv_q3defragcompat)
+       if(q3compat)
 #elif defined(CSQC)
        if(STAT(Q3DEFRAGCOMPAT))
 #endif
index df915a649695c34ade16a31051dc9bdb6ce02b32..c087f071a3eeb2611713256f8e0429bfc59b0831 100644 (file)
@@ -176,7 +176,7 @@ spawnfunc(trigger_multiple)
                this.wait = 0;
        this.use = multi_use;
 
-       if(this.wait == -1 && autocvar_sv_q3defragcompat)
+       if(this.wait == -1 && q3compat & BIT(1))
                this.wait = 0.1; // compatibility for q3df: "instant" return
 
        EXACTTRIGGER_INIT;
index 5b53b3d651c2d76e49ac25e6778fc24a781e7fde..6fd7bdd9b32c2380766bf068975436ae6bbf603e 100644 (file)
@@ -2,12 +2,14 @@ string Buff_UndeprecateName(string buffname)
 {
     switch(buffname)
     {
-        case "ammoregen": return "ammo";
-        case "haste": case "scout": return "speed";
-        case "guard": return "resistance";
-        case "revival": case "regen": return "medic";
-        case "invis": return "invisible";
-        case "jumper": return "jump";
+        case "ammoregen": return "ammo";               // Q3TA ammoregen
+        case "haste": return "speed";                  // Q3A haste
+        case "doubler": return "inferno";              // Q3TA doubler
+        case "scout": return "bash";                   // Q3TA scout
+        case "guard": return "resistance";             // Q3TA guard
+        case "revival": case "regen": return "medic";  // WOP revival, Q3A regen
+        case "invis": return "invisible";              // Q3A invis
+        case "jumper": return "jump";                  // WOP jumper
         default: return buffname;
     }
 }
@@ -38,7 +40,6 @@ REGISTER_BUFF(SPEED) {
 }
 BUFF_SPAWNFUNCS(speed, BUFF_SPEED)
 BUFF_SPAWNFUNC_Q3TA_COMPAT(haste, BUFF_SPEED)
-BUFF_SPAWNFUNC_Q3TA_COMPAT(scout, BUFF_SPEED)
 
 REGISTER_BUFF(MEDIC) {
     this.m_name = _("Medic");
@@ -57,7 +58,7 @@ REGISTER_BUFF(BASH) {
     this.m_color = '1 0.39 0';
 }
 BUFF_SPAWNFUNCS(bash, BUFF_BASH)
-BUFF_SPAWNFUNC_Q3TA_COMPAT(doubler, BUFF_BASH)
+BUFF_SPAWNFUNC_Q3TA_COMPAT(scout, BUFF_BASH)
 
 REGISTER_BUFF(VAMPIRE) {
     this.m_name = _("Vampire");
@@ -108,6 +109,7 @@ REGISTER_BUFF(INFERNO) {
     this.m_color = '1 0.62 0';
 }
 BUFF_SPAWNFUNCS(inferno, BUFF_INFERNO)
+BUFF_SPAWNFUNC_Q3TA_COMPAT(doubler, BUFF_INFERNO)
 
 REGISTER_BUFF(SWAPPER) {
     this.m_name = _("Swapper");
index 5d4beb1acf1a7615391d14f5f035a264ca7875ca..e2497361049ca19db8ec3491dd497604f6ff02b2 100644 (file)
@@ -53,7 +53,7 @@ void Physics_UpdateStats(entity this)
             : 0;
           STAT(MOVEVARS_AIRSPEEDLIMIT_NONQW, this) = Physics_ClientOption(this, "airspeedlimit_nonqw", autocvar_sv_airspeedlimit_nonqw) * maxspd_mod;
         }
-       bool q3dfcompat = autocvar_sv_q3defragcompat && autocvar_sv_q3defragcompat_changehitbox; // NOTE: these hitboxes are off by 1 due to engine differences
+       bool q3dfcompat = q3compat && autocvar_sv_q3defragcompat_changehitbox; // NOTE: these hitboxes are off by 1 due to engine differences
        STAT(PL_MIN, this) = (q3dfcompat) ? '-15 -15 -20' : autocvar_sv_player_mins;
        STAT(PL_MAX, this) = (q3dfcompat) ? '15 15 36' : autocvar_sv_player_maxs;
        STAT(PL_VIEW_OFS, this) = (q3dfcompat) ? '0 0 30' : autocvar_sv_player_viewoffset;
index 9ecac9f7c0bdd0bf2ee59dad460c6beea9905fc0..f00a29adae5c8056910c3c284132691f4a3adb4e 100644 (file)
@@ -3,6 +3,7 @@
 #ifdef SVQC
 #include <server/autocvars.qh>
 #include <server/client.qh>
+#include <server/compat/quake3.qh>
 #endif
 
 // Full list of all stat constants, included in a single location for easy reference
@@ -323,10 +324,7 @@ bool autocvar_sv_slick_applygravity;
 #endif
 REGISTER_STAT(SLICK_APPLYGRAVITY, bool, autocvar_sv_slick_applygravity)
 
-#ifdef SVQC
-bool autocvar_sv_q3defragcompat;
-#endif
-REGISTER_STAT(Q3DEFRAGCOMPAT, bool, autocvar_sv_q3defragcompat)
+REGISTER_STAT(Q3DEFRAGCOMPAT, bool, q3compat)
 
 #ifdef SVQC
 #include "physics/movetypes/movetypes.qh"
index f38c34b19791182d9127b58a6459d12d8cc332db..4ee49f83b0f4e31acd06e3175c7ce3ad3339fa1a 100644 (file)
@@ -3,18 +3,6 @@
 REGISTER_NET_TEMP(TE_CSQC_SHOCKWAVEPARTICLE)
 
 #ifdef SVQC
-// enable when shockwave replaces shotgun
-#if 0
-METHOD(Shockwave, m_spawnfunc_hookreplace, Weapon(Shockwave this, entity e))
-{
-       //if(autocvar_sv_q3acompat_machineshockwaveswap) // WEAPONTODO
-       if (autocvar_sv_q3acompat_machineshotgunswap && !Item_IsLoot(e))
-       {
-               return WEP_MACHINEGUN;
-       }
-       return this;
-}
-#endif
 
 const float MAX_SHOCKWAVE_HITS = 10;
 //#define DEBUG_SHOCKWAVE
index b8cae5fd5da0d66c0216c9806c788b1752cfab8d..9b1c81f31c73ef8bc46056e2b8ec137d419a1448 100644 (file)
@@ -5,15 +5,6 @@
 // enable to debug melee range
 //#define SHOTGUN_MELEEDEBUG
 
-METHOD(Shotgun, m_spawnfunc_hookreplace, Weapon(Shotgun this, entity e))
-{
-       if (autocvar_sv_q3acompat_machineshotgunswap && !Item_IsLoot(e))
-       {
-               return WEP_MACHINEGUN;
-       }
-       return this;
-}
-
 void W_Shotgun_Attack(Weapon thiswep, entity actor, .entity weaponentity, float isprimary, float ammocount, float damage, float bullets, float spread, float solidpenetration, float force, entity bullet_trail_effect)
 {
        W_DecreaseAmmo(thiswep, actor, ammocount, weaponentity);
@@ -27,7 +18,7 @@ void W_Shotgun_Attack(Weapon thiswep, entity actor, .entity weaponentity, float
 
        for(int sc = 0;sc < bullets;sc = sc + 1)
                fireBullet_antilag(actor, weaponentity, w_shotorg, w_shotdir, spread, solidpenetration, damage, force, thiswep.m_id, bullet_trail_effect, false);
-       
+
        if(lag && bullets > 0)
                antilag_restore_all(actor);
 
index dc6dae157d7f81d345076370d116a92d332d1eb4..25bc9123d7bd89bd9901c0627fcd4a1f0a1dd2b2 100644 (file)
@@ -54,4 +54,3 @@ CLASS(Shotgun, Weapon)
 ENDCLASS(Shotgun)
 REGISTER_WEAPON(SHOTGUN, shotgun, NEW(Shotgun));
 
-SPAWNFUNC_WEAPON(weapon_shotgun, WEP_SHOTGUN)
index 99077dcfe7b237fc8e1c5e59f888e6d666c4feb5..6c14aa795b7211291ffb6bfd8ac64408c6fbf5df 100644 (file)
@@ -327,7 +327,6 @@ float autocvar_sv_maxspeed;
 string autocvar_sv_motd;
 int autocvar_sv_name_maxlength = 64;
 bool autocvar_sv_precacheplayermodels;
-bool autocvar_sv_q3acompat_machineshotgunswap;
 bool autocvar_sv_servermodelsonly;
 int autocvar_sv_spectate;
 float autocvar_sv_spectator_speed_multiplier;
index 5047334f0a4e9025d2b54d9da8527b06c0200626..c8352733172b6841f312e640ac01604cc9479e7b 100644 (file)
@@ -613,7 +613,7 @@ void PutPlayerInServer(entity this)
        this.respawn_flags = 0;
        this.respawn_time = 0;
        STAT(RESPAWN_TIME, this) = 0;
-       bool q3dfcompat = autocvar_sv_q3defragcompat && autocvar_sv_q3defragcompat_changehitbox;
+       bool q3dfcompat = q3compat && autocvar_sv_q3defragcompat_changehitbox;
        this.scale = ((q3dfcompat) ? 0.9 : autocvar_sv_player_scale);
        this.fade_time = 0;
        this.pain_frame = 0;
index c80da0af3772cf40ddd744cf1c471f0268702e23..93d935e020cdb6deca58134e1f0d791dc0f39f0d 100644 (file)
@@ -7,7 +7,7 @@
 //***********************
 //QUAKE 1 ENTITIES - So people can play quake1 maps with the xonotic weapons
 //***********************
-SPAWNFUNC_WEAPON(weapon_nailgun, WEP_ELECTRO)
+// see: quake3.qc for weapon_nailgun
 SPAWNFUNC_WEAPON(weapon_supernailgun, WEP_HAGAR)
 SPAWNFUNC_WEAPON(weapon_supershotgun, WEP_MACHINEGUN)
 
index c405b8a24b70a853003e52f4982702cc4039e274..ee8530796e8f2f552786b76940edec1fe4a755a2 100644 (file)
 #include <common/notifications/all.qh>
 #include <common/weapons/_all.qh>
 
-//***********************
-//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_ITEM(ammo_shells, ITEM_Shells)
-
-// MG -> MG
-SPAWNFUNC_ITEM(ammo_bullets, ITEM_Bullets)
+/***********************
+ * QUAKE 3 ENTITIES - So people can play quake3 maps with the xonotic weapons
+ ***********************
+
+ * Map entities NOT handled in this file:
+ holdable_invulnerability      Q3TA    currently unsupported
+ holdable_kamikaze             Q3TA    currently unsupported
+ item_ammoregen                        Q3TA    handled by buffs mutator
+ item_doubler                  Q3TA    handled by buffs mutator
+ item_guard                    Q3TA    handled by buffs mutator
+ item_scout                    Q3TA    handled by buffs mutator
+ item_armor_jacket             CPMA    handled in quake2.qc
+ item_flight                   Q3A     handled by buffs mutator
+ item_haste                    Q3A     handled by buffs mutator
+ item_health                   Q3A     handled in quake.qc
+ item_health_large             Q3A     handled in items.qc
+ item_health_small             Q3A     handled in health.qh
+ item_health_mega              Q3A     handled in health.qh
+ item_invis                    Q3A     handled by buffs mutator
+ item_quad                     Q3A     handled in items.qc
+ item_regen                    Q3A     handled by buffs mutator
+ CTF spawnfuncs handled in sv_ctf.qc
+
+ NOTE: for best experience, you need to swap MGs with SGs in the map or it won't have a MG
+*/
+
+// SG -> MG || SG
+SPAWNFUNC_ITEM_COND(ammo_shells, q3compat & BIT(0), ITEM_Bullets, ITEM_Shells)
+SPAWNFUNC_WEAPON_COND(weapon_shotgun, q3compat & BIT(0), WEP_MACHINEGUN, WEP_SHOTGUN)
+
+// MG -> SG || MG
+SPAWNFUNC_ITEM_COND(ammo_bullets, q3compat & BIT(0), ITEM_Shells, ITEM_Bullets)
 
 // GL -> Mortar
 SPAWNFUNC_ITEM(ammo_grenades, ITEM_Rockets)
 
-// Mines -> Rockets
+// Team Arena Proximity Launcher -> Mine Layer
 SPAWNFUNC_WEAPON(weapon_prox_launcher, WEP_MINE_LAYER)
 SPAWNFUNC_ITEM(ammo_mines, ITEM_Rockets)
 
-// LG -> Lightning
+// Team Arena Chaingun -> HLAC
+SPAWNFUNC_WEAPON(weapon_chaingun, WEP_HLAC)
+SPAWNFUNC_ITEM(ammo_belt, ITEM_Cells)
+
+// Team Arena Nailgun -> Crylink || Quake Nailgun -> Electro
+SPAWNFUNC_WEAPON_COND(weapon_nailgun, cvar_string("sv_mapformat_is_quake3"), WEP_CRYLINK, WEP_ELECTRO)
+SPAWNFUNC_ITEM(ammo_nails, ITEM_Cells)
+
+// LG -> Electro
 SPAWNFUNC_WEAPON(weapon_lightning, WEP_ELECTRO)
 SPAWNFUNC_ITEM(ammo_lightning, ITEM_Cells)
 
@@ -43,9 +72,9 @@ SPAWNFUNC_ITEM(ammo_cells, ITEM_Rockets)
 SPAWNFUNC_WEAPON(weapon_railgun, WEP_VORTEX)
 SPAWNFUNC_ITEM(ammo_slugs, ITEM_Cells)
 
-// BFG -> Crylink
-SPAWNFUNC_WEAPON(weapon_bfg, WEP_CRYLINK)
-SPAWNFUNC_ITEM(ammo_bfg, ITEM_Cells)
+// BFG -> Crylink || Fireball
+SPAWNFUNC_WEAPON_COND(weapon_bfg, cvar_string("g_mod_balance") == "XDF", WEP_CRYLINK, WEP_FIREBALL)
+SPAWNFUNC_ITEM_COND(ammo_bfg, cvar_string("g_mod_balance") == "XDF", ITEM_Cells, ITEM_Rockets)
 
 // grappling hook -> hook
 SPAWNFUNC_WEAPON(weapon_grapplinghook, WEP_HOOK)
@@ -244,35 +273,31 @@ spawnfunc(target_fragsFilter)
        this.use = fragsfilter_use;
 }
 
-//spawnfunc(item_flight)       /* handled by buffs mutator */
-//spawnfunc(item_doubler)        /* handled by buffs mutator */
-//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
-
-.float notteam;
-.float notsingle;
-.float notfree;
-.float notq3a;
-.float notta;
+.bool notteam;
+.bool notsingle;
+.bool notfree;
+.bool notta;
+.bool notvq3;
+.bool notcpm;
 .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)
+       // DeFRaG mappers use "notcpm" or "notvq3" to disable an entity in CPM or VQ3 physics
+       // Xonotic is usually played with a CPM-based physics so we default to CPM mode
+       if(cvar_string("g_mod_physics") == "Q3")
+       {
+               if(this.notvq3)
                        return true;
+       }
+       else if(this.notcpm)
+               return true;
 
+       // Q3 mappers use "notq3a" or "notta" to disable an entity in Q3A or Q3TA
+       // Xonotic has ~equivalent features to Team Arena
        if(this.notta)
-               if (!(!teamplay || g_tdm || g_ctf))
-                       return true;
+               return true;
 
        if(this.notsingle)
                if(maxclients == 1)
index 20e4879d9a37596290a2a24258a7d69db623e21a..5d759e3783e4f1ee4dc8e036f2ce6c470fe648e5 100644 (file)
@@ -1,5 +1,6 @@
 #pragma once
 
+int q3compat = 0;
 bool DoesQ3ARemoveThisEntity(entity this);
 
 .int fragsfilter_cnt;
index f6a535580e5a636a1b065ef45d8eb5d3aeb5a5bc..66b8c2b576d4843bf604ebeb47d170bdf9ea3cc9 100644 (file)
@@ -882,11 +882,9 @@ spawnfunc(worldspawn)
        MapInfo_Enumerate();
        MapInfo_FilterGametype(MapInfo_CurrentGametype(), MapInfo_CurrentFeatures(), MapInfo_RequiredFlags(), MapInfo_ForbiddenFlags(), 1);
 
-       if(fexists(strcat("scripts/", mapname, ".arena")))
-               cvar_settemp("sv_q3acompat_machineshotgunswap", "1");
-
-       if(fexists(strcat("scripts/", mapname, ".defi")))
-               cvar_settemp("sv_q3defragcompat", "1");
+       q3compat = BITSET(q3compat, BIT(0), fexists(strcat("scripts/", mapname, ".arena")));
+       q3compat = BITSET(q3compat, BIT(1), fexists(strcat("scripts/", mapname, ".defi")));
+       LOG_INFO("CHECKED FOR: scripts/", mapname, ".arena and scripts/", mapname, ".defi, q3compat set to ", ftos(q3compat));
 
        if(whichpack(strcat("maps/", mapname, ".cfg")) != "")
        {
index ef011cffbc8784866086a3c37dcfef140fba4219..82219f04ec9d9ee0bcbe949e7d50a49f4d0898e9 100644 (file)
@@ -495,9 +495,6 @@ sv_gameplayfix_consistentplayerprethink 1
 sv_gameplayfix_gravityunaffectedbyticrate 1
 sv_gameplayfix_nogravityonground 1
 
-set sv_q3acompat_machineshotgunswap 0 "shorthand for swapping machinegun and shotgun (for Q3A map compatibility in mapinfo files)"
-set sv_q3defragcompat 0 "toggle for some compatibility hacks (for Q3DF map compatibility)"
-
 set g_movement_highspeed 1 "multiplier scale for movement speed (applies to sv_maxspeed and sv_maxairspeed, also applies to air acceleration when g_movement_highspeed_q3_compat is set to 0)"
 set g_movement_highspeed_q3_compat 0 "apply speed modifiers to air movement in a more Q3-compatible way (only apply speed buffs and g_movement_highspeed to max air speed, not to acceleration)"