From: terencehill Date: Thu, 29 Dec 2016 01:59:28 +0000 (+0100) Subject: Merge branch 'master' into terencehill/bot_fix X-Git-Tag: xonotic-v0.8.2~343^2~4 X-Git-Url: https://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=commitdiff_plain;h=228743a67588c5488f678a9d0ead45bf8a50b6c2;hp=66fc0a87a9436d3ae5363d854c509f8a496dceea Merge branch 'master' into terencehill/bot_fix --- diff --git a/qcsrc/client/hud/panel/powerups.qc b/qcsrc/client/hud/panel/powerups.qc index 7c454f9f9..076ce918f 100644 --- a/qcsrc/client/hud/panel/powerups.qc +++ b/qcsrc/client/hud/panel/powerups.qc @@ -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); diff --git a/qcsrc/client/hud/panel/radar.qc b/qcsrc/client/hud/panel/radar.qc index 269d87071..3bc537c8f 100644 --- a/qcsrc/client/hud/panel/radar.qc +++ b/qcsrc/client/hud/panel/radar.qc @@ -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); diff --git a/qcsrc/client/miscfunctions.qh b/qcsrc/client/miscfunctions.qh index 9d792f60c..62de4565e 100644 --- a/qcsrc/client/miscfunctions.qh +++ b/qcsrc/client/miscfunctions.qh @@ -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)) diff --git a/qcsrc/client/teamradar.qc b/qcsrc/client/teamradar.qc index abd700e61..782776eb7 100644 --- a/qcsrc/client/teamradar.qc +++ b/qcsrc/client/teamradar.qc @@ -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; diff --git a/qcsrc/common/ent_cs.qc b/qcsrc/common/ent_cs.qc index 71052bd2b..5a5c6acbe 100644 --- a/qcsrc/common/ent_cs.qc +++ b/qcsrc/common/ent_cs.qc @@ -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); }, \ diff --git a/qcsrc/common/gamemodes/gamemode/onslaught/sv_onslaught.qc b/qcsrc/common/gamemodes/gamemode/onslaught/sv_onslaught.qc index 572611c5d..195a3bd98 100644 --- a/qcsrc/common/gamemodes/gamemode/onslaught/sv_onslaught.qc +++ b/qcsrc/common/gamemodes/gamemode/onslaught/sv_onslaught.qc @@ -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 diff --git a/qcsrc/common/items/all.qh b/qcsrc/common/items/all.qh index d377776cd..dc8cf21c0 100644 --- a/qcsrc/common/items/all.qh +++ b/qcsrc/common/items/all.qh @@ -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)) diff --git a/qcsrc/common/items/inventory.qh b/qcsrc/common/items/inventory.qh index 811f716fb..a022979a7 100644 --- a/qcsrc/common/items/inventory.qh +++ b/qcsrc/common/items/inventory.qh @@ -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) { diff --git a/qcsrc/common/items/item.qh b/qcsrc/common/items/item.qh index bac127059..f3aa0cec2 100644 --- a/qcsrc/common/items/item.qh +++ b/qcsrc/common/items/item.qh @@ -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 diff --git a/qcsrc/common/monsters/sv_monsters.qc b/qcsrc/common/monsters/sv_monsters.qc index b8c3bab21..f0f789af3 100644 --- a/qcsrc/common/monsters/sv_monsters.qc +++ b/qcsrc/common/monsters/sv_monsters.qc @@ -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); diff --git a/qcsrc/common/mutators/mutator/spawn_near_teammate/sv_spawn_near_teammate.qc b/qcsrc/common/mutators/mutator/spawn_near_teammate/sv_spawn_near_teammate.qc index 5f11777c2..a0017f94d 100644 --- a/qcsrc/common/mutators/mutator/spawn_near_teammate/sv_spawn_near_teammate.qc +++ b/qcsrc/common/mutators/mutator/spawn_near_teammate/sv_spawn_near_teammate.qc @@ -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; diff --git a/qcsrc/common/mutators/mutator/waypoints/waypointsprites.qc b/qcsrc/common/mutators/mutator/waypoints/waypointsprites.qc index a26441ee6..bcb317b4a 100644 --- a/qcsrc/common/mutators/mutator/waypoints/waypointsprites.qc +++ b/qcsrc/common/mutators/mutator/waypoints/waypointsprites.qc @@ -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 diff --git a/qcsrc/common/physics/player.qc b/qcsrc/common/physics/player.qc index 264541522..58828c410 100644 --- a/qcsrc/common/physics/player.qc +++ b/qcsrc/common/physics/player.qc @@ -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 } diff --git a/qcsrc/common/stats.qh b/qcsrc/common/stats.qh index b3459a67b..7649954b3 100644 --- a/qcsrc/common/stats.qh +++ b/qcsrc/common/stats.qh @@ -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) diff --git a/qcsrc/common/t_items.qc b/qcsrc/common/t_items.qc index 5faa6dc93..9d89679e3 100644 --- a/qcsrc/common/t_items.qc +++ b/qcsrc/common/t_items.qc @@ -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; diff --git a/qcsrc/common/triggers/trigger/jumppads.qc b/qcsrc/common/triggers/trigger/jumppads.qc index edbe9c580..5a279561d 100644 --- a/qcsrc/common/triggers/trigger/jumppads.qc +++ b/qcsrc/common/triggers/trigger/jumppads.qc @@ -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)); diff --git a/qcsrc/common/turrets/turret/hk_weapon.qc b/qcsrc/common/turrets/turret/hk_weapon.qc index ddad35d02..5a2f05a48 100644 --- a/qcsrc/common/turrets/turret/hk_weapon.qc +++ b/qcsrc/common/turrets/turret/hk_weapon.qc @@ -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; diff --git a/qcsrc/common/vehicles/sv_vehicles.qc b/qcsrc/common/vehicles/sv_vehicles.qc index b165bb3e4..9c8d05ce4 100644 --- a/qcsrc/common/vehicles/sv_vehicles.qc +++ b/qcsrc/common/vehicles/sv_vehicles.qc @@ -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; diff --git a/qcsrc/common/vehicles/vehicle/bumblebee.qc b/qcsrc/common/vehicles/vehicle/bumblebee.qc index 95cc74802..573e46aa7 100644 --- a/qcsrc/common/vehicles/vehicle/bumblebee.qc +++ b/qcsrc/common/vehicles/vehicle/bumblebee.qc @@ -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; diff --git a/qcsrc/common/weapons/weapon/porto.qc b/qcsrc/common/weapons/weapon/porto.qc index 3e4654fcb..b998bc9ee 100644 --- a/qcsrc/common/weapons/weapon/porto.qc +++ b/qcsrc/common/weapons/weapon/porto.qc @@ -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) diff --git a/qcsrc/common/weapons/weapon/shotgun.qc b/qcsrc/common/weapons/weapon/shotgun.qc index 9ae0c6069..d45cf31cb 100644 --- a/qcsrc/common/weapons/weapon/shotgun.qc +++ b/qcsrc/common/weapons/weapon/shotgun.qc @@ -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)) { diff --git a/qcsrc/common/weapons/weapon/vaporizer.qc b/qcsrc/common/weapons/weapon/vaporizer.qc index e11e4d8d5..91042b613 100644 --- a/qcsrc/common/weapons/weapon/vaporizer.qc +++ b/qcsrc/common/weapons/weapon/vaporizer.qc @@ -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) diff --git a/qcsrc/lib/csqcmodel/cl_player.qc b/qcsrc/lib/csqcmodel/cl_player.qc index 66613b532..9e26e70fb 100644 --- a/qcsrc/lib/csqcmodel/cl_player.qc +++ b/qcsrc/lib/csqcmodel/cl_player.qc @@ -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) { diff --git a/qcsrc/lib/vector.qh b/qcsrc/lib/vector.qh index bb363c12e..0a887cfeb 100644 --- a/qcsrc/lib/vector.qh +++ b/qcsrc/lib/vector.qh @@ -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'; diff --git a/qcsrc/menu/xonotic/credits.qc b/qcsrc/menu/xonotic/credits.qc index 816120b07..a28b08638 100644 --- a/qcsrc/menu/xonotic/credits.qc +++ b/qcsrc/menu/xonotic/credits.qc @@ -14,17 +14,21 @@ 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) \ @@ -64,10 +68,10 @@ 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) \ @@ -149,14 +153,24 @@ 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) \ @@ -164,21 +178,26 @@ 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")) \ @@ -187,7 +206,9 @@ 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")) \ @@ -206,12 +227,23 @@ 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() \ @@ -219,12 +251,14 @@ 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) \ @@ -251,6 +285,7 @@ PERSON(marcus256) \ NL() \ FUNCTION(_("Ukrainian")) \ + PERSON(Dmitro "Gamebot" Sokhin) \ PERSON(Oleh "BlaXpirit" Prypin) \ PERSON(Vasyl "Harmata" Melnyk) \ PERSON(Yuriy "herrniemand" Ackermann) \ diff --git a/qcsrc/server/_all.inc b/qcsrc/server/_all.inc index 3359f13b1..95bf71531 100644 --- a/qcsrc/server/_all.inc +++ b/qcsrc/server/_all.inc @@ -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" diff --git a/qcsrc/server/_mod.inc b/qcsrc/server/_mod.inc index 4ecc610c7..eb74529a6 100644 --- a/qcsrc/server/_mod.inc +++ b/qcsrc/server/_mod.inc @@ -30,6 +30,3 @@ #endif #include #include -#include -#include -#include diff --git a/qcsrc/server/_mod.qh b/qcsrc/server/_mod.qh index 8162606c7..a0d160d57 100644 --- a/qcsrc/server/_mod.qh +++ b/qcsrc/server/_mod.qh @@ -30,6 +30,3 @@ #endif #include #include -#include -#include -#include diff --git a/qcsrc/server/bot/default/havocbot/havocbot.qc b/qcsrc/server/bot/default/havocbot/havocbot.qc index af6aa3f2a..d211397d3 100644 --- a/qcsrc/server/bot/default/havocbot/havocbot.qc +++ b/qcsrc/server/bot/default/havocbot/havocbot.qc @@ -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; diff --git a/qcsrc/server/bot/default/navigation.qc b/qcsrc/server/bot/default/navigation.qc index 83077e1d4..4c8982e94 100644 --- a/qcsrc/server/bot/default/navigation.qc +++ b/qcsrc/server/bot/default/navigation.qc @@ -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) { diff --git a/qcsrc/server/bot/default/waypoints.qc b/qcsrc/server/bot/default/waypoints.qc index 0f8999a8d..1e03bf5e1 100644 --- a/qcsrc/server/bot/default/waypoints.qc +++ b/qcsrc/server/bot/default/waypoints.qc @@ -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; diff --git a/qcsrc/server/cheats.qc b/qcsrc/server/cheats.qc index cf8a4569b..3d569222c 100644 --- a/qcsrc/server/cheats.qc +++ b/qcsrc/server/cheats.qc @@ -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)); diff --git a/qcsrc/server/client.qc b/qcsrc/server/client.qc index 9583118ce..d4a3e9feb 100644 --- a/qcsrc/server/client.qc +++ b/qcsrc/server/client.qc @@ -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'; } diff --git a/qcsrc/server/command/getreplies.qc b/qcsrc/server/command/getreplies.qc index 5017e81ab..d01448aad 100644 --- a/qcsrc/server/command/getreplies.qc +++ b/qcsrc/server/command/getreplies.qc @@ -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); } diff --git a/qcsrc/server/command/sv_cmd.qc b/qcsrc/server/command/sv_cmd.qc index 76e913500..55879fd35 100644 --- a/qcsrc/server/command/sv_cmd.qc +++ b/qcsrc/server/command/sv_cmd.qc @@ -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 index 000000000..69d031eaf --- /dev/null +++ b/qcsrc/server/compat/_mod.inc @@ -0,0 +1,5 @@ +// generated file; do not modify +#include +#include +#include +#include diff --git a/qcsrc/server/compat/_mod.qh b/qcsrc/server/compat/_mod.qh new file mode 100644 index 000000000..bd658580e --- /dev/null +++ b/qcsrc/server/compat/_mod.qh @@ -0,0 +1,5 @@ +// generated file; do not modify +#include +#include +#include +#include diff --git a/qcsrc/server/compat/halflife.qc b/qcsrc/server/compat/halflife.qc new file mode 100644 index 000000000..74e50137f --- /dev/null +++ b/qcsrc/server/compat/halflife.qc @@ -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 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/server/compat/halflife.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/server/compat/quake.qc b/qcsrc/server/compat/quake.qc new file mode 100644 index 000000000..539042d63 --- /dev/null +++ b/qcsrc/server/compat/quake.qc @@ -0,0 +1,30 @@ +#include "quake.qh" + +#include + +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 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/server/compat/quake.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/server/compat/quake3.qc b/qcsrc/server/compat/quake3.qc new file mode 100644 index 000000000..1c53de31e --- /dev/null +++ b/qcsrc/server/compat/quake3.qc @@ -0,0 +1,208 @@ +#include "quake3.qh" + +#include + +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 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/server/compat/quake3.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/server/compat/wop.qc b/qcsrc/server/compat/wop.qc new file mode 100644 index 000000000..6d53e18ef --- /dev/null +++ b/qcsrc/server/compat/wop.qc @@ -0,0 +1,62 @@ +#include "wop.qh" + +#include +// #include + +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 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/server/compat/wop.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/server/impulse.qc b/qcsrc/server/impulse.qc index 8a10a6d75..9b36010fe 100644 --- a/qcsrc/server/impulse.qc +++ b/qcsrc/server/impulse.qc @@ -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)) { diff --git a/qcsrc/server/mapvoting.qc b/qcsrc/server/mapvoting.qc index 2ea425692..b5a601446 100644 --- a/qcsrc/server/mapvoting.qc +++ b/qcsrc/server/mapvoting.qc @@ -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]); } } diff --git a/qcsrc/server/miscfunctions.qc b/qcsrc/server/miscfunctions.qc index d2aff2ae7..39c42a556 100644 --- a/qcsrc/server/miscfunctions.qc +++ b/qcsrc/server/miscfunctions.qc @@ -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; diff --git a/qcsrc/server/mutators/mutator/gamemode_ctf.qc b/qcsrc/server/mutators/mutator/gamemode_ctf.qc index 27fd46b88..d1c97bd28 100644 --- a/qcsrc/server/mutators/mutator/gamemode_ctf.qc +++ b/qcsrc/server/mutators/mutator/gamemode_ctf.qc @@ -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 diff --git a/qcsrc/server/mutators/mutator/gamemode_keyhunt.qc b/qcsrc/server/mutators/mutator/gamemode_keyhunt.qc index 2aede9204..5bfbe676e 100644 --- a/qcsrc/server/mutators/mutator/gamemode_keyhunt.qc +++ b/qcsrc/server/mutators/mutator/gamemode_keyhunt.qc @@ -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'); diff --git a/qcsrc/server/portals.qc b/qcsrc/server/portals.qc index 12083e423..1656b1400 100644 --- a/qcsrc/server/portals.qc +++ b/qcsrc/server/portals.qc @@ -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)) diff --git a/qcsrc/server/race.qc b/qcsrc/server/race.qc index 87776d479..a3cbc685f 100644 --- a/qcsrc/server/race.qc +++ b/qcsrc/server/race.qc @@ -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 index 771954245..000000000 --- a/qcsrc/server/t_halflife.qc +++ /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 index 6f70f09be..000000000 --- a/qcsrc/server/t_halflife.qh +++ /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 index 7a277df98..000000000 --- a/qcsrc/server/t_quake.qc +++ /dev/null @@ -1,30 +0,0 @@ -#include "t_quake.qh" - -#include - -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 index 6f70f09be..000000000 --- a/qcsrc/server/t_quake.qh +++ /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 index 85ec325bd..000000000 --- a/qcsrc/server/t_quake3.qc +++ /dev/null @@ -1,208 +0,0 @@ -#include "t_quake3.qh" - -#include - -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 index 6f70f09be..000000000 --- a/qcsrc/server/t_quake3.qh +++ /dev/null @@ -1 +0,0 @@ -#pragma once diff --git a/qcsrc/server/weapons/weaponsystem.qc b/qcsrc/server/weapons/weaponsystem.qc index 7dbdae683..ad479824e 100644 --- a/qcsrc/server/weapons/weaponsystem.qc +++ b/qcsrc/server/weapons/weaponsystem.qc @@ -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; }