From: bones_was_here Date: Sun, 11 Jul 2021 10:21:33 +0000 (+1000) Subject: Resolve conflicts 1: Merge commit 'c58baab5' into bones_was_here/q3compat X-Git-Tag: xonotic-v0.8.5~352^2~12 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=39ff67006e98371c2961166ea52984024d9d3fab;p=xonotic%2Fxonotic-data.pk3dir.git Resolve conflicts 1: Merge commit 'c58baab5' into bones_was_here/q3compat --- 39ff67006e98371c2961166ea52984024d9d3fab diff --cc qcsrc/common/items/item.qh index 10c1bbc99,8f651ad04..5873c5831 --- a/qcsrc/common/items/item.qh +++ b/qcsrc/common/items/item.qh @@@ -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); \ diff --cc qcsrc/common/mutators/mutator/buffs/buffs.qh index f88cda3a2,5b93fa795..14a8ea01d --- a/qcsrc/common/mutators/mutator/buffs/buffs.qh +++ b/qcsrc/common/mutators/mutator/buffs/buffs.qh @@@ -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) \ diff --cc qcsrc/common/mutators/mutator/buffs/sv_buffs.qc index e52ab1759,bf680f9a4..2c32b57e4 --- a/qcsrc/common/mutators/mutator/buffs/sv_buffs.qc +++ b/qcsrc/common/mutators/mutator/buffs/sv_buffs.qc @@@ -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"; @@@ -401,15 -434,12 +432,15 @@@ 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); } diff --cc qcsrc/common/mutators/mutator/buffs/sv_buffs.qh index d198898bd,1b095c0f2..4eb536b60 --- a/qcsrc/common/mutators/mutator/buffs/sv_buffs.qh +++ b/qcsrc/common/mutators/mutator/buffs/sv_buffs.qh @@@ -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) diff --cc qcsrc/server/compat/quake3.qc index 5acd24a58,ae9dbd357..d57899496 --- a/qcsrc/server/compat/quake3.qc +++ b/qcsrc/server/compat/quake3.qc @@@ -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: diff --cc qcsrc/server/teamplay.qh index a8c48be15,5cce9758d..06787c6ff --- a/qcsrc/server/teamplay.qh +++ b/qcsrc/server/teamplay.qh @@@ -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.