Resolve conflicts 1: Merge commit 'c58baab5' into bones_was_here/q3compat
authorbones_was_here <bones_was_here@xa.org.au>
Sun, 11 Jul 2021 10:21:33 +0000 (20:21 +1000)
committerbones_was_here <bones_was_here@xa.org.au>
Sun, 11 Jul 2021 10:21:33 +0000 (20:21 +1000)
19 files changed:
1  2 
qcsrc/common/items/item.qh
qcsrc/common/mutators/mutator/buffs/all.inc
qcsrc/common/mutators/mutator/buffs/buffs.qh
qcsrc/common/mutators/mutator/buffs/sv_buffs.qc
qcsrc/common/mutators/mutator/buffs/sv_buffs.qh
qcsrc/common/stats.qh
qcsrc/common/weapons/all.qc
qcsrc/lib/spawnfunc.qh
qcsrc/lib/warpzone/common.qc
qcsrc/server/client.qc
qcsrc/server/compat/quake3.qc
qcsrc/server/items/items.qc
qcsrc/server/items/items.qh
qcsrc/server/main.qc
qcsrc/server/race.qc
qcsrc/server/teamplay.qc
qcsrc/server/teamplay.qh
qcsrc/server/world.qc
xonotic-server.cfg

index 10c1bbc99d2e64358f493d82f6c8a7f55ecfaede,8f651ad049bb19fd8d44591af923f9bbbc95357c..5873c5831847961616cf40ed4dbcc1093f0e28a7
@@@ -63,11 -63,10 +63,12 @@@ const int ITS_GLOW              = BIT(6
  #ifdef SVQC
  .float strength_finished; // NOTE: this field is used only by map entities, it does not directly apply the strength stat
  .float invincible_finished; // ditto
+ .float buffs_finished; // ditts
  
 -#define spawnfunc_body(item) \
 -      if (!Item_IsDefinitionAllowed(item)) \
 +#define SPAWNFUNC_BODY(item) \
 +      if (item && Item_IsDefinitionAllowed(item)) \
 +              StartItem(this, item); \
 +      else \
        { \
                startitem_failed = true; \
                delete(this); \
index f88cda3a24d229ac7902be9cae9f632ef77487ea,5b93fa79595a78fab9e741b81ce1408873d65031..14a8ea01d0f5aced3625820ae4891e9131557289
@@@ -48,9 -47,8 +47,9 @@@ STATIC_INIT(REGISTER_BUFFS) 
        void buff_Init(entity ent);
        void buff_Init_Compat(entity ent, entity replacement);
        #define BUFF_SPAWNFUNC(e, b, t) spawnfunc(item_buff_##e) { \
-               STAT(BUFFS, this) = b.m_itemid; \
+               this.buffdef = b; \
 -              this.team = t; \
 +              if(teamplay) \
 +                      this.team_forced = t; \
                buff_Init(this); \
        }
        #define BUFF_SPAWNFUNCS(e, b)                       \
index e52ab17592646bb470146eb3bf1be7a04f11b63a,bf680f9a43cb870b8df178fdfb23cdfdfa501d27..2c32b57e421688f56311ae2de16f08325c63c810
@@@ -86,8 -87,8 +87,8 @@@ void buff_Waypoint_Spawn(entity e
  {
        if(autocvar_g_buffs_waypoint_distance <= 0) return;
  
-       entity buff = buff_FirstFromFlags(STAT(BUFFS, e));
+       entity buff = e.buffdef;
 -      entity wp = WaypointSprite_Spawn(WP_Buff, 0, autocvar_g_buffs_waypoint_distance, e, '0 0 1' * e.maxs.z, NULL, e.team, e, buff_waypoint, true, RADARICON_Buff);
 +      entity wp = WaypointSprite_Spawn(WP_Buff, 0, autocvar_g_buffs_waypoint_distance, e, '0 0 1' * e.maxs.z, NULL, e.team_forced, e, buff_waypoint, true, RADARICON_Buff);
        wp.wp_extra = buff.m_id;
        WaypointSprite_UpdateTeamRadar(e.buff_waypoint, RADARICON_Buff, e.glowmod);
        e.buff_waypoint.waypointsprite_visible_for_player = buff_Waypoint_visible_for_player;
@@@ -162,9 -163,10 +163,10 @@@ void buff_Touch(entity this, entity tou
        if(!IS_PLAYER(toucher))
                return; // incase mutator changed toucher
  
 -      if((this.team && DIFF_TEAM(toucher, this))
 +      if((this.team_forced && toucher.team != this.team_forced)
        || (STAT(FROZEN, toucher))
        || (toucher.vehicle)
+       || (!this.buffdef) // TODO: error out or maybe reset type if this occurs?
        || (time < PS(toucher).buff_shield)
        )
        {
@@@ -329,7 -358,7 +358,7 @@@ void buff_Reset(entity this
  bool buff_Customize(entity this, entity client)
  {
        entity player = WaypointSprite_getviewentity(client);
-       if(!this.buff_active || (this.team_forced && player.team != this.team_forced))
 -      if((!this.buff_active || !this.buffdef) || (this.team && DIFF_TEAM(player, this)))
++      if((!this.buff_active || !this.buffdef) || (this.team_forced && player.team != this.team_forced))
        {
                this.alpha = 0.3;
                if(this.effects & EF_FULLBRIGHT) { this.effects &= ~(EF_FULLBRIGHT); }
@@@ -355,9 -384,11 +384,9 @@@ void buff_Init(entity this
  {
        if(!cvar("g_buffs")) { delete(this); return; }
  
-       entity buff = buff_FirstFromFlags(STAT(BUFFS, this));
 -      if(!teamplay && this.team) { this.team = 0; }
 -
+       entity buff = this.buffdef;
  
-       if(!STAT(BUFFS, this) || !buff_Available(buff))
+       if(!buff || !buff_Available(buff))
                buff_NewType(this);
  
        this.classname = "item_buff";
  
  void buff_Init_Compat(entity ent, entity replacement)
  {
 -      if (ent.spawnflags & 2)
 -              ent.team = NUM_TEAM_1;
 -      else if (ent.spawnflags & 4)
 -              ent.team = NUM_TEAM_2;
 +      if (teamplay)
 +      {
 +              if (ent.spawnflags & 2)
 +                      ent.team_forced = NUM_TEAM_1;
 +              else if (ent.spawnflags & 4)
 +                      ent.team_forced = NUM_TEAM_2;
 +      }
  
-       STAT(BUFFS, ent) = replacement.m_itemid;
+       ent.buffdef = replacement;
  
        buff_Init(ent);
  }
index d198898bdceba58b6dcfad23da3b0ced6a1590e4,1b095c0f2c50db47956e4e85ec6034648af1ea04..4eb536b609d00ea4d316ed84ec0fdb6fd8649f4a
@@@ -76,11 -76,11 +76,11 @@@ float autocvar_g_buffs_luck_damagemulti
  .float buff_effect_delay;
  
  // buff definitions
 -.float buff_active;
 +.bool buff_active;
  .float buff_activetime;
 -.float buff_activetime_updated;
 +.bool buff_activetime_updated;
  .entity buff_waypoint;
- .int oldbuffs; // for updating effects
+ .entity oldbuffs; // for updating effects
  .float buff_shield; // delay for players to keep them from spamming buff pickups
  .entity buff_model; // controls effects (TODO: make csqc)
  
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
index 5acd24a58aea87f4e1d660e0ff9cfa73c34e3d59,ae9dbd35760faf0e834f184d5f64d16fcac65d82..d578994968796c6baf86f8cb816c7c7504f74f16
@@@ -200,32 -165,42 +202,32 @@@ void target_give_init(entity this
  {
        IL_EACH(g_items, it.targetname == this.target,
        {
 -              if (it.classname == "weapon_devastator") {
 -                      SetResourceExplicit(this, RES_ROCKETS, GetResource(this, RES_ROCKETS) + it.count * WEP_CVAR_PRI(devastator, ammo)); // WEAPONTODO
 -                      this.netname = cons(this.netname, "devastator");
 -              }
 -              else if (it.classname == "weapon_vortex") {
 -                      SetResourceExplicit(this, RES_CELLS, GetResource(this, RES_CELLS) + it.count * WEP_CVAR_PRI(vortex, ammo)); // WEAPONTODO
 -                      this.netname = cons(this.netname, "vortex");
 -              }
 -              else if (it.classname == "weapon_electro") {
 -                      SetResourceExplicit(this, RES_CELLS, GetResource(this, RES_CELLS) + it.count * WEP_CVAR_PRI(electro, ammo)); // WEAPONTODO
 -                      this.netname = cons(this.netname, "electro");
 -              }
 -              else if (it.classname == "weapon_hagar") {
 -                      SetResourceExplicit(this, RES_ROCKETS, GetResource(this, RES_ROCKETS) + it.count * WEP_CVAR_PRI(hagar, ammo)); // WEAPONTODO
 -                      this.netname = cons(this.netname, "hagar");
 -              }
 -              else if (it.classname == "weapon_crylink") {
 -                      SetResourceExplicit(this, RES_CELLS, GetResource(this, RES_CELLS) + it.count * WEP_CVAR_PRI(crylink, ammo)); // WEAPONTODO
 -                      this.netname = cons(this.netname, "crylink");
 -              }
 -              else if (it.classname == "weapon_mortar") {
 -                      SetResourceExplicit(this, RES_ROCKETS, GetResource(this, RES_ROCKETS) + it.count * WEP_CVAR_PRI(mortar, ammo)); // WEAPONTODO
 -                      this.netname = cons(this.netname, "mortar");
 -              }
 -              else if (it.classname == "weapon_shotgun") {
 -                      SetResourceExplicit(this, RES_SHELLS, GetResource(this, RES_SHELLS) + it.count * WEP_CVAR_PRI(shotgun, ammo)); // WEAPONTODO
 -                      this.netname = cons(this.netname, "shotgun");
 -              }
 -              else if (it.classname == "item_armor_mega")
 -                      SetResourceExplicit(this, RES_ARMOR, 100);
 -              else if (it.classname == "item_health_mega")
 -                      SetResourceExplicit(this, RES_HEALTH, 200);
 -              else if (it.classname == "item_buff") {
 +              if (it.classname == "item_buff")
 +              {
-                       entity buff = buff_FirstFromFlags(STAT(BUFFS, it));
+                       entity buff = it.buffdef;
                        this.netname = cons(this.netname, buff.netname);
-                       STAT(BUFF_TIME, this) += it.count;
 -                      this.buffs_finished = it.count;
++                      this.buffs_finished += it.count;
 +              }
 +              else
 +              {
 +                      if (it.ammo_rockets)
 +                              this.ammo_rockets += it.ammo_rockets;
 +                      else if (it.ammo_cells)
 +                              this.ammo_cells += it.ammo_cells;
 +                      else if (it.ammo_shells)
 +                              this.ammo_shells += it.ammo_shells;
 +                      else if (it.ammo_nails)
 +                              this.ammo_nails += it.ammo_nails;
 +                      else if (it.invincible_finished)
 +                              this.invincible_finished += it.invincible_finished;
 +                      else if (it.strength_finished)
 +                              this.strength_finished += it.strength_finished;
 +                      else if (it.health)
 +                              this.health += it.health;
 +                      else if (it.armorvalue)
 +                              this.armorvalue += it.armorvalue;
 +
 +                      this.netname = cons(this.netname, it.netname);
                }
  
                //remove(it); // removing ents in init functions causes havoc, workaround:
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
index a8c48be15ddceff941391f350df3077ce62bbb6a,5cce9758dfb63dc44e0c798033ffa5aaf51ad965..06787c6ffa06c72ec593b4429560949c99e74996
@@@ -12,10 -12,10 +12,12 @@@ string autocvar_g_forced_team_otherwise
  
  bool lockteams;
  
 +.int team_forced; // can be a team number to force a team, or 0 for default action, or -1 for forced spectator
 +
  // ========================== Global teams API ================================
  
+ void Team_InitTeams();
  /// \brief Returns the global team entity at the given index.
  /// \param[in] index Index of the team.
  /// \return Global team entity at the given index.
Simple merge
Simple merge