From: Mario Date: Wed, 28 Aug 2019 17:15:48 +0000 (+0000) Subject: Merge branch 'martin-t/blaster' into 'master' X-Git-Tag: xonotic-v0.8.5~1359 X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=commitdiff_plain;h=99262bf5759010457a3331ec08e985c3924a2b3f;hp=a12365406857ab5eb02b066e29b7c4587dc2da83 Merge branch 'martin-t/blaster' into 'master' Restore blaster push See merge request xonotic/xonotic-data.pk3dir!701 --- diff --git a/crosshairs.cfg b/crosshairs.cfg index 8e7bc9b4f7..82758fa702 100644 --- a/crosshairs.cfg +++ b/crosshairs.cfg @@ -48,6 +48,10 @@ seta crosshair_per_weapon 1 "when 1, each gun will display a different crosshair // side-scrolling crosshair seta crosshair_2d 54 "selects crosshair to use in side-scrolling mode (\"\" uses regular crosshair and 0 is none)" +// third person chase-camera crosshair +seta crosshair_chase 1 "adjust the crosshair while in third person mode to where the shot will actually hit" +seta crosshair_chase_playeralpha 0.25 "opacity of the player while they obstruct the view when crosshair_chase is enabled, can be a value between 0 and 1" + // ========================= // Crosshair ring settings diff --git a/gamemodes-server.cfg b/gamemodes-server.cfg index 7dd231fe60..d38cee893a 100644 --- a/gamemodes-server.cfg +++ b/gamemodes-server.cfg @@ -226,6 +226,7 @@ set g_ca_round_timelimit 180 "round time limit in seconds" seta g_ca_teams_override 0 set g_ca_team_spawns 0 "when 1, players spawn from the team spawnpoints of the map, if any" set g_ca_teams 0 +set g_ca_weaponarena "most" "starting weapons - takes the same options as g_weaponarena" // ================== @@ -370,6 +371,7 @@ set g_freezetag_frozen_maxtime 60 "frozen players will be automatically unfrozen seta g_freezetag_teams_override 0 set g_freezetag_team_spawns 0 "when 1, players spawn from the team spawnpoints of the map, if any" set g_freezetag_teams 0 +set g_freezetag_weaponarena "most_available" "starting weapons - takes the same options as g_weaponarena" // ========== @@ -433,6 +435,7 @@ set g_lms_extra_lives 0 set g_lms_regenerate 0 set g_lms_last_join 3 "if g_lms_join_anytime is false, new players can only join if the worst active player has more than (fraglimit - g_lms_last_join) lives" set g_lms_join_anytime 1 "if true, new players can join, but get same amount of lives as the worst player" +set g_lms_weaponarena "most_available" "starting weapons - takes the same options as g_weaponarena" // ========= diff --git a/qcsrc/client/autocvars.qh b/qcsrc/client/autocvars.qh index c372be250b..a151c0c403 100644 --- a/qcsrc/client/autocvars.qh +++ b/qcsrc/client/autocvars.qh @@ -150,6 +150,8 @@ bool autocvar_crosshair_ring_reload; float autocvar_crosshair_ring_reload_alpha; float autocvar_crosshair_ring_reload_size; float autocvar_crosshair_size; +bool autocvar_crosshair_chase = true; +float crosshair_chase_playeralpha = 0.25; int autocvar_ekg; float autocvar_fov; bool autocvar_hud_cursormode = true; diff --git a/qcsrc/client/view.qc b/qcsrc/client/view.qc index 7385b4c3a9..b1593cf3a2 100644 --- a/qcsrc/client/view.qc +++ b/qcsrc/client/view.qc @@ -291,6 +291,7 @@ void viewmodel_draw(entity this) return; int mask = (intermission || (STAT(HEALTH) <= 0) || autocvar_chase_active) ? 0 : MASK_NORMAL; float a = ((autocvar_cl_viewmodel_alpha) ? bound(-1, autocvar_cl_viewmodel_alpha, this.m_alpha) : this.m_alpha); + int wepskin = this.m_skin; bool invehicle = player_localentnum > maxclients; if (invehicle) a = -1; Weapon wep = this.activeweapon; @@ -304,6 +305,7 @@ void viewmodel_draw(entity this) { e.drawmask = mask; e.alpha = a; + e.skin = wepskin; e.colormap = 256 + c; // colormap == 0 is black, c == 0 is white e.glowmod = g; e.csqcmodel_effects = fx; @@ -972,6 +974,20 @@ void HUD_Crosshair(entity this) // wcross_origin = '0.5 0 0' * vid_conwidth + '0 0.5 0' * vid_conheight; if(csqcplayer.viewloc && (csqcplayer.viewloc.spawnflags & VIEWLOC_FREEAIM)) wcross_origin = viewloc_mousepos; + else if(autocvar_chase_active > 0 && autocvar_crosshair_chase) + { + vector player_org = ((csqcplayer) ? csqcplayer.origin + csqcplayer.view_ofs : view_origin); + if(csqcplayer && crosshair_chase_playeralpha && crosshair_chase_playeralpha < 1) + { + traceline(view_origin, view_origin + max_shot_distance * view_forward, MOVE_NORMAL, NULL); + if(trace_ent == csqcplayer) + csqcplayer.alpha = crosshair_chase_playeralpha; + else + csqcplayer.alpha = csqcplayer.m_alpha; + } + traceline(player_org, player_org + max_shot_distance * view_forward, MOVE_WORLDONLY, NULL); + wcross_origin = project_3d_to_2d(trace_endpos); + } else wcross_origin = project_3d_to_2d(view_origin + max_shot_distance * view_forward); wcross_origin.z = 0; diff --git a/qcsrc/common/csqcmodel_settings.qh b/qcsrc/common/csqcmodel_settings.qh index 7c5a218b21..96836a38e2 100644 --- a/qcsrc/common/csqcmodel_settings.qh +++ b/qcsrc/common/csqcmodel_settings.qh @@ -18,12 +18,17 @@ # define TAG_VIEWLOC_NAME tag_networkviewloc # define TAG_VIEWLOC_TYPE int .float tag_networkviewloc; + +# define ALPHA m_alpha +.float m_alpha; #else # define TAG_ENTITY_NAME tag_entity # define TAG_ENTITY_TYPE entity # define TAG_VIEWLOC_NAME viewloc # define TAG_VIEWLOC_TYPE entity + +# define ALPHA alpha #endif // add properties you want networked to CSQC here @@ -31,7 +36,7 @@ CSQCMODEL_PROPERTY(BIT(0), int, ReadShort, WriteShort, colormap) \ CSQCMODEL_PROPERTY(BIT(1), int, ReadInt24_t, WriteInt24_t, effects) \ CSQCMODEL_PROPERTY(BIT(2), int, ReadByte, WriteByte, modelflags) \ - CSQCMODEL_PROPERTY_SCALED(BIT(3), float, ReadByte, WriteByte, alpha, 254, -1, 254) \ + CSQCMODEL_PROPERTY_SCALED(BIT(3), float, ReadByte, WriteByte, ALPHA, 254, -1, 254) \ CSQCMODEL_PROPERTY(BIT(4), int, ReadByte, WriteByte, skin) \ CSQCMODEL_PROPERTY(BIT(5), float, ReadApproxPastTime, WriteApproxPastTime, death_time) \ CSQCMODEL_PROPERTY(BIT(6), float, ReadByte, WriteByte, solid) \ diff --git a/qcsrc/common/gamemodes/gamemode/clanarena/sv_clanarena.qc b/qcsrc/common/gamemodes/gamemode/clanarena/sv_clanarena.qc index cf2821844a..4721cb3801 100644 --- a/qcsrc/common/gamemodes/gamemode/clanarena/sv_clanarena.qc +++ b/qcsrc/common/gamemodes/gamemode/clanarena/sv_clanarena.qc @@ -483,11 +483,6 @@ MUTATOR_HOOKFUNCTION(ca, ClientCommand_Spectate) return MUT_SPECCMD_CONTINUE; } -MUTATOR_HOOKFUNCTION(ca, WantWeapon) -{ - M_ARGV(2, bool) = true; // all weapons -} - MUTATOR_HOOKFUNCTION(ca, HideTeamNagger) { return true; // doesn't work well with the whole spectator as player thing @@ -502,8 +497,8 @@ MUTATOR_HOOKFUNCTION(ca, GetPlayerStatus) MUTATOR_HOOKFUNCTION(ca, SetWeaponArena) { - // most weapons arena - if (M_ARGV(0, string) == "0" || M_ARGV(0, string) == "") M_ARGV(0, string) = "most"; + if (M_ARGV(0, string) == "0" || M_ARGV(0, string) == "") + M_ARGV(0, string) = autocvar_g_ca_weaponarena; } MUTATOR_HOOKFUNCTION(ca, SV_ParseServerCommand) diff --git a/qcsrc/common/gamemodes/gamemode/clanarena/sv_clanarena.qh b/qcsrc/common/gamemodes/gamemode/clanarena/sv_clanarena.qh index e383687fcf..f6420b8526 100644 --- a/qcsrc/common/gamemodes/gamemode/clanarena/sv_clanarena.qh +++ b/qcsrc/common/gamemodes/gamemode/clanarena/sv_clanarena.qh @@ -12,6 +12,7 @@ bool autocvar_g_ca_team_spawns; //int autocvar_g_ca_teams; int autocvar_g_ca_teams_override; float autocvar_g_ca_warmup; +string autocvar_g_ca_weaponarena = "most"; int ca_teams; diff --git a/qcsrc/common/gamemodes/gamemode/freezetag/sv_freezetag.qc b/qcsrc/common/gamemodes/gamemode/freezetag/sv_freezetag.qc index 0f37cf1e8f..b1feaa9917 100644 --- a/qcsrc/common/gamemodes/gamemode/freezetag/sv_freezetag.qc +++ b/qcsrc/common/gamemodes/gamemode/freezetag/sv_freezetag.qc @@ -587,9 +587,8 @@ MUTATOR_HOOKFUNCTION(ft, TeamBalance_CheckAllowedTeams, CBC_ORDER_EXCLUSIVE) MUTATOR_HOOKFUNCTION(ft, SetWeaponArena) { - // most weapons arena if(M_ARGV(0, string) == "0" || M_ARGV(0, string) == "") - M_ARGV(0, string) = "most"; + M_ARGV(0, string) = autocvar_g_freezetag_weaponarena; } MUTATOR_HOOKFUNCTION(ft, FragCenterMessage) diff --git a/qcsrc/common/gamemodes/gamemode/freezetag/sv_freezetag.qh b/qcsrc/common/gamemodes/gamemode/freezetag/sv_freezetag.qh index df138a93d8..3eb753020b 100644 --- a/qcsrc/common/gamemodes/gamemode/freezetag/sv_freezetag.qh +++ b/qcsrc/common/gamemodes/gamemode/freezetag/sv_freezetag.qh @@ -6,6 +6,8 @@ int autocvar_g_freezetag_point_limit; int autocvar_g_freezetag_point_leadlimit; bool autocvar_g_freezetag_team_spawns; +string autocvar_g_freezetag_weaponarena = "most_available"; + void freezetag_Initialize(); REGISTER_MUTATOR(ft, false) diff --git a/qcsrc/common/gamemodes/gamemode/lms/sv_lms.qc b/qcsrc/common/gamemodes/gamemode/lms/sv_lms.qc index 6d420c7a95..bd6401d172 100644 --- a/qcsrc/common/gamemodes/gamemode/lms/sv_lms.qc +++ b/qcsrc/common/gamemodes/gamemode/lms/sv_lms.qc @@ -429,9 +429,10 @@ MUTATOR_HOOKFUNCTION(lms, CheckRules_World) return true; } -MUTATOR_HOOKFUNCTION(lms, WantWeapon) +MUTATOR_HOOKFUNCTION(lms, SetWeaponArena) { - M_ARGV(2, bool) = true; // all weapons + if(M_ARGV(0, string) == "0" || M_ARGV(0, string) == "") + M_ARGV(0, string) = autocvar_g_lms_weaponarena; } MUTATOR_HOOKFUNCTION(lms, GetPlayerStatus) diff --git a/qcsrc/common/gamemodes/gamemode/lms/sv_lms.qh b/qcsrc/common/gamemodes/gamemode/lms/sv_lms.qh index 256620a454..996d371fe0 100644 --- a/qcsrc/common/gamemodes/gamemode/lms/sv_lms.qh +++ b/qcsrc/common/gamemodes/gamemode/lms/sv_lms.qh @@ -2,8 +2,12 @@ #include #include + .float lms_spectate_warning; + #define autocvar_g_lms_lives_override cvar("g_lms_lives_override") +string autocvar_g_lms_weaponarena = "most_available"; + void lms_Initialize(); REGISTER_MUTATOR(lms, false) diff --git a/qcsrc/common/gamemodes/gamemode/nexball/weapon.qh b/qcsrc/common/gamemodes/gamemode/nexball/weapon.qh index 1e3127eb5f..ccabc47a51 100644 --- a/qcsrc/common/gamemodes/gamemode/nexball/weapon.qh +++ b/qcsrc/common/gamemodes/gamemode/nexball/weapon.qh @@ -1,7 +1,7 @@ #pragma once CLASS(BallStealer, PortoLaunch) -/* flags */ ATTRIB(BallStealer, spawnflags, int, WEP_TYPE_OTHER | WEP_FLAG_SPECIALATTACK | WEP_FLAG_MUTATORBLOCKED | WEP_FLAG_NOTRUEAIM); +/* flags */ ATTRIB(BallStealer, spawnflags, int, WEP_TYPE_OTHER | WEP_FLAG_MUTATORBLOCKED | WEP_FLAG_NOTRUEAIM); /* impulse */ ATTRIB(BallStealer, impulse, int, 0); /* refname */ ATTRIB(BallStealer, netname, string, "ballstealer"); /* wepname */ ATTRIB(BallStealer, m_name, string, _("Ball Stealer")); diff --git a/qcsrc/common/stats.qh b/qcsrc/common/stats.qh index e35115d3e5..9fc79cdc98 100644 --- a/qcsrc/common/stats.qh +++ b/qcsrc/common/stats.qh @@ -43,8 +43,12 @@ const int MAX_CL_STATS = 256; #endif #ifdef SVQC +/// all the weapons actually spawned in the map, does not include filtered items vector weaponsInMap; +/// all the weapons placed by the mapper (weaponreplace applied), ignores most filters +vector weaponsInMapAll; #endif + REGISTER_STAT(WEAPONS, vectori) REGISTER_STAT(WEAPONSINMAP, vectori, weaponsInMap) diff --git a/qcsrc/common/wepent.qc b/qcsrc/common/wepent.qc index 9193c4ef16..38ef3bd1f7 100644 --- a/qcsrc/common/wepent.qc +++ b/qcsrc/common/wepent.qc @@ -73,6 +73,10 @@ MACRO_END PROP(false, clip_size, WEPENT_SET_NORMAL, \ { WriteShort(chan, this.clip_size); }, \ { (viewmodels[this.m_wepent_slot]).clip_size = ReadShort(); }) \ + \ + PROP(false, skin, WEPENT_SET_NORMAL, \ + { WriteShort(chan, this.skin); }, \ + { (viewmodels[this.m_wepent_slot]).m_skin = ReadShort(); }) \ \ /**/ diff --git a/qcsrc/common/wepent.qh b/qcsrc/common/wepent.qh index 556f58194f..6d7128c33c 100644 --- a/qcsrc/common/wepent.qh +++ b/qcsrc/common/wepent.qh @@ -37,6 +37,8 @@ REGISTER_NET_TEMP(CLIENT_WEPENT) .float m_alpha; + .int m_skin; + // only for Porto .bool angles_held_status; .vector angles_held; diff --git a/qcsrc/lib/csqcmodel/cl_model.qc b/qcsrc/lib/csqcmodel/cl_model.qc index 12be0dbaa4..ccf6751171 100644 --- a/qcsrc/lib/csqcmodel/cl_model.qc +++ b/qcsrc/lib/csqcmodel/cl_model.qc @@ -277,6 +277,9 @@ NET_HANDLE(ENT_CLIENT_MODEL, bool isnew) this.csqcmodel_teleported = 1; } + if(sf & BIT(3)) + this.alpha = this.m_alpha; + if(sf & BIT(14)) viewloc_SetTags(this); diff --git a/qcsrc/lib/csqcmodel/cl_model.qh b/qcsrc/lib/csqcmodel/cl_model.qh index b5d9f8bd36..6211868445 100644 --- a/qcsrc/lib/csqcmodel/cl_model.qh +++ b/qcsrc/lib/csqcmodel/cl_model.qh @@ -27,7 +27,8 @@ #define CSQCMODEL_ENDIF #define CSQCMODEL_PROPERTY(flag,t,r,w,f) \ .t f; -#define CSQCMODEL_PROPERTY_SCALED(flag,t,r,w,f,s,mi,ma) CSQCMODEL_PROPERTY(flag,t,r,w,f) +#define CSQCMODEL_PROPERTY_SCALED(flag,t,r,w,f,s,mi,ma) \ + .t f; ALLPROPERTIES #undef CSQCMODEL_PROPERTY_SCALED #undef CSQCMODEL_PROPERTY diff --git a/qcsrc/lib/csqcmodel/sv_model.qc b/qcsrc/lib/csqcmodel/sv_model.qc index 584bfc23ff..70e2c1a15e 100644 --- a/qcsrc/lib/csqcmodel/sv_model.qc +++ b/qcsrc/lib/csqcmodel/sv_model.qc @@ -48,7 +48,11 @@ bool CSQCModel_Send(entity this, entity to, int sf) { \ w(MSG_ENTITY, this.csqcmodel_##f); \ } -#define CSQCMODEL_PROPERTY_SCALED(flag,t,r,w,f,s,mi,ma) CSQCMODEL_PROPERTY(flag,t,r,w,f) +#define CSQCMODEL_PROPERTY_SCALED(flag,t,r,w,f,s,mi,ma) \ + if(sf & flag) \ + { \ + w(MSG_ENTITY, this.csqcmodel_##f); \ + } ALLPROPERTIES #undef CSQCMODEL_PROPERTY_SCALED #undef CSQCMODEL_PROPERTY diff --git a/qcsrc/lib/csqcmodel/sv_model.qh b/qcsrc/lib/csqcmodel/sv_model.qh index e963f12a1b..f70ecea888 100644 --- a/qcsrc/lib/csqcmodel/sv_model.qh +++ b/qcsrc/lib/csqcmodel/sv_model.qh @@ -34,7 +34,9 @@ void CSQCModel_UnlinkEntity(entity e); #define CSQCMODEL_PROPERTY(flag,t,r,w,f) \ .t f; \ .t csqcmodel_##f; -#define CSQCMODEL_PROPERTY_SCALED(flag,t,r,w,f,s,mi,ma) CSQCMODEL_PROPERTY(flag,t,r,w,f) +#define CSQCMODEL_PROPERTY_SCALED(flag,t,r,w,f,s,mi,ma) \ + .t f; \ + .t csqcmodel_##f; ALLPROPERTIES #undef CSQCMODEL_PROPERTY_SCALED #undef CSQCMODEL_PROPERTY diff --git a/qcsrc/server/defs.qh b/qcsrc/server/defs.qh index b52649a34e..b45e20986a 100644 --- a/qcsrc/server/defs.qh +++ b/qcsrc/server/defs.qh @@ -190,9 +190,6 @@ string W_Apply_Weaponreplace(string in); void FixIntermissionClient(entity e); void FixClientCvars(entity e); -// WEAPONTODO: remove this -//WepSet weaponsInMap; - .float respawn_countdown; // next number to count float bot_waypoints_for_items; diff --git a/qcsrc/server/g_world.qc b/qcsrc/server/g_world.qc index 2c5b9dea32..d33ba6e2b6 100644 --- a/qcsrc/server/g_world.qc +++ b/qcsrc/server/g_world.qc @@ -283,6 +283,7 @@ void cvar_changes_init() BADCVAR("g_race_qualifying_timelimit"); BADCVAR("g_race_qualifying_timelimit_override"); BADCVAR("g_runematch"); + BADCVAR("g_shootfromeye"); BADCVAR("g_snafu"); BADCVAR("g_tdm"); BADCVAR("g_tdm_teams"); @@ -475,6 +476,12 @@ void cvar_changes_init() BADCVAR("g_grappling_hook"); BADCVAR("g_jetpack"); + // temporary for testing + // TODO remove before 0.8.3 release + BADCVAR("g_ca_weaponarena"); + BADCVAR("g_freezetag_weaponarena"); + BADCVAR("g_lms_weaponarena"); + #undef BADPRESUFFIX #undef BADPREFIX #undef BADCVAR diff --git a/qcsrc/server/miscfunctions.qc b/qcsrc/server/miscfunctions.qc index 854e39781f..a59f4afa23 100644 --- a/qcsrc/server/miscfunctions.qc +++ b/qcsrc/server/miscfunctions.qc @@ -487,13 +487,12 @@ string playername(entity p, bool team_colorize) return p.netname; } -float want_weapon(entity weaponinfo, float allguns) // WEAPONTODO: what still needs done? +float want_weapon(entity weaponinfo, float allguns) { - int i = weaponinfo.m_id; int d = 0; bool allow_mutatorblocked = false; - if(!i) + if(!weaponinfo.m_id) return 0; bool mutator_returnvalue = MUTATOR_CALLHOOK(WantWeapon, weaponinfo, d, allguns, allow_mutatorblocked); @@ -511,7 +510,7 @@ float want_weapon(entity weaponinfo, float allguns) // WEAPONTODO: what still ne float t = weaponinfo.weaponstartoverride; - //print(strcat("want_weapon: ", weaponinfo.netname, " - d: ", ftos(d), ", t: ", ftos(t), ". \n")); + //LOG_INFOF("want_weapon: %s - d: %d t: %d\n", weaponinfo.netname, d, t); // bit order in t: // 1: want or not @@ -525,10 +524,90 @@ float want_weapon(entity weaponinfo, float allguns) // WEAPONTODO: what still ne return t; } +/// Weapons the player normally starts with outside weapon arena. +WepSet weapons_start() +{ + WepSet ret = '0 0 0'; + FOREACH(Weapons, it != WEP_Null, { + int w = want_weapon(it, false); + if (w & 1) + ret |= it.m_wepset; + }); + return ret; +} + +WepSet weapons_all() +{ + WepSet ret = '0 0 0'; + FOREACH(Weapons, it != WEP_Null, { + if (!(it.spawnflags & (WEP_FLAG_MUTATORBLOCKED | WEP_FLAG_SPECIALATTACK))) + ret |= it.m_wepset; + }); + return ret; +} + +WepSet weapons_devall() +{ + WepSet ret = '0 0 0'; + FOREACH(Weapons, it != WEP_Null, + { + ret |= it.m_wepset; + }); + return ret; +} + +WepSet weapons_most() +{ + WepSet ret = '0 0 0'; + FOREACH(Weapons, it != WEP_Null, { + if ((it.spawnflags & WEP_FLAG_NORMAL) && !(it.spawnflags & (WEP_FLAG_MUTATORBLOCKED | WEP_FLAG_HIDDEN | WEP_FLAG_SPECIALATTACK))) + ret |= it.m_wepset; + }); + return ret; +} + +void weaponarena_available_all_update(entity this) +{ + if (weaponsInMapAll) + { + start_weapons = warmup_start_weapons = g_weaponarena_weapons = weapons_start() | (weaponsInMapAll & weapons_all()); + } + else + { + // if no weapons are available on the map, just fall back to all weapons arena + start_weapons = warmup_start_weapons = g_weaponarena_weapons = weapons_all(); + } +} + +void weaponarena_available_devall_update(entity this) +{ + if (weaponsInMapAll) + { + start_weapons = warmup_start_weapons = g_weaponarena_weapons = weapons_start() | weaponsInMapAll; + } + else + { + // if no weapons are available on the map, just fall back to devall weapons arena + start_weapons = warmup_start_weapons = g_weaponarena_weapons = weapons_devall(); + } +} + +void weaponarena_available_most_update(entity this) +{ + if (weaponsInMapAll) + { + start_weapons = warmup_start_weapons = g_weaponarena_weapons = weapons_start() | (weaponsInMapAll & weapons_most()); + } + else + { + // if no weapons are available on the map, just fall back to most weapons arena + start_weapons = warmup_start_weapons = g_weaponarena_weapons = weapons_most(); + } +} + void readplayerstartcvars() { float i, t; - string s; // initialize starting values for players start_weapons = '0 0 0'; @@ -550,7 +629,7 @@ void readplayerstartcvars() g_weaponarena = 0; g_weaponarena_weapons = '0 0 0'; - s = cvar_string("g_weaponarena"); + string s = cvar_string("g_weaponarena"); MUTATOR_CALLHOOK(SetWeaponArena, s); s = M_ARGV(0, string); @@ -567,28 +646,43 @@ void readplayerstartcvars() { g_weaponarena = 1; g_weaponarena_list = "All Weapons"; - FOREACH(Weapons, it != WEP_Null, { - if(!(it.spawnflags & (WEP_FLAG_MUTATORBLOCKED | WEP_FLAG_SPECIALATTACK))) - g_weaponarena_weapons |= (it.m_wepset); - }); + g_weaponarena_weapons = weapons_all(); } else if (s == "devall") { g_weaponarena = 1; - g_weaponarena_list = "All Weapons"; // TODO: report as more than just all weapons? - FOREACH(Weapons, it != WEP_Null, - { - g_weaponarena_weapons |= (it.m_wepset); - }); + g_weaponarena_list = "Dev All Weapons"; + g_weaponarena_weapons = weapons_devall(); } else if (s == "most") { g_weaponarena = 1; g_weaponarena_list = "Most Weapons"; - FOREACH(Weapons, it != WEP_Null, { - if ((it.spawnflags & WEP_FLAG_NORMAL) && !(it.spawnflags & (WEP_FLAG_MUTATORBLOCKED | WEP_FLAG_HIDDEN | WEP_FLAG_SPECIALATTACK))) - g_weaponarena_weapons |= (it.m_wepset); - }); + g_weaponarena_weapons = weapons_most(); + } + else if (s == "all_available") + { + g_weaponarena = 1; + g_weaponarena_list = "All Available Weapons"; + + // this needs to run after weaponsInMapAll is initialized + InitializeEntity(NULL, weaponarena_available_all_update, INITPRIO_FINDTARGET); + } + else if (s == "devall_available") + { + g_weaponarena = 1; + g_weaponarena_list = "Dev All Available Weapons"; + + // this needs to run after weaponsInMapAll is initialized + InitializeEntity(NULL, weaponarena_available_devall_update, INITPRIO_FINDTARGET); + } + else if (s == "most_available") + { + g_weaponarena = 1; + g_weaponarena_list = "Most Available Weapons"; + + // this needs to run after weaponsInMapAll is initialized + InitializeEntity(NULL, weaponarena_available_most_update, INITPRIO_FINDTARGET); } else if (s == "none") { @@ -657,56 +751,48 @@ void readplayerstartcvars() start_ammo_plasma = cvar("g_start_ammo_plasma"); start_ammo_fuel = cvar("g_start_ammo_fuel"); random_start_weapons_count = cvar("g_random_start_weapons_count"); - SetResource(random_start_ammo, RES_SHELLS, cvar( - "g_random_start_shells")); - SetResource(random_start_ammo, RES_BULLETS, cvar( - "g_random_start_bullets")); - SetResource(random_start_ammo, RES_ROCKETS, - cvar("g_random_start_rockets")); - SetResource(random_start_ammo, RES_CELLS, cvar( - "g_random_start_cells")); - SetResource(random_start_ammo, RES_PLASMA, cvar( - "g_random_start_plasma")); + SetResource(random_start_ammo, RES_SHELLS, cvar("g_random_start_shells")); + SetResource(random_start_ammo, RES_BULLETS, cvar("g_random_start_bullets")); + SetResource(random_start_ammo, RES_ROCKETS,cvar("g_random_start_rockets")); + SetResource(random_start_ammo, RES_CELLS, cvar("g_random_start_cells")); + SetResource(random_start_ammo, RES_PLASMA, cvar("g_random_start_plasma")); } - if (warmup_stage) + warmup_start_ammo_shells = start_ammo_shells; + warmup_start_ammo_nails = start_ammo_nails; + warmup_start_ammo_rockets = start_ammo_rockets; + warmup_start_ammo_cells = start_ammo_cells; + warmup_start_ammo_plasma = start_ammo_plasma; + warmup_start_ammo_fuel = start_ammo_fuel; + warmup_start_health = start_health; + warmup_start_armorvalue = start_armorvalue; + warmup_start_weapons = start_weapons; + warmup_start_weapons_default = start_weapons_default; + warmup_start_weapons_defaultmask = start_weapons_defaultmask; + + if (!g_weaponarena) { - warmup_start_ammo_shells = start_ammo_shells; - warmup_start_ammo_nails = start_ammo_nails; - warmup_start_ammo_rockets = start_ammo_rockets; - warmup_start_ammo_cells = start_ammo_cells; - warmup_start_ammo_plasma = start_ammo_plasma; - warmup_start_ammo_fuel = start_ammo_fuel; - warmup_start_health = start_health; - warmup_start_armorvalue = start_armorvalue; - warmup_start_weapons = start_weapons; - warmup_start_weapons_default = start_weapons_default; - warmup_start_weapons_defaultmask = start_weapons_defaultmask; - - if (!g_weaponarena && !g_ca && !g_freezetag) - { - warmup_start_ammo_shells = cvar("g_warmup_start_ammo_shells"); - warmup_start_ammo_nails = cvar("g_warmup_start_ammo_nails"); - warmup_start_ammo_rockets = cvar("g_warmup_start_ammo_rockets"); - warmup_start_ammo_cells = cvar("g_warmup_start_ammo_cells"); - warmup_start_ammo_plasma = cvar("g_warmup_start_ammo_plasma"); - warmup_start_ammo_fuel = cvar("g_warmup_start_ammo_fuel"); - warmup_start_health = cvar("g_warmup_start_health"); - warmup_start_armorvalue = cvar("g_warmup_start_armor"); - warmup_start_weapons = '0 0 0'; - warmup_start_weapons_default = '0 0 0'; - warmup_start_weapons_defaultmask = '0 0 0'; - FOREACH(Weapons, it != WEP_Null, { - int w = want_weapon(it, g_warmup_allguns); - WepSet s = (it.m_wepset); - if(w & 1) - warmup_start_weapons |= s; - if(w & 2) - warmup_start_weapons_default |= s; - if(w & 4) - warmup_start_weapons_defaultmask |= s; - }); - } + warmup_start_ammo_shells = cvar("g_warmup_start_ammo_shells"); + warmup_start_ammo_nails = cvar("g_warmup_start_ammo_nails"); + warmup_start_ammo_rockets = cvar("g_warmup_start_ammo_rockets"); + warmup_start_ammo_cells = cvar("g_warmup_start_ammo_cells"); + warmup_start_ammo_plasma = cvar("g_warmup_start_ammo_plasma"); + warmup_start_ammo_fuel = cvar("g_warmup_start_ammo_fuel"); + warmup_start_health = cvar("g_warmup_start_health"); + warmup_start_armorvalue = cvar("g_warmup_start_armor"); + warmup_start_weapons = '0 0 0'; + warmup_start_weapons_default = '0 0 0'; + warmup_start_weapons_defaultmask = '0 0 0'; + FOREACH(Weapons, it != WEP_Null, { + int w = want_weapon(it, g_warmup_allguns); + WepSet s = it.m_wepset; + if(w & 1) + warmup_start_weapons |= s; + if(w & 2) + warmup_start_weapons_default |= s; + if(w & 4) + warmup_start_weapons_defaultmask |= s; + }); } if (g_jetpack) @@ -727,16 +813,16 @@ void readplayerstartcvars() start_ammo_cells = max(0, start_ammo_cells); start_ammo_plasma = max(0, start_ammo_plasma); start_ammo_fuel = max(0, start_ammo_fuel); - SetResource(random_start_ammo, RES_SHELLS, max(0, - GetResource(random_start_ammo, RES_SHELLS))); - SetResource(random_start_ammo, RES_BULLETS, max(0, - GetResource(random_start_ammo, RES_BULLETS))); - SetResource(random_start_ammo, RES_ROCKETS, max(0, - GetResource(random_start_ammo, RES_ROCKETS))); - SetResource(random_start_ammo, RES_CELLS, max(0, - GetResource(random_start_ammo, RES_CELLS))); - SetResource(random_start_ammo, RES_PLASMA, max(0, - GetResource(random_start_ammo, RES_PLASMA))); + SetResource(random_start_ammo, RES_SHELLS, + max(0, GetResource(random_start_ammo, RES_SHELLS))); + SetResource(random_start_ammo, RES_BULLETS, + max(0, GetResource(random_start_ammo, RES_BULLETS))); + SetResource(random_start_ammo, RES_ROCKETS, + max(0, GetResource(random_start_ammo, RES_ROCKETS))); + SetResource(random_start_ammo, RES_CELLS, + max(0, GetResource(random_start_ammo, RES_CELLS))); + SetResource(random_start_ammo, RES_PLASMA, + max(0, GetResource(random_start_ammo, RES_PLASMA))); warmup_start_ammo_shells = max(0, warmup_start_ammo_shells); warmup_start_ammo_nails = max(0, warmup_start_ammo_nails); @@ -751,9 +837,9 @@ void precache_playermodel(string m) float globhandle, i, n; string f; - if(substring(m, -9,5) == "_lod1") + if(substring(m, -9, 5) == "_lod1") return; - if(substring(m, -9,5) == "_lod2") + if(substring(m, -9, 5) == "_lod2") return; precache_model(m); f = strcat(substring(m, 0, -5), "_lod1", substring(m, -4, -1)); diff --git a/qcsrc/server/weapons/spawning.qc b/qcsrc/server/weapons/spawning.qc index ba17d3f1f8..23a3ee67d6 100644 --- a/qcsrc/server/weapons/spawning.qc +++ b/qcsrc/server/weapons/spawning.qc @@ -26,22 +26,21 @@ string W_Apply_Weaponreplace(string in) return out; } -void weapon_defaultspawnfunc(entity this, Weapon e) +void weapon_defaultspawnfunc(entity this, Weapon wpn) { - Weapon wpn = e; - e = wpn = wpn.m_spawnfunc_hookreplace(wpn, this); + wpn = wpn.m_spawnfunc_hookreplace(wpn, this); this.classname = wpn.m_canonical_spawnfunc; if (!Item_IsLoot(this) && !this.m_isreplaced) { - if (e.spawnflags & WEP_FLAG_MUTATORBLOCKED) + if (wpn.spawnflags & WEP_FLAG_MUTATORBLOCKED) { LOG_WARNF("Attempted to spawn a mutator-blocked weapon rejected: prvm_edict server %i", this); startitem_failed = true; return; } - string s = W_Apply_Weaponreplace(e.netname); - MUTATOR_CALLHOOK(SetWeaponreplace, this, e, s); + string s = W_Apply_Weaponreplace(wpn.netname); + MUTATOR_CALLHOOK(SetWeaponreplace, this, wpn, s); s = M_ARGV(2, string); if (s == "") { @@ -79,6 +78,9 @@ void weapon_defaultspawnfunc(entity this, Weapon e) } } + if(!Item_IsLoot(this)) + weaponsInMapAll |= WepSet_FromWeapon(wpn); + if (!Item_IsDefinitionAllowed(wpn.m_pickup)) { delete(this); diff --git a/qcsrc/server/weapons/weaponsystem.qc b/qcsrc/server/weapons/weaponsystem.qc index b75881127a..19ba40aa0b 100644 --- a/qcsrc/server/weapons/weaponsystem.qc +++ b/qcsrc/server/weapons/weaponsystem.qc @@ -163,6 +163,7 @@ void CL_ExteriorWeaponentity_Think(entity this) Weapon wep = this.owner.(weaponentity).m_weapon; if (wep) this.glowmod = weaponentity_glowmod(wep, this.owner, this.owner.clientcolors, this.owner.(weaponentity)); this.colormap = this.owner.colormap; + this.skin = w_ent.skin; CSQCMODEL_AUTOUPDATE(this); } diff --git a/xonotic-server.cfg b/xonotic-server.cfg index d261e262ea..158b32ecd5 100644 --- a/xonotic-server.cfg +++ b/xonotic-server.cfg @@ -195,7 +195,7 @@ set g_pickup_items -1 "if set to 0 all items (health, armor, ammo, weapons...) a set g_pickup_respawntime_scaling_reciprocal 0 "Multiply respawn time by `reciprocal / (p + offset) + linear` where `p` is the current number of players, takes effect with 2 or more players present, `reciprocal` (with `offset` and `linear` set to 0) can be used to achieve a constant number of items spawned *per player*" set g_pickup_respawntime_scaling_offset 0 "Multiply respawn time by `reciprocal / (p + offset) + linear` where `p` is the current number of players, takes effect with 2 or more players present, `offset` offsets the curve left or right - the results are not intuitive and I recommend plotting the respawn time and the number of items per player to see what's happening" set g_pickup_respawntime_scaling_linear 1 "Multiply respawn time by `reciprocal / (p + offset) + linear` where `p` is the current number of players, takes effect with 2 or more players present, `linear` can be used to simply scale the respawn time linearly" -set g_weaponarena "0" "put in a list of weapons to enable a weapon arena mode, or try \"all\" or \"most\"" +set g_weaponarena "0" "put in a list of weapons to enable a weapon arena mode, or try \"all\", \"most\", \"all_available\" or \"most_available\" (available only gives the weapon if the map normally has it as a pickup item)" set g_weaponarena_random "0" "if set to a number, only that weapon count is given on every spawn (randomly)" set g_weaponarena_random_with_blaster "1" "additionally, always provide the blaster in random weapon arena games" set g_spawnpoints_auto_move_out_of_solid 0 "if set to 1 you will see a warning if a spawn point was placed inside a solid"