]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/compat/quake3.qc
take3: format 903 files
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / compat / quake3.qc
index 2e2301d0bdec150704ae2b6f297beddbda5870a2..b17c7b50ceafad0142a4f20ce24e97f8c396b729 100644 (file)
@@ -28,58 +28,121 @@ 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
-//***********************
+// ***********************
+// 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);         }
+spawnfunc(ammo_shells)
+{
+       spawnfunc_item_shells(this);
+}
 
 // MG -> MG
-spawnfunc(ammo_bullets)        { spawnfunc_item_bullets(this);        }
+spawnfunc(ammo_bullets)
+{
+       spawnfunc_item_bullets(this);
+}
 
 // GL -> Mortar
-spawnfunc(ammo_grenades)       { spawnfunc_item_rockets(this);        }
+spawnfunc(ammo_grenades)
+{
+       spawnfunc_item_rockets(this);
+}
 
 // Mines -> Rockets
-spawnfunc(weapon_prox_launcher) { spawnfunc_weapon_minelayer(this);   }
-spawnfunc(ammo_mines)           { spawnfunc_item_rockets(this);       }
+spawnfunc(weapon_prox_launcher)
+{
+       spawnfunc_weapon_minelayer(this);
+}
+spawnfunc(ammo_mines)
+{
+       spawnfunc_item_rockets(this);
+}
 
 // LG -> Lightning
-spawnfunc(weapon_lightning)    { spawnfunc_weapon_electro(this);      }
-spawnfunc(ammo_lightning)      { spawnfunc_item_cells(this);          }
+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);        }
+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);          }
+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);          }
+spawnfunc(weapon_bfg)
+{
+       spawnfunc_weapon_crylink(this);
+}
+spawnfunc(ammo_bfg)
+{
+       spawnfunc_item_cells(this);
+}
 
 // grappling hook -> hook
-spawnfunc(weapon_grapplinghook) { spawnfunc_weapon_hook(this);        }
+spawnfunc(weapon_grapplinghook)
+{
+       spawnfunc_weapon_hook(this);
+}
 
 // RL -> RL
-spawnfunc(ammo_rockets)        { spawnfunc_item_rockets(this);        }
+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);     }
+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);
+}
 
 // medkit -> armor (we have no holdables)
-spawnfunc(holdable_medkit)        { spawnfunc_item_armor_mega(this);     }
+spawnfunc(holdable_medkit)
+{
+       spawnfunc_item_armor_mega(this);
+}
 
 // doubler -> strength
-spawnfunc(item_doubler)        { spawnfunc_item_strength(this); }
+spawnfunc(item_doubler)
+{
+       spawnfunc_item_strength(this);
+}
 
 .float wait;
 .float delay;
@@ -88,24 +151,25 @@ spawnfunc(item_doubler)        { spawnfunc_item_strength(this); }
 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")
-                       {
+       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);
+                               // 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.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);
@@ -119,30 +183,26 @@ void target_give_init(entity this)
                if (it.classname == "weapon_rocketlauncher" || it.classname == "weapon_devastator") {
                        this.ammo_rockets += it.count * WEP_CVAR(devastator, ammo);
                        this.netname = cons(this.netname, "devastator");
-               }
-               else if (it.classname == "weapon_lightning") {
+               } else if (it.classname == "weapon_lightning") {
                        this.ammo_cells += it.count * WEP_CVAR_PRI(electro, ammo); // WEAPONTODO
                        this.netname = cons(this.netname, "electro");
-               }
-               else if (it.classname == "weapon_plasmagun") {
+               } else if (it.classname == "weapon_plasmagun") {
                        this.ammo_rockets += it.count * WEP_CVAR_PRI(hagar, ammo); // WEAPONTODO
                        this.netname = cons(this.netname, "hagar");
-               }
-               else if (it.classname == "weapon_bfg") {
+               } else if (it.classname == "weapon_bfg") {
                        this.ammo_cells += it.count * WEP_CVAR_PRI(crylink, ammo);
                        this.netname = cons(this.netname, "crylink");
-               }
-               else if (it.classname == "weapon_grenadelauncher" || it.classname == "weapon_mortar") {
+               } else if (it.classname == "weapon_grenadelauncher" || it.classname == "weapon_mortar") {
                        this.ammo_rockets += it.count * WEP_CVAR_PRI(mortar, ammo); // WEAPONTODO
                        this.netname = cons(this.netname, "mortar");
-               }
-               else if (it.classname == "item_armor_body")
+               } else if (it.classname == "item_armor_body") {
                        this.armorvalue = 100;
-               else if (it.classname == "item_health_mega")
+               } 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;
+               }
+               // remove(it); // removing ents in init functions causes havoc, workaround:
+               setthink(it, SUB_Remove);
+               it.nextthink = time;
        });
        this.spawnflags = 2;
        this.spawnfunc_checked = true;
@@ -155,14 +215,14 @@ spawnfunc(target_give)
        InitializeEntity(this, target_give_init, INITPRIO_FINDTARGET);
 }
 
-//spawnfunc(item_flight)       /* 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 */
+// spawnfunc(item_flight)       /* 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
 
@@ -176,40 +236,53 @@ bool DoesQ3ARemoveThisEntity(entity this)
 {
        // Q3 style filters (DO NOT USE, THIS IS COMPAT ONLY)
 
-       if(this.notq3a)
-               if(!teamplay || g_tdm || g_ctf)
+       if (this.notq3a) {
+               if (!teamplay || g_tdm || g_ctf) {
                        return true;
+               }
+       }
 
-       if(this.notta)
-               if (!(!teamplay || g_tdm || g_ctf))
+       if (this.notta) {
+               if (!(!teamplay || g_tdm || g_ctf)) {
                        return true;
+               }
+       }
 
-       if(this.notsingle)
-               if(maxclients == 1)
+       if (this.notsingle) {
+               if (maxclients == 1) {
                        return true;
+               }
+       }
 
-       if(this.notteam)
-               if(teamplay)
+       if (this.notteam) {
+               if (teamplay) {
                        return true;
+               }
+       }
 
-       if(this.notfree)
-               if(!teamplay)
+       if (this.notfree) {
+               if (!teamplay) {
                        return true;
+               }
+       }
 
-       if(this.gametype)
-       {
+       if (this.gametype) {
                string gametypename;
                // static char *gametypeNames[] = {"ffa", "tournament", "single", "team", "ctf", "oneflag", "obelisk", "harvester", "teamtournament"}
                gametypename = "ffa";
-               if(teamplay)
+               if (teamplay) {
                        gametypename = "team";
-               if(g_ctf)
+               }
+               if (g_ctf) {
                        gametypename = "ctf";
-               if(maxclients == 1)
+               }
+               if (maxclients == 1) {
                        gametypename = "single";
+               }
                // we do not have the other types (oneflag, obelisk, harvester, teamtournament)
-               if(strstrofs(this.gametype, gametypename, 0) < 0)
+               if (strstrofs(this.gametype, gametypename, 0) < 0) {
                        return true;
+               }
        }
 
        return false;