- wget -O data/maps/stormkeep.waypoints https://gitlab.com/xonotic/xonotic-maps.pk3dir/raw/master/maps/stormkeep.waypoints
- wget -O data/maps/stormkeep.waypoints.cache https://gitlab.com/xonotic/xonotic-maps.pk3dir/raw/master/maps/stormkeep.waypoints.cache
- make
- - EXPECT=892e447048e051e51f30cff2affc729a
+ - EXPECT=d5bda479d65190330f6ee23c6f9aa5e7
- HASH=$(${ENGINE} -noconfig -nohome +exec serverbench.cfg
| tee /dev/stderr
| grep '^:'
-Thu Dec 19 07:25:06 CET 2019
+Wed Jan 15 07:24:54 CET 2020
seta hud_panel_weapons_ammo_full_rockets 160 "show 100% of the status bar at this ammo count"
seta hud_panel_weapons_ammo_full_fuel 100 "show 100% of the status bar at this ammo count"
seta hud_panel_weapons_hide_ondeath 0 "hide this panel when dead"
+seta hud_panel_weapons_orderbyimpulse "1" "List weapons in their impulse order instead of priority"
seta hud_panel_ammo_maxammo "40" "when you have this much ammo, the ammo status bar is full"
seta hud_panel_ammo_hide_ondeath 0 "hide this panel when dead"
seta hud_panel_weapons_accuracy "" "show accuracy color as the weapon icon background; colors can be configured with accuracy_color* cvars"
seta hud_panel_weapons_ammo "" "show ammo as a status bar"
seta hud_panel_weapons_onlyowned "" "show only owned weapons, set it to 2 to show only the held weapon"
-seta hud_panel_weapons_orderbyimpulse "" "List weapons in their impulse order instead of priority"
seta hud_panel_weapons_noncurrent_alpha "" "alpha of noncurrent weapons"
seta hud_panel_weapons_noncurrent_scale "" "scale of noncurrent weapons, relative to the current weapon"
seta hud_panel_weapons_selection_radius "" "number of weapons that get partially highlighted on each side of the currently selected weapon"
set g_balance_electro_primary_edgedamage 20
set g_balance_electro_primary_force 200
set g_balance_electro_primary_lifetime 5
+set g_balance_electro_primary_midaircombo_enemy 1
set g_balance_electro_primary_midaircombo_explode 1
set g_balance_electro_primary_midaircombo_interval 0.1
+set g_balance_electro_primary_midaircombo_own 1
set g_balance_electro_primary_midaircombo_radius 0
+set g_balance_electro_primary_midaircombo_speed 2000
+set g_balance_electro_primary_midaircombo_teammate 1
set g_balance_electro_primary_radius 100
set g_balance_electro_primary_refire 0.6
set g_balance_electro_primary_speed 2500
set g_balance_electro_primary_edgedamage 0
set g_balance_electro_primary_force 200
set g_balance_electro_primary_lifetime 30
+set g_balance_electro_primary_midaircombo_enemy 1
set g_balance_electro_primary_midaircombo_explode 0
set g_balance_electro_primary_midaircombo_interval 0
+set g_balance_electro_primary_midaircombo_own 1
set g_balance_electro_primary_midaircombo_radius 0
+set g_balance_electro_primary_midaircombo_speed 2000
+set g_balance_electro_primary_midaircombo_teammate 1
set g_balance_electro_primary_radius 150
set g_balance_electro_primary_refire 0.6
set g_balance_electro_primary_speed 2000
set g_balance_electro_primary_edgedamage 20
set g_balance_electro_primary_force 200
set g_balance_electro_primary_lifetime 5
+set g_balance_electro_primary_midaircombo_enemy 1
set g_balance_electro_primary_midaircombo_explode 1
set g_balance_electro_primary_midaircombo_interval 0.1
+set g_balance_electro_primary_midaircombo_own 1
set g_balance_electro_primary_midaircombo_radius 100
+set g_balance_electro_primary_midaircombo_speed 2000
+set g_balance_electro_primary_midaircombo_teammate 1
set g_balance_electro_primary_radius 100
set g_balance_electro_primary_refire 0.6
set g_balance_electro_primary_speed 2500
set g_balance_electro_primary_edgedamage 20
set g_balance_electro_primary_force 200
set g_balance_electro_primary_lifetime 5
+set g_balance_electro_primary_midaircombo_enemy 1
set g_balance_electro_primary_midaircombo_explode 1
set g_balance_electro_primary_midaircombo_interval 0.1
+set g_balance_electro_primary_midaircombo_own 1
set g_balance_electro_primary_midaircombo_radius 0
+set g_balance_electro_primary_midaircombo_speed 2000
+set g_balance_electro_primary_midaircombo_teammate 1
set g_balance_electro_primary_radius 100
set g_balance_electro_primary_refire 0.6
set g_balance_electro_primary_speed 2500
set g_balance_crylink_weaponthrowable 1
// }}}
// {{{ #8: Vortex
-set g_balance_vortex_charge 0
+set g_balance_vortex_charge 1
set g_balance_vortex_charge_always 0
set g_balance_vortex_charge_animlimit 0.5
set g_balance_vortex_charge_limit 1
set g_balance_vortex_primary_ammo 6
set g_balance_vortex_primary_animtime 0.4
set g_balance_vortex_primary_armorpierce 0
-set g_balance_vortex_primary_damage 65
+set g_balance_vortex_primary_damage 80
set g_balance_vortex_primary_damagefalloff_forcehalflife 0
set g_balance_vortex_primary_damagefalloff_halflife 0
set g_balance_vortex_primary_damagefalloff_maxdist 0
set g_balance_electro_primary_edgedamage 20
set g_balance_electro_primary_force 200
set g_balance_electro_primary_lifetime 5
+set g_balance_electro_primary_midaircombo_enemy 1
set g_balance_electro_primary_midaircombo_explode 1
set g_balance_electro_primary_midaircombo_interval 0.1
+set g_balance_electro_primary_midaircombo_own 1
set g_balance_electro_primary_midaircombo_radius 100
+set g_balance_electro_primary_midaircombo_speed 2000
+set g_balance_electro_primary_midaircombo_teammate 1
set g_balance_electro_primary_radius 100
set g_balance_electro_primary_refire 0.6
set g_balance_electro_primary_speed 2500
set g_balance_electro_primary_edgedamage 20
set g_balance_electro_primary_force 200
set g_balance_electro_primary_lifetime 5
+set g_balance_electro_primary_midaircombo_enemy 1
set g_balance_electro_primary_midaircombo_explode 1
set g_balance_electro_primary_midaircombo_interval 0.1
+set g_balance_electro_primary_midaircombo_own 1
set g_balance_electro_primary_midaircombo_radius 0
+set g_balance_electro_primary_midaircombo_speed 2000
+set g_balance_electro_primary_midaircombo_teammate 1
set g_balance_electro_primary_radius 100
set g_balance_electro_primary_refire 0.6
set g_balance_electro_primary_speed 2500
set g_balance_crylink_primary_joinexplode_force 0
set g_balance_crylink_primary_joinexplode_radius 0
set g_balance_crylink_primary_joinspread 0.2
-set g_balance_crylink_primary_linkexplode 0
+set g_balance_crylink_primary_linkexplode 1
set g_balance_crylink_primary_middle_fadetime 5
set g_balance_crylink_primary_middle_lifetime 5
set g_balance_crylink_primary_other_fadetime 5
set g_balance_falldamage_minspeed 900
set g_balance_falldamage_factor 0.20
set g_balance_falldamage_maxdamage 40
+set g_balance_falldamage_onlyvertical 0
set g_balance_damagepush_speedfactor 2.5
set g_balance_contents_damagerate 0.2 // ticrate interval for applying damage with playerdamage/projectiledamage
set g_balance_contents_drowndelay 10 // time under water before a player begins drowning
set g_balance_falldamage_minspeed 1400
set g_balance_falldamage_factor 0.15
set g_balance_falldamage_maxdamage 25
+set g_balance_falldamage_onlyvertical 0
set g_balance_damagepush_speedfactor 0
set g_balance_contents_damagerate 0.2 // ticrate interval for applying damage with playerdamage/projectiledamage
set g_balance_contents_drowndelay 10 // time under water before a player begins drowning
set g_balance_falldamage_minspeed 900
set g_balance_falldamage_factor 0.20
set g_balance_falldamage_maxdamage 40
+set g_balance_falldamage_onlyvertical 0
set g_balance_damagepush_speedfactor 2.5
set g_balance_contents_damagerate 0.2 // ticrate interval for applying damage with playerdamage/projectiledamage
set g_balance_contents_drowndelay 10 // time under water before a player begins drowning
set g_balance_falldamage_minspeed 900
set g_balance_falldamage_factor 0.20
set g_balance_falldamage_maxdamage 40
+set g_balance_falldamage_onlyvertical 0
set g_balance_damagepush_speedfactor 2.5
set g_balance_contents_damagerate 0.2 // ticrate interval for applying damage with playerdamage/projectiledamage
set g_balance_contents_drowndelay 10 // time under water before a player begins drowning
set g_balance_falldamage_minspeed 900
set g_balance_falldamage_factor 0.20
set g_balance_falldamage_maxdamage 40
+set g_balance_falldamage_onlyvertical 0
set g_balance_damagepush_speedfactor 2.5
set g_balance_contents_damagerate 0.2 // ticrate interval for applying damage with playerdamage/projectiledamage
set g_balance_contents_drowndelay 10 // time under water before a player begins drowning
set g_balance_falldamage_minspeed 900
set g_balance_falldamage_factor 0.20
set g_balance_falldamage_maxdamage 40
+set g_balance_falldamage_onlyvertical 0
set g_balance_damagepush_speedfactor 2.5
set g_balance_contents_damagerate 0.2 // ticrate interval for applying damage with playerdamage/projectiledamage
set g_balance_contents_drowndelay 10 // time under water before a player begins drowning
set g_balance_falldamage_minspeed 900
set g_balance_falldamage_factor 0.20
set g_balance_falldamage_maxdamage 40
+set g_balance_falldamage_onlyvertical 0
set g_balance_damagepush_speedfactor 2.5
set g_balance_contents_damagerate 0.2 // ticrate interval for applying damage with playerdamage/projectiledamage
set g_balance_contents_drowndelay 10 // time under water before a player begins drowning
set g_balance_falldamage_minspeed 900
set g_balance_falldamage_factor 0.20
set g_balance_falldamage_maxdamage 40
+set g_balance_falldamage_onlyvertical 0
set g_balance_damagepush_speedfactor 2.5
set g_balance_contents_damagerate 0.2 // ticrate interval for applying damage with playerdamage/projectiledamage
set g_balance_contents_drowndelay 10 // time under water before a player begins drowning
set g_balance_falldamage_minspeed 900
set g_balance_falldamage_factor 0.20
set g_balance_falldamage_maxdamage 40
+set g_balance_falldamage_onlyvertical 0
set g_balance_damagepush_speedfactor 2.5
set g_balance_contents_damagerate 0.2 // ticrate interval for applying damage with playerdamage/projectiledamage
set g_balance_contents_drowndelay 10 // time under water before a player begins drowning
# MasterWord, 2016
# Mensious Mensious <ektoras@tutanota.com>, 2018-2019
# Vindex <kon14.inside@gmail.com>, 2014
-# Γιάννης Ανθυμίδης, 2011-2012
+# Yannis Anthymidis, 2011-2012
msgid ""
msgstr ""
"Project-Id-Version: Xonotic\n"
# adem4ik, 2014
# Alex Talker <alextalker7@gmail.com>, 2014-2015
# Andrei Stepanov, 2014
-# Andrei Stepanov <adem4ik@gmail.com>, 2014-2019
+# Andrei Stepanov <adem4ik@gmail.com>, 2014-2020
# Andrey P <andrey.pyntikov@gmail.com>, 2016
# Artem Vorotnikov <artem@vorotnikov.me>, 2015
# Lord Canistra <lordcanistra@gmail.com>, 2011
"Project-Id-Version: Xonotic\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-05-19 07:23+0200\n"
-"PO-Revision-Date: 2019-11-21 19:30+0000\n"
+"PO-Revision-Date: 2020-01-14 18:19+0000\n"
"Last-Translator: Andrei Stepanov <adem4ik@gmail.com>\n"
"Language-Team: Russian (http://www.transifex.com/team-xonotic/xonotic/"
"language/ru/)\n"
#: qcsrc/client/mapvoting.qc:392
#, c-format
msgid "%d seconds left"
-msgstr "СекÑ\83нд оÑ\81Ñ\82алоÑ\81Ñ\8c: %d"
+msgstr "Ð\9eÑ\81Ñ\82алоÑ\81Ñ\8c Ñ\81екÑ\83нд: %d"
#: qcsrc/client/mapvoting.qc:505
msgid "mv_mapdownload: ^3You're not supposed to use this command on your own!"
// hit testing/tracing for special effects for the crosshair
set g_trueaim_minrange 44 "TrueAim minimum range (TrueAim adjusts shots so they hit the crosshair point even though the gun is not at the screen center)"
-seta crosshair_hittest 1 "do a crosshair hit evaluation, applying effects from the _blur, _scale, and _showipact cvars"
+seta crosshair_hittest 1 "do a crosshair hit evaluation, applying effects from the _blur and _scale cvars"
seta crosshair_hittest_blur 1 "blur the crosshair if the shot is obstructed"
seta crosshair_hittest_scale 1.25 "shrink crosshair if shot is obstructed or aiming at a teammate"
-seta crosshair_hittest_showimpact 0 "move the crosshair to the actual impact location if obstructed"
+seta crosshair_hittest_showimpact 0 "move the crosshair to the actual impact location if obstructed (debug setting, very glitchy!)"
// change color based on special case
seta crosshair_color_special 1 "special color handling for crosshair... 1 = per-weapon crosshair color (see crosshair_per_weapon), 2 = crosshair changes color based on health, 3 = rainbow/random color selection"
r_shadow_shadowmapping 0
r_shadow_usenormalmap 1
r_showsurfaces 0
+r_sky 1
r_subdivisions_tolerance 3
r_texture_dds_load 1
r_water 1
r_shadow_shadowmapping 0
r_shadow_usenormalmap 0
r_showsurfaces 0
+r_sky 1
r_subdivisions_tolerance 8
r_texture_dds_load 1
r_water 0
r_shadow_shadowmapping 0
r_shadow_usenormalmap 0
r_showsurfaces 0
+r_sky 1
r_subdivisions_tolerance 4
r_texture_dds_load 1
r_water 0
r_shadow_shadowmapping 0
r_shadow_usenormalmap 1
r_showsurfaces 0
+r_sky 1
r_subdivisions_tolerance 3
r_texture_dds_load 1
r_water 0
r_shadow_shadowmapping 0
r_shadow_usenormalmap 0
r_showsurfaces 3
+r_sky 0
r_subdivisions_tolerance 16
r_texture_dds_load 1
r_water 0
alias sv_hook_gamestart_ft
alias sv_hook_gamestart_inv
alias sv_hook_gamestart_duel
-alias sv_hook_gamerestart
+// there is currently no hook for when the match is restarted
+// see sv_hook_readyrestart for previous uses of this hook
+//alias sv_hook_gamerestart
alias sv_hook_gameend
set g_ctf_flag_return_damage 0 "allow the flag to be damaged, reducing time needed to automatically return to base"
set g_ctf_flag_return_damage_delay 0 "how much time the flag takes to automatically return to base if it falls into lava/slime/trigger hurt"
set g_ctf_flag_return_when_unreachable 1 "automatically return the flag if it falls into lava/slime/trigger hurt"
+set g_ctf_flag_waypoint 1 "show a waypoint at the flag for easy discovery and directions"
+set g_ctf_flag_waypoint_maxdistance 0 "maximum distance from a flag from which their waypoint is shown, a value of 0 means no limit"
set g_ctf_flagcarrier_auto_helpme_damage 100 "automatically place a helpme notification on flag carrier waypointsprite if they get hit and their health dips below this value"
set g_ctf_flagcarrier_auto_helpme_time 2 "antispam time for the helpme notification"
set g_ctf_flagcarrier_selfdamagefactor 1
seta hud_panel_weapons_timeout_speed_in "0.25"
seta hud_panel_weapons_timeout_speed_out "0.75"
seta hud_panel_weapons_onlyowned "1"
-seta hud_panel_weapons_orderbyimpulse "1"
seta hud_panel_weapons_noncurrent_alpha "0.8"
seta hud_panel_weapons_noncurrent_scale "0.9"
seta hud_panel_weapons_selection_radius "0"
seta hud_panel_weapons_timeout_speed_in "0.25"
seta hud_panel_weapons_timeout_speed_out "0.75"
seta hud_panel_weapons_onlyowned "1"
-seta hud_panel_weapons_orderbyimpulse "1"
seta hud_panel_weapons_noncurrent_alpha "1"
seta hud_panel_weapons_noncurrent_scale "1"
seta hud_panel_weapons_selection_radius "0"
seta hud_panel_weapons_timeout_speed_in "0.25"
seta hud_panel_weapons_timeout_speed_out "0.75"
seta hud_panel_weapons_onlyowned "1"
-seta hud_panel_weapons_orderbyimpulse "1"
seta hud_panel_weapons_noncurrent_alpha "1"
seta hud_panel_weapons_noncurrent_scale "1"
seta hud_panel_weapons_selection_radius "0"
seta hud_panel_weapons_timeout_speed_in "0.25"
seta hud_panel_weapons_timeout_speed_out "0.75"
seta hud_panel_weapons_onlyowned "1"
-seta hud_panel_weapons_orderbyimpulse "1"
seta hud_panel_weapons_noncurrent_alpha "1"
seta hud_panel_weapons_noncurrent_scale "1"
seta hud_panel_weapons_selection_radius "0"
seta hud_panel_weapons_timeout_speed_in "0.25"
seta hud_panel_weapons_timeout_speed_out "0.75"
seta hud_panel_weapons_onlyowned "1"
-seta hud_panel_weapons_orderbyimpulse "1"
seta hud_panel_weapons_noncurrent_alpha "1"
seta hud_panel_weapons_noncurrent_scale "1"
seta hud_panel_weapons_selection_radius "0"
seta hud_panel_weapons_timeout_speed_in "0.25"
seta hud_panel_weapons_timeout_speed_out "0.75"
seta hud_panel_weapons_onlyowned "0"
-seta hud_panel_weapons_orderbyimpulse "1"
seta hud_panel_weapons_noncurrent_alpha "1"
seta hud_panel_weapons_noncurrent_scale "1"
seta hud_panel_weapons_selection_radius "0"
// =========
// dodging
// =========
-set g_dodging 0 "set to 1 to enable dodging in games"
+set g_dodging 0 "set to 1 to enable dodging (quick acceleration in a given direction)"
seta cl_dodging_timeout 0.2 "determines how long apart (in seconds) two taps on the same direction key are considered a dodge. use 0 to disable"
// ===============
// rocket flying
// ===============
-set g_rocket_flying 0 "set to 1 to enable rocket flying in all balance configs"
+set g_rocket_flying 0 "make rocket jumping easier - use the remote_jump weapon cvars for selfdamage and selfpush force"
set g_rocket_flying_disabledelays 1 "disable detonation delays on rockets and mines"
// ================
set g_physical_items 0 "1 uses ODE physics for dropped weapons, 2 for all items, requires physics_ode to be enabled"
set g_physical_items_damageforcescale 3 "how affected physical weapons are by damage"
-set g_physical_items_reset 1 "return map items to their original lotation after being picked up"
+set g_physical_items_reset 1 "return map items to their original location after being picked up"
// ===============
// ===============
set g_touchexplode 0 "touching other players causes an explosion"
set g_touchexplode_radius 50
-set g_touchexplode_damage 10
+set g_touchexplode_damage 20
set g_touchexplode_edgedamage 0
-set g_touchexplode_force 150
+set g_touchexplode_force 300
// ================
// =======
// Nades
// =======
-set g_nades 0 "enable off-hand grenades"
+set g_nades 0 "enable off-hand grenades - use the 'dropweapon' (second press throws) or 'hook' (release throws) binds"
set g_nades_spread 0.04 "random spread offset of throw direction"
set g_nades_throw_offset "0 -25 0" "nade throwing offset"
set g_nades_spawn 1 "give nades right away when player spawns rather than delaying entire refire"
set g_buffs_waypoint_distance 1024 "maximum distance at which buff waypoint can be seen from item"
set g_buffs_pickup_anyway 0 "instantly respawn the buff when it is picked up, instead of waiting for the player to drop it"
set g_buffs_pickup_delay 0.7 "cooldown before player can pick up another buff after dropping one"
-set g_buffs_randomize 1 "randomize buff type when player drops buff"
+set g_buffs_randomize 1 "randomize buff type when player drops the buff, only applies to teamplay gamemodes if g_buffs_randomize_teamplay is enabled"
+set g_buffs_randomize_teamplay 1 "in teamplay gamemodes, randomize buff type when player drops the buff, requires g_buffs_randomize"
set g_buffs_random_lifetime 30 "re-spawn the buff again if it hasn't been touched after this time in seconds"
set g_buffs_random_location 0 "randomize buff location on start and when reset"
set g_buffs_random_location_attempts 10 "number of random locations a single buff will attempt to respawn at before giving up"
// ================
// grappling hook
// ================
-set g_grappling_hook 0 "let players spawn with the grappling hook which allows them to pull themselves up"
+set g_grappling_hook 0 "let players spawn with the grappling hook which allows them to pull themselves"
set g_grappling_hook_useammo 0 "use ammunition with the off-hand grappling hook"
$(eval DAT=$(PROG)-$(VER).dat)
$(eval LNO=$(PROG)-$(VER).lno)
@ echo "http://xonotic.org" > $(TXT)
- @ ln -f $(PROGS_OUT)/$(PROG).dat $(DAT)
- @ ln -f $(PROGS_OUT)/$(PROG).lno $(LNO)
+ @ cp -f $(PROGS_OUT)/$(PROG).dat $(DAT)
+ @ cp -f $(PROGS_OUT)/$(PROG).lno $(LNO)
@ $(RM) *.pk3
$(ZIP) $(PK3) $(TXT) $(DAT) $(LNO)
@ $(RM) $(TXT) $(DAT) $(LNO)
bool autocvar_cl_spawn_event_sound = 1;
// float autocvar_cl_spawn_point_model;
bool autocvar_cl_spawn_point_particles;
-float autocvar_cl_spawn_point_dist_min = 1200;
-float autocvar_cl_spawn_point_dist_max = 1600;
+float autocvar_cl_spawn_point_dist_min = 800;
+float autocvar_cl_spawn_point_dist_max = 1200;
bool autocvar_cl_spawnzoom = 1;
float autocvar_cl_spawnzoom_speed = 1;
float autocvar_cl_spawnzoom_factor = 2;
float autocvar_crosshair_ring_reload_size;
float autocvar_crosshair_size;
bool autocvar_crosshair_chase = true;
-float crosshair_chase_playeralpha = 0.25;
+float autocvar_crosshair_chase_playeralpha = 0.25;
int autocvar_ekg;
float autocvar_fov;
bool autocvar_hud_cursormode = true;
float autocvar_cl_hitsound_max_pitch = 1.5;
float autocvar_cl_hitsound_nom_damage = 25;
float autocvar_cl_hitsound_antispam_time;
-int autocvar_cl_eventchase_spectated_change = 1;
+bool autocvar_cl_eventchase_spectated_change = false;
float autocvar_cl_eventchase_spectated_change_time = 1;
int autocvar_cl_eventchase_death = 1;
float autocvar_cl_eventchase_distance = 140;
float bgmtime;
-string weaponorder_byimpulse; // NOTE: this is a misnomer, weapon order is not always sorted by impulse
-string weaponorder_bypriority;
-bool weapons_orderbyimpulse; // update priority list when toggling this
-
float vortex_charge_movingavg;
int serverflags;
==================
*/
+float lasthud;
+float vh_notice_time;
void HUD_Vehicle()
{
if(autocvar__hud_configure) return;
Vehicle info = Vehicles_from(hud);
info.vr_hud(info);
}
+
+ if(hud != HUD_NORMAL && lasthud == HUD_NORMAL)
+ vh_notice_time = time + autocvar_cl_vehicles_notify_time;
+
+ lasthud = hud;
}
void HUD_Panel_Draw(entity panent)
return false;
}
+float prev_myteam;
void HUD_Main()
{
int i;
else
hud_fade_alpha = 1 - autocvar__menu_alpha;
+ if(myteam != prev_myteam)
+ {
+ myteamcolors = colormapPaletteColor(myteam, 1);
+ FOREACH(hud_panels, true, it.update_time = time);
+ prev_myteam = myteam;
+ }
+
HUD_Configure_Frame();
if(scoreboard_fade_alpha == 1)
QUICKMENU_ENTRY(CTX(_("QMCMD^Shuffle teams")), "vcall shuffleteams")
QUICKMENU_SMENU(CTX(_("QMCMD^Call a vote")), "Call a vote")
+ if(spectatee_status != 0)
+ {
+ QUICKMENU_SMENU_PL(CTX(_("QMCMD^Spectate a player")), "Spectate a player", "spectate \"%s^7\"", 0, 1)
+ }
+
if(target_submenu != "" && !target_submenu_found)
{
LOG_INFOF("Couldn't find submenu \"%s\"", target_submenu);
{
str = strcat(str, sprintf(_("^5%s %s"), ScoreString(teamscores_flags(ts_primary), fl),
(teamscores_label(ts_primary) == "score") ? CTX(_("SCO^points")) :
- (teamscores_label(ts_primary) == "fastest") ? CTX(_("SCO^is beaten")) :
+ (teamscores_label(ts_primary) == "fastest") ? "" :
TranslateScoresLabel(teamscores_label(ts_primary))));
}
else
{
str = strcat(str, sprintf(_("^5%s %s"), ScoreString(scores_flags(ps_primary), fl),
(scores_label(ps_primary) == "score") ? CTX(_("SCO^points")) :
- (scores_label(ps_primary) == "fastest") ? CTX(_("SCO^is beaten")) :
+ (scores_label(ps_primary) == "fastest") ? "" :
TranslateScoresLabel(scores_label(ps_primary))));
}
}
{
str = strcat(str, sprintf(_("^2+%s %s"), ScoreString(teamscores_flags(ts_primary), ll),
(teamscores_label(ts_primary) == "score") ? CTX(_("SCO^points")) :
- (teamscores_label(ts_primary) == "fastest") ? CTX(_("SCO^is beaten")) :
+ (teamscores_label(ts_primary) == "fastest") ? "" :
TranslateScoresLabel(teamscores_label(ts_primary))));
}
else
{
str = strcat(str, sprintf(_("^2+%s %s"), ScoreString(scores_flags(ps_primary), ll),
(scores_label(ps_primary) == "score") ? CTX(_("SCO^points")) :
- (scores_label(ps_primary) == "fastest") ? CTX(_("SCO^is beaten")) :
+ (scores_label(ps_primary) == "fastest") ? "" :
TranslateScoresLabel(scores_label(ps_primary))));
}
}
weapon_size.y = panel_size.y / rows; \
MACRO_END
+string cl_weaponpriority_old;
+bool weapons_orderbyimpulse_old;
void HUD_Weapons()
{
// declarations
// update generic hud functions
HUD_Panel_LoadCvars();
- // figure out weapon order (how the weapons are sorted) // TODO make this configurable
- if(weaponorder_bypriority != autocvar_cl_weaponpriority || autocvar_hud_panel_weapons_orderbyimpulse != weapons_orderbyimpulse || !weaponorder[0])
+ if(cl_weaponpriority_old != autocvar_cl_weaponpriority || weapons_orderbyimpulse_old != autocvar_hud_panel_weapons_orderbyimpulse || weaponorder[0] == NULL)
{
- int weapon_cnt;
- weapons_orderbyimpulse = autocvar_hud_panel_weapons_orderbyimpulse;
- strcpy(weaponorder_bypriority, autocvar_cl_weaponpriority);
- string weporder = W_FixWeaponOrder_ForceComplete(W_NumberWeaponOrder(weaponorder_bypriority));
+ weapons_orderbyimpulse_old = autocvar_hud_panel_weapons_orderbyimpulse;
+ strcpy(cl_weaponpriority_old, autocvar_cl_weaponpriority);
+ string weporder = W_FixWeaponOrder_ForceComplete(W_NumberWeaponOrder(cl_weaponpriority_old));
if(autocvar_hud_panel_weapons_orderbyimpulse)
+ {
weporder = W_FixWeaponOrder_BuildImpulseList(weporder);
- strcpy(weaponorder_byimpulse, weporder);
- weaponorder_cmp_str = strcat(" ", weaponorder_byimpulse, " ");
+ }
+
+ weaponorder_cmp_str = strcat(" ", weporder, " ");
- weapon_cnt = 0;
+ int weapon_cnt = 0;
FOREACH(Weapons, it != WEP_Null && it.impulse >= 0, weaponorder[weapon_cnt++] = it);
for(i = weapon_cnt; i < Weapons_MAX; ++i)
weaponorder[i] = NULL;
bool SetTeam(entity o, int Team)
{
TC(int, Team);
- devassert_once(Team);
+ //devassert_once(Team);
entity tm;
if(teamplay)
{
for(i_t = 0; i_t < n_t; ++i_t)
{
tri = getsurfacetriangle(e, i_s, i_t);
- R_BeginPolygon(tex, 0);
+ R_BeginPolygon(tex, 0, false);
R_PolygonVertex(getsurfacepoint(e, i_s, tri.x), getsurfacepointattribute(e, i_s, tri.x, SPA_TEXCOORDS0), '1 1 1', 1);
R_PolygonVertex(getsurfacepoint(e, i_s, tri.y), getsurfacepointattribute(e, i_s, tri.y, SPA_TEXCOORDS0), '1 1 1', 1);
R_PolygonVertex(getsurfacepoint(e, i_s, tri.z), getsurfacepointattribute(e, i_s, tri.z, SPA_TEXCOORDS0), '1 1 1', 1);
if(f >= 1)
{
// draw full rectangle
- R_BeginPolygon(pic, drawflag);
+ R_BeginPolygon(pic, drawflag, true);
v = centre; t = '0.5 0.5 0';
v.x += 0.5 * ringsize.x; t += '0.5 0.5 0';
R_PolygonVertex(v, t, rgb, a);
d = q - 1;
if(d > 0)
{
- R_BeginPolygon(pic, drawflag);
+ R_BeginPolygon(pic, drawflag, true);
v = centre; t = '0.5 0.5 0';
R_PolygonVertex(v, t, rgb, a);
else if(f > 0.75)
{
// draw upper and first triangle
- R_BeginPolygon(pic, drawflag);
+ R_BeginPolygon(pic, drawflag, true);
v = centre; t = '0.5 0.5 0';
v.x += 0.5 * ringsize.x; t += '0.5 0.5 0';
R_PolygonVertex(v, t, rgb, a);
v.x -= 0.5 * ringsize.x; t -= '0.5 0.5 0';
R_PolygonVertex(v, t, rgb, a);
R_EndPolygon();
- R_BeginPolygon(pic, drawflag);
+ R_BeginPolygon(pic, drawflag, true);
v = centre; t = '0.5 0.5 0';
R_PolygonVertex(v, t, rgb, a);
else if(f > 0.5)
{
// draw upper triangle
- R_BeginPolygon(pic, drawflag);
+ R_BeginPolygon(pic, drawflag, true);
v = centre; t = '0.5 0.5 0';
v.x += 0.5 * ringsize.x; t += '0.5 0.5 0';
R_PolygonVertex(v, t, rgb, a);
d = q - 0.5;
if(d > 0)
{
- R_BeginPolygon(pic, drawflag);
+ R_BeginPolygon(pic, drawflag, true);
v = centre; t = '0.5 0.5 0';
R_PolygonVertex(v, t, rgb, a);
else if(f > 0.25)
{
// draw first triangle
- R_BeginPolygon(pic, drawflag);
+ R_BeginPolygon(pic, drawflag, true);
v = centre; t = '0.5 0.5 0';
R_PolygonVertex(v, t, rgb, a);
d = q;
if(d > 0)
{
- R_BeginPolygon(pic, drawflag);
+ R_BeginPolygon(pic, drawflag, true);
v = centre; t = '0.5 0.5 0';
R_PolygonVertex(v, t, rgb, a);
{
fga = 1;
fgc = '1 1 1' * fg;
- R_BeginPolygon(minimapname, DRAWFLAG_SCREEN | DRAWFLAG_MIPMAP);
+ R_BeginPolygon(minimapname, DRAWFLAG_SCREEN | DRAWFLAG_MIPMAP, true);
if(v_flipped)
{
R_PolygonVertex(teamradar_texcoord_to_2dcoord(mi_pictexcoord3), yinvert(mi_pictexcoord3), fgc, fga);
else
rgb2 = '1 1 1';
- R_BeginPolygon("", 0);
+ R_BeginPolygon("", 0, true);
R_PolygonVertex(coord+forward*3, '0 0 0', rgb2, panel_fg_alpha);
R_PolygonVertex(coord+right*4-forward*2.5, '0 1 0', rgb2, panel_fg_alpha);
R_PolygonVertex(coord-forward*2, '1 0 0', rgb2, panel_fg_alpha);
R_PolygonVertex(coord-right*4-forward*2.5, '1 1 0', rgb2, panel_fg_alpha);
R_EndPolygon();
- R_BeginPolygon("", 0);
+ R_BeginPolygon("", 0, true);
R_PolygonVertex(coord+forward*2, '0 0 0', rgb, panel_fg_alpha);
R_PolygonVertex(coord+right*3-forward*2, '0 1 0', rgb, panel_fg_alpha);
R_PolygonVertex(coord-forward, '1 0 0', rgb, panel_fg_alpha);
c0 = colormapPaletteColor(colors & 0x0F, false);
c1 = colormapPaletteColor((colors & 0xF0) / 0x10, false);
- R_BeginPolygon("", 0);
+ R_BeginPolygon("", 0, true);
R_PolygonVertex(start - norm, '0 0 0', c0, panel_fg_alpha);
R_PolygonVertex(start + norm, '0 1 0', c0, panel_fg_alpha);
R_PolygonVertex(end + norm, '1 1 0', c1, panel_fg_alpha);
#define EFMASK_CHEAP (EF_ADDITIVE | EF_DOUBLESIDED | EF_FULLBRIGHT | EF_NODEPTHTEST | EF_NODRAW | EF_NOSHADOW | EF_SELECTABLE | EF_TELEPORT_BIT)
float autocvar_cl_viewmodel_scale;
-float autocvar_cl_viewmodel_alpha;
+float autocvar_cl_viewmodel_alpha = 1;
bool autocvar_cl_bobmodel;
float autocvar_cl_bobmodel_speed;
showfps_prevfps_time = currentTime; // we must initialize it to avoid an instant low frame sending
}
-float drawtime;
float avgspeed;
vector GetCurrentFov(float fov)
{
return 0;
}
+void View_EventChase(entity this)
+{
+ // event chase camera
+ if(autocvar_chase_active <= 0) // greater than 0 means it's enabled manually, and this code is skipped
+ {
+ if(STAT(CAMERA_SPECTATOR))
+ {
+ if(spectatee_status > 0)
+ {
+ if(!autocvar_chase_active)
+ {
+ cvar_set("chase_active", "-2");
+ return;
+ }
+ }
+ else if(autocvar_chase_active == -2)
+ cvar_set("chase_active", "0");
+
+ if(autocvar_chase_active == -2)
+ return;
+ }
+ else if(autocvar_chase_active == -2)
+ cvar_set("chase_active", "0");
+
+ bool vehicle_chase = (hud != HUD_NORMAL && (autocvar_cl_eventchase_vehicle || spectatee_status > 0));
+
+ float vehicle_viewdist = 0;
+ vector vehicle_viewofs = '0 0 0';
+
+ if(vehicle_chase)
+ {
+ if(hud != HUD_BUMBLEBEE_GUN)
+ {
+ Vehicle info = Vehicles_from(hud);
+ vehicle_viewdist = info.height;
+ vehicle_viewofs = info.view_ofs;
+ if(vehicle_viewdist < 0) // when set below 0, this vehicle doesn't use third person view (gunner slots)
+ vehicle_chase = false;
+ }
+ else
+ vehicle_chase = false;
+ }
+
+ int eventchase = WantEventchase(this, vehicle_chase);
+ if (eventchase)
+ {
+ vector current_view_origin_override = '0 0 0';
+ vector view_offset_override = '0 0 0';
+ float chase_distance_override = 0;
+ bool custom_eventchase = MUTATOR_CALLHOOK(CustomizeEventchase, this);
+ if(custom_eventchase)
+ {
+ current_view_origin_override = M_ARGV(0, vector);
+ view_offset_override = M_ARGV(1, vector);
+ chase_distance_override = M_ARGV(0, float);
+ }
+ eventchase_running = true;
+
+ // make special vector since we can't use view_origin (It is one frame old as of this code, it gets set later with the results this code makes.)
+ vector current_view_origin = (csqcplayer ? csqcplayer.origin : pmove_org);
+ if (custom_eventchase)
+ current_view_origin = current_view_origin_override;
+
+ // detect maximum viewoffset and use it
+ vector view_offset = autocvar_cl_eventchase_viewoffset;
+ if(vehicle_chase)
+ {
+ if(vehicle_viewofs)
+ view_offset = vehicle_viewofs;
+ else
+ view_offset = autocvar_cl_eventchase_vehicle_viewoffset;
+ }
+ if (custom_eventchase)
+ view_offset = view_offset_override;
+
+ if(view_offset)
+ {
+ WarpZone_TraceLine(current_view_origin, current_view_origin + view_offset + ('0 0 1' * autocvar_cl_eventchase_maxs.z), MOVE_WORLDONLY, this);
+ if(trace_fraction == 1) { current_view_origin += view_offset; }
+ else { current_view_origin.z += max(0, (trace_endpos.z - current_view_origin.z) - autocvar_cl_eventchase_maxs.z); }
+ }
+
+ // We must enable chase_active to get a third person view (weapon viewmodel hidden and own player model showing).
+ // Ideally, there should be another way to enable third person cameras, such as through setproperty()
+ // -1 enables chase_active while marking it as set by this code, and not by the user (which would be 1)
+ if(!autocvar_chase_active) { cvar_set("chase_active", "-1"); }
+
+ // make the camera smooth back
+ float chase_distance = autocvar_cl_eventchase_distance;
+ if(vehicle_chase)
+ {
+ if(vehicle_viewofs)
+ chase_distance = vehicle_viewdist;
+ else
+ chase_distance = autocvar_cl_eventchase_vehicle_distance;
+ }
+ if (custom_eventchase)
+ chase_distance = chase_distance_override;
+
+ if(autocvar_cl_eventchase_speed && eventchase_current_distance < chase_distance)
+ eventchase_current_distance += autocvar_cl_eventchase_speed * (chase_distance - eventchase_current_distance) * frametime; // slow down the further we get
+ else if(eventchase_current_distance != chase_distance)
+ eventchase_current_distance = chase_distance;
+
+ vector forward, right, up;
+ MAKE_VECTORS(view_angles, forward, right, up);
+
+ vector eventchase_target_origin = (current_view_origin - (forward * eventchase_current_distance));
+ WarpZone_TraceBox(current_view_origin, autocvar_cl_eventchase_mins, autocvar_cl_eventchase_maxs, eventchase_target_origin, MOVE_WORLDONLY, this);
+
+ // If the boxtrace fails, revert back to line tracing.
+ if(!this.viewloc)
+ if(trace_startsolid)
+ {
+ eventchase_target_origin = (current_view_origin - (forward * eventchase_current_distance));
+ WarpZone_TraceLine(current_view_origin, eventchase_target_origin, MOVE_WORLDONLY, this);
+ setproperty(VF_ORIGIN, (trace_endpos - (forward * autocvar_cl_eventchase_mins.z)));
+ }
+ else { setproperty(VF_ORIGIN, trace_endpos); }
+
+ if(!this.viewloc)
+ setproperty(VF_ANGLES, WarpZone_TransformVAngles(WarpZone_trace_transform, view_angles));
+ }
+
+ if (eventchase <= 0 && autocvar_chase_active < 0) // time to disable chase_active if it was set by this code
+ {
+ eventchase_running = false;
+ cvar_set("chase_active", "0");
+ eventchase_current_distance = 0; // start from 0 next time
+ }
+ }
+ // workaround for camera stuck between player's legs when using chase_active 1
+ // because the engine stops updating the chase_active camera when the game ends
+ else if(intermission)
+ {
+ cvar_settemp("chase_active", "-1");
+ eventchase_current_distance = 0;
+ }
+}
+
void HUD_Crosshair_Vehicle(entity this)
{
if(hud != HUD_BUMBLEBEE_GUN)
if (damage_dealt_time != damage_dealt_time_prev)
{
unaccounted_damage += unaccounted_damage_new;
- LOG_TRACE("dmg total: ", ftos(unaccounted_damage), " (+", ftos(unaccounted_damage_new), ")");
+ //LOG_TRACE("dmg total: ", ftos(unaccounted_damage), " (+", ftos(unaccounted_damage_new), ")");
}
damage_dealt_time_prev = damage_dealt_time;
pitch_shift = mirror_value + (mirror_value - pitch_shift);
}
- LOG_TRACE("dmg total (dmg): ", ftos(unaccounted_damage), " , pitch shift: ", ftos(pitch_shift));
+ //LOG_TRACE("dmg total (dmg): ", ftos(unaccounted_damage), " , pitch shift: ", ftos(pitch_shift));
// todo: avoid very long and very short sounds from wave stretching using different sound files? seems unnecessary
// todo: normalize sound pressure levels? seems unnecessary
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)
+ if(csqcplayer && autocvar_crosshair_chase_playeralpha && autocvar_crosshair_chase_playeralpha < 1)
{
traceline(view_origin, view_origin + max_shot_distance * view_forward, MOVE_NORMAL, NULL);
float myalpha = (!csqcplayer.m_alpha) ? 1 : csqcplayer.m_alpha;
if(trace_ent == csqcplayer && STAT(HEALTH) > 0)
- csqcplayer.alpha = min(crosshair_chase_playeralpha, myalpha);
+ csqcplayer.alpha = min(autocvar_crosshair_chase_playeralpha, myalpha);
else
csqcplayer.alpha = csqcplayer.m_alpha;
}
HUD_Cursor_Show();
}
-bool ov_enabled;
-float oldr_nearclip;
-float oldr_farclip_base;
-float oldr_farclip_world;
-float oldr_novis;
-float oldr_useportalculling;
-float oldr_useinfinitefarclip;
-
-float prev_myteam;
-int lasthud;
-float vh_notice_time;
-void CSQC_UpdateView(entity this, float w, float h)
+void View_NightVision()
{
- TC(int, w); TC(int, h);
- entity e;
- float fov;
- float f;
- vector vf_size, vf_min;
+ if(!(autocvar_r_fakelight >= 2 || autocvar_r_fullbright) || (serverflags & SERVERFLAG_ALLOW_FULLBRIGHT))
+ return;
+
+ // apply night vision effect
+ vector tc_00, tc_01, tc_10, tc_11;
+ vector rgb = '0 0 0';
float a;
- execute_next_frame();
+ if(!nightvision_noise)
+ {
+ nightvision_noise = new(nightvision_noise);
+ }
+ if(!nightvision_noise2)
+ {
+ nightvision_noise2 = new(nightvision_noise2);
+ }
+
+ // color tint in yellow
+ drawfill('0 0 0', autocvar_vid_conwidth * '1 0 0' + autocvar_vid_conheight * '0 1 0', '0.5 1 0.3', 1, DRAWFLAG_MODULATE);
+
+ // draw BG
+ a = Noise_Pink(nightvision_noise, frametime * 1.5) * 0.05 + 0.15;
+ rgb = '1 1 1';
+ tc_00 = '0 0 0' + '0.2 0 0' * sin(time * 0.3) + '0 0.3 0' * cos(time * 0.7);
+ tc_01 = '0 2.25 0' + '0.6 0 0' * cos(time * 1.2) - '0 0.3 0' * sin(time * 2.2);
+ tc_10 = '1.5 0 0' - '0.2 0 0' * sin(time * 0.5) + '0 0.5 0' * cos(time * 1.7);
+ //tc_11 = '1 1 0' + '0.6 0 0' * sin(time * 0.6) + '0 0.3 0' * cos(time * 0.1);
+ tc_11 = tc_01 + tc_10 - tc_00;
+ R_BeginPolygon("gfx/nightvision-bg.tga", DRAWFLAG_ADDITIVE, true);
+ R_PolygonVertex('0 0 0', tc_00, rgb, a);
+ R_PolygonVertex(autocvar_vid_conwidth * '1 0 0', tc_10, rgb, a);
+ R_PolygonVertex(autocvar_vid_conwidth * '1 0 0' + autocvar_vid_conheight * '0 1 0', tc_11, rgb, a);
+ R_PolygonVertex(autocvar_vid_conheight * '0 1 0', tc_01, rgb, a);
+ R_EndPolygon();
+
+ // draw FG
+ a = Noise_Pink(nightvision_noise2, frametime * 0.1) * 0.05 + 0.12;
+ rgb = '0.3 0.6 0.4' + '0.1 0.4 0.2' * Noise_White(nightvision_noise2, frametime);
+ tc_00 = '0 0 0' + '1 0 0' * Noise_White(nightvision_noise2, frametime) + '0 1 0' * Noise_White(nightvision_noise2, frametime);
+ tc_01 = tc_00 + '0 3 0' * (1 + Noise_White(nightvision_noise2, frametime) * 0.2);
+ tc_10 = tc_00 + '2 0 0' * (1 + Noise_White(nightvision_noise2, frametime) * 0.3);
+ tc_11 = tc_01 + tc_10 - tc_00;
+ R_BeginPolygon("gfx/nightvision-fg.tga", DRAWFLAG_ADDITIVE, true);
+ R_PolygonVertex('0 0 0', tc_00, rgb, a);
+ R_PolygonVertex(autocvar_vid_conwidth * '1 0 0', tc_10, rgb, a);
+ R_PolygonVertex(autocvar_vid_conwidth * '1 0 0' + autocvar_vid_conheight * '0 1 0', tc_11, rgb, a);
+ R_PolygonVertex(autocvar_vid_conheight * '0 1 0', tc_01, rgb, a);
+ R_EndPolygon();
+}
- ++framecount;
+void DrawReticle(entity this)
+{
+ if(!autocvar_cl_reticle || MUTATOR_CALLHOOK(DrawReticle))
+ {
+ reticle_type = 0;
+ return;
+ }
- stats_get();
- hud = STAT(HUD);
+ float is_dead = (STAT(HEALTH) <= 0);
+ string reticle_image = string_null;
+ bool wep_zoomed = false;
+ for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
+ {
+ entity wepe = viewmodels[slot];
+ Weapon wep = wepe.activeweapon;
+ if(wep != WEP_Null && wep.wr_zoom)
+ {
+ bool do_zoom = wep.wr_zoom(wep, NULL);
+ if(!reticle_image && wep.w_reticle && wep.w_reticle != "")
+ reticle_image = wep.w_reticle;
+ wep_zoomed += do_zoom;
+ }
+ }
+ // Draw the aiming reticle for weapons that use it
+ // reticle_type is changed to the item we are zooming / aiming with, to decide which reticle to use
+ // It must be a persisted float for fading out to work properly (you let go of the zoom button for
+ // the view to go back to normal, so reticle_type would become 0 as we fade out)
+ if(spectatee_status || is_dead || hud != HUD_NORMAL || this.viewloc)
+ {
+ // no zoom reticle while dead
+ reticle_type = 0;
+ }
+ else if(wep_zoomed && autocvar_cl_reticle_weapon)
+ {
+ if(reticle_image) { reticle_type = 2; }
+ else { reticle_type = 0; }
+ }
+ else if(button_zoom || zoomscript_caught)
+ {
+ // normal zoom
+ reticle_type = 1;
+ }
- if(hud != HUD_NORMAL && lasthud == HUD_NORMAL)
- vh_notice_time = time + autocvar_cl_vehicles_notify_time;
+ if(reticle_type)
+ {
+ vector reticle_pos = '0 0 0', reticle_size = '0 0 0';
+ if(autocvar_cl_reticle_stretch)
+ {
+ reticle_size.x = vid_conwidth;
+ reticle_size.y = vid_conheight;
+ reticle_pos.x = 0;
+ reticle_pos.y = 0;
+ }
+ else
+ {
+ reticle_size.x = max(vid_conwidth, vid_conheight);
+ reticle_size.y = max(vid_conwidth, vid_conheight);
+ reticle_pos.x = (vid_conwidth - reticle_size.x) / 2;
+ reticle_pos.y = (vid_conheight - reticle_size.y) / 2;
+ }
- lasthud = hud;
+ float f = (zoomscript_caught) ? 1 : current_zoomfraction;
- ReplicateVars(false);
- if (ReplicateVars_NOT_SENDING())
- ReplicateVars_DELAY(0.8 + random() * 0.4); // no need to check cvars every frame
+ if(f)
+ {
+ switch(reticle_type)
+ {
+ case 1: drawpic(reticle_pos, "gfx/reticle_normal", reticle_size, '1 1 1', f * autocvar_cl_reticle_normal_alpha, DRAWFLAG_NORMAL); break;
+ case 2: if(reticle_image) drawpic(reticle_pos, reticle_image, reticle_size, '1 1 1', f * autocvar_cl_reticle_weapon_alpha, DRAWFLAG_NORMAL); break;
+ }
+ }
+ }
+}
- HUD_Scale_Disable();
+// visual overlay while in liquids
+// provides some effects to the postprocessing function
+void HUD_Contents()
+{
+ if(!autocvar_hud_contents || MUTATOR_CALLHOOK(HUD_Contents))
+ return;
- if(autocvar__hud_showbinds_reload) // menu can set this one
+ // improved polyblend
+ float contentalpha_temp, incontent, liquidalpha, contentfadetime;
+ vector liquidcolor;
+
+ switch(pointcontents(view_origin))
{
- db_close(binddb);
- binddb = db_create();
- cvar_set("_hud_showbinds_reload", "0");
+ case CONTENT_WATER:
+ liquidalpha = autocvar_hud_contents_water_alpha;
+ liquidcolor = stov(autocvar_hud_contents_water_color);
+ incontent = 1;
+ break;
+
+ case CONTENT_LAVA:
+ liquidalpha = autocvar_hud_contents_lava_alpha;
+ liquidcolor = stov(autocvar_hud_contents_lava_color);
+ incontent = 1;
+ break;
+
+ case CONTENT_SLIME:
+ liquidalpha = autocvar_hud_contents_slime_alpha;
+ liquidcolor = stov(autocvar_hud_contents_slime_color);
+ incontent = 1;
+ break;
+
+ default:
+ liquidalpha = 0;
+ liquidcolor = '0 0 0';
+ incontent = 0;
+ break;
}
- if(checkextension("DP_CSQC_MINFPS_QUALITY"))
- view_quality = getproperty(VF_MINFPS_QUALITY);
+ if(incontent) // fade in/out at different speeds so you can do e.g. instant fade when entering water and slow when leaving it.
+ { // also lets delcare previous values for blending properties, this way it isn't reset until after you have entered a different content
+ contentfadetime = autocvar_hud_contents_fadeintime;
+ liquidalpha_prev = liquidalpha;
+ liquidcolor_prev = liquidcolor;
+ }
else
- view_quality = 1;
+ contentfadetime = autocvar_hud_contents_fadeouttime;
- button_attack2 = PHYS_INPUT_BUTTON_ATCK2(this);
- button_zoom = PHYS_INPUT_BUTTON_ZOOM(this);
+ contentalpha_temp = bound(0, drawframetime / max(0.0001, contentfadetime), 1);
+ contentavgalpha = contentavgalpha * (1 - contentalpha_temp) + incontent * contentalpha_temp;
- vf_size = getpropertyvec(VF_SIZE);
- vf_min = getpropertyvec(VF_MIN);
- vid_width = vf_size.x;
- vid_height = vf_size.y;
+ if(contentavgalpha)
+ drawfill('0 0 0', vec2(vid_conwidth, vid_conheight), liquidcolor_prev, contentavgalpha * liquidalpha_prev, DRAWFLAG_NORMAL);
+
+ if(autocvar_hud_postprocessing)
+ {
+ if(autocvar_hud_contents_blur && contentavgalpha)
+ {
+ content_blurpostprocess.x = 1;
+ content_blurpostprocess.y = contentavgalpha * autocvar_hud_contents_blur;
+ content_blurpostprocess.z = contentavgalpha * autocvar_hud_contents_blur_alpha;
+ }
+ else
+ {
+ content_blurpostprocess.x = 0;
+ content_blurpostprocess.y = 0;
+ content_blurpostprocess.z = 0;
+ }
+ }
+}
+
+// visual pain effects on the screen
+// provides some effects to the postprocessing function
+void HUD_Damage()
+{
+ if(!autocvar_hud_damage || STAT(FROZEN))
+ return;
- vector reticle_pos = '0 0 0', reticle_size = '0 0 0';
vector splash_pos = '0 0 0', splash_size = '0 0 0';
+ splash_size.x = max(vid_conwidth, vid_conheight);
+ splash_size.y = max(vid_conwidth, vid_conheight);
+ splash_pos.x = (vid_conwidth - splash_size.x) / 2;
+ splash_pos.y = (vid_conheight - splash_size.y) / 2;
- WaypointSprite_Load();
+ float myhealth_flash_temp;
+ myhealth = STAT(HEALTH);
- CSQCPlayer_SetCamera();
+ // fade out
+ myhealth_flash = max(0, myhealth_flash - autocvar_hud_damage_fade_rate * frametime);
+ // add new damage
+ myhealth_flash = bound(0, myhealth_flash + dmg_take * autocvar_hud_damage_factor, autocvar_hud_damage_maxalpha);
- if(player_localentnum <= maxclients) // is it a client?
- current_player = player_localentnum - 1;
- else // then player_localentnum is the vehicle I'm driving
- current_player = player_localnum;
- myteam = entcs_GetTeam(current_player);
+ float pain_threshold, pain_threshold_lower, pain_threshold_lower_health;
+ pain_threshold = autocvar_hud_damage_pain_threshold;
+ pain_threshold_lower = autocvar_hud_damage_pain_threshold_lower;
+ pain_threshold_lower_health = autocvar_hud_damage_pain_threshold_lower_health;
- if(myteam != prev_myteam)
+ if(pain_threshold_lower && myhealth < pain_threshold_lower_health)
{
- myteamcolors = colormapPaletteColor(myteam, 1);
- FOREACH(hud_panels, true, it.update_time = time);
- prev_myteam = myteam;
+ pain_threshold = pain_threshold - max(autocvar_hud_damage_pain_threshold_pulsating_min, fabs(sin(M_PI * time / autocvar_hud_damage_pain_threshold_pulsating_period))) * pain_threshold_lower * (1 - max(0, myhealth)/pain_threshold_lower_health);
}
- ticrate = STAT(MOVEVARS_TICRATE) * STAT(MOVEVARS_TIMESCALE);
-
- float is_dead = (STAT(HEALTH) <= 0);
+ myhealth_flash_temp = bound(0, myhealth_flash - pain_threshold, 1);
- // FIXME do we need this hack?
- if(isdemo())
+ if(myhealth_prev < 1)
{
- // in demos, input_buttons do not work
- button_zoom = (autocvar__togglezoom == "-");
+ if(myhealth >= 1)
+ {
+ myhealth_flash = 0; // just spawned, clear the flash immediately
+ myhealth_flash_temp = 0;
+ }
+ else
+ {
+ myhealth_flash += autocvar_hud_damage_fade_rate * frametime; // dead
+ }
}
- else if(button_zoom
- && autocvar_cl_unpress_zoom_on_death
- && (spectatee_status >= 0)
- && (is_dead || intermission))
+
+ if(spectatee_status == -1 || intermission)
{
- // no zoom while dead or in intermission please
- localcmd("-zoom\n");
- button_zoom = false;
+ myhealth_flash = 0; // observing, or match ended
+ myhealth_flash_temp = 0;
}
- // abused multiple places below
- entity local_player = ((csqcplayer) ? csqcplayer : CSQCModel_server2csqc(player_localentnum - 1));
- if(!local_player)
- local_player = this; // fall back!
+ myhealth_prev = myhealth;
- // event chase camera
- if(autocvar_chase_active <= 0) // greater than 0 means it's enabled manually, and this code is skipped
+ // IDEA: change damage color/picture based on player model for robot/alien species?
+ // pro: matches model better
+ // contra: it's not red because blood is red, but because red is an alarming color, so red should stay
+ // maybe different reddish pics?
+ if(autocvar_cl_gentle_damage || autocvar_cl_gentle)
{
- if(STAT(CAMERA_SPECTATOR))
+ if(autocvar_cl_gentle_damage == 2)
{
- if(spectatee_status > 0)
- {
- if(!autocvar_chase_active)
- {
- cvar_set("chase_active", "-2");
- goto skip_eventchase_death;
- }
- }
- else if(autocvar_chase_active == -2)
- cvar_set("chase_active", "0");
-
- if(autocvar_chase_active == -2)
- goto skip_eventchase_death;
+ if(myhealth_flash < pain_threshold) // only randomize when the flash is gone
+ myhealth_gentlergb = randomvec();
}
- else if(autocvar_chase_active == -2)
- cvar_set("chase_active", "0");
-
- bool vehicle_chase = (hud != HUD_NORMAL && (autocvar_cl_eventchase_vehicle || spectatee_status > 0));
+ else
+ myhealth_gentlergb = stov(autocvar_hud_damage_gentle_color);
- float vehicle_viewdist = 0;
- vector vehicle_viewofs = '0 0 0';
+ if(myhealth_flash_temp > 0)
+ drawfill('0 0 0', vec2(vid_conwidth, vid_conheight), myhealth_gentlergb, autocvar_hud_damage_gentle_alpha_multiplier * bound(0, myhealth_flash_temp, 1) * autocvar_hud_damage, DRAWFLAG_NORMAL);
+ }
+ else if(myhealth_flash_temp > 0)
+ drawpic(splash_pos, "gfx/blood", splash_size, stov(autocvar_hud_damage_color), bound(0, myhealth_flash_temp, 1) * autocvar_hud_damage, DRAWFLAG_NORMAL);
- if(vehicle_chase)
+ if(autocvar_hud_postprocessing) // we still need to set this anyway even when chase_active is set, this way it doesn't get stuck on.
+ {
+ if(autocvar_hud_damage_blur && myhealth_flash_temp)
{
- if(hud != HUD_BUMBLEBEE_GUN)
- {
- Vehicle info = Vehicles_from(hud);
- vehicle_viewdist = info.height;
- vehicle_viewofs = info.view_ofs;
- if(vehicle_viewdist < 0) // when set below 0, this vehicle doesn't use third person view (gunner slots)
- vehicle_chase = false;
- }
- else
- vehicle_chase = false;
+ damage_blurpostprocess.x = 1;
+ damage_blurpostprocess.y = bound(0, myhealth_flash_temp, 1) * autocvar_hud_damage_blur;
+ damage_blurpostprocess.z = bound(0, myhealth_flash_temp, 1) * autocvar_hud_damage_blur_alpha;
}
+ else
+ {
+ damage_blurpostprocess.x = 0;
+ damage_blurpostprocess.y = 0;
+ damage_blurpostprocess.z = 0;
+ }
+ }
+}
- int eventchase = WantEventchase(this, vehicle_chase);
- if (eventchase)
+void View_PostProcessing()
+{
+ float e1 = (autocvar_hud_postprocessing_maxbluralpha != 0);
+ float e2 = (autocvar_hud_powerup != 0);
+ if(autocvar_hud_postprocessing && (e1 || e2)) // TODO: Remove this code and re-do the postprocess handling in the engine, where it properly belongs.
+ {
+ // enable or disable rendering types if they are used or not
+ if(cvar("r_glsl_postprocess_uservec1_enable") != e1) { cvar_set("r_glsl_postprocess_uservec1_enable", ftos(e1)); }
+ if(cvar("r_glsl_postprocess_uservec2_enable") != e2) { cvar_set("r_glsl_postprocess_uservec2_enable", ftos(e2)); }
+
+ // blur postprocess handling done first (used by hud_damage and hud_contents)
+ if((damage_blurpostprocess.x || content_blurpostprocess.x))
{
- vector current_view_origin_override = '0 0 0';
- vector view_offset_override = '0 0 0';
- float chase_distance_override = 0;
- bool custom_eventchase = MUTATOR_CALLHOOK(CustomizeEventchase, this);
- if(custom_eventchase)
+ float blurradius = bound(0, damage_blurpostprocess.y + content_blurpostprocess.y, autocvar_hud_postprocessing_maxblurradius);
+ float bluralpha = bound(0, damage_blurpostprocess.z + content_blurpostprocess.z, autocvar_hud_postprocessing_maxbluralpha);
+ if(blurradius != old_blurradius || bluralpha != old_bluralpha) // reduce cvar_set spam as much as possible
{
- current_view_origin_override = M_ARGV(0, vector);
- view_offset_override = M_ARGV(1, vector);
- chase_distance_override = M_ARGV(0, float);
+ cvar_set("r_glsl_postprocess_uservec1", strcat(ftos(blurradius), " ", ftos(bluralpha), " 0 0"));
+ old_blurradius = blurradius;
+ old_bluralpha = bluralpha;
}
- eventchase_running = true;
+ }
+ else if(cvar_string("r_glsl_postprocess_uservec1") != "0 0 0 0") // reduce cvar_set spam as much as possible
+ {
+ cvar_set("r_glsl_postprocess_uservec1", "0 0 0 0");
+ old_blurradius = 0;
+ old_bluralpha = 0;
+ }
- // make special vector since we can't use view_origin (It is one frame old as of this code, it gets set later with the results this code makes.)
- vector current_view_origin = (csqcplayer ? csqcplayer.origin : pmove_org);
- if (custom_eventchase)
- current_view_origin = current_view_origin_override;
+ // edge detection postprocess handling done second (used by hud_powerup)
+ float sharpen_intensity = 0, strength_finished = STAT(STRENGTH_FINISHED), invincible_finished = STAT(INVINCIBLE_FINISHED);
+ if (strength_finished - time > 0) { sharpen_intensity += (strength_finished - time); }
+ if (invincible_finished - time > 0) { sharpen_intensity += (invincible_finished - time); }
- // detect maximum viewoffset and use it
- vector view_offset = autocvar_cl_eventchase_viewoffset;
- if(vehicle_chase)
- {
- if(vehicle_viewofs)
- view_offset = vehicle_viewofs;
- else
- view_offset = autocvar_cl_eventchase_vehicle_viewoffset;
- }
- if (custom_eventchase)
- view_offset = view_offset_override;
+ sharpen_intensity = bound(0, ((STAT(HEALTH) > 0) ? sharpen_intensity : 0), 5); // Check to see if player is alive (if not, set 0) - also bound to fade out starting at 5 seconds.
- if(view_offset)
+ if(autocvar_hud_powerup && sharpen_intensity > 0)
+ {
+ if(sharpen_intensity != old_sharpen_intensity) // reduce cvar_set spam as much as possible
{
- WarpZone_TraceLine(current_view_origin, current_view_origin + view_offset + ('0 0 1' * autocvar_cl_eventchase_maxs.z), MOVE_WORLDONLY, this);
- if(trace_fraction == 1) { current_view_origin += view_offset; }
- else { current_view_origin.z += max(0, (trace_endpos.z - current_view_origin.z) - autocvar_cl_eventchase_maxs.z); }
+ cvar_set("r_glsl_postprocess_uservec2", strcat(ftos((sharpen_intensity / 5) * autocvar_hud_powerup), " ", ftos(-sharpen_intensity * autocvar_hud_powerup), " 0 0"));
+ old_sharpen_intensity = sharpen_intensity;
}
+ }
+ else if(cvar_string("r_glsl_postprocess_uservec2") != "0 0 0 0") // reduce cvar_set spam as much as possible
+ {
+ cvar_set("r_glsl_postprocess_uservec2", "0 0 0 0");
+ old_sharpen_intensity = 0;
+ }
- // We must enable chase_active to get a third person view (weapon viewmodel hidden and own player model showing).
- // Ideally, there should be another way to enable third person cameras, such as through setproperty()
- // -1 enables chase_active while marking it as set by this code, and not by the user (which would be 1)
- if(!autocvar_chase_active) { cvar_set("chase_active", "-1"); }
+ if(cvar("r_glsl_postprocess") == 0)
+ cvar_set("r_glsl_postprocess", "2");
+ }
+ else if(cvar("r_glsl_postprocess") == 2)
+ cvar_set("r_glsl_postprocess", "0");
+}
- // make the camera smooth back
- float chase_distance = autocvar_cl_eventchase_distance;
- if(vehicle_chase)
- {
- if(vehicle_viewofs)
- chase_distance = vehicle_viewdist;
- else
- chase_distance = autocvar_cl_eventchase_vehicle_distance;
- }
- if (custom_eventchase)
- chase_distance = chase_distance_override;
+void View_Lock()
+{
+ if(autocvar_cl_lockview || (!autocvar_hud_cursormode && (autocvar__hud_configure && spectatee_status <= 0 || intermission > 1 || QuickMenu_IsOpened())))
+ {
+ setproperty(VF_ORIGIN, freeze_org);
+ setproperty(VF_ANGLES, freeze_ang);
+ }
+ else
+ {
+ freeze_org = getpropertyvec(VF_ORIGIN);
+ freeze_ang = getpropertyvec(VF_ANGLES);
+ }
+}
- if(autocvar_cl_eventchase_speed && eventchase_current_distance < chase_distance)
- eventchase_current_distance += autocvar_cl_eventchase_speed * (chase_distance - eventchase_current_distance) * frametime; // slow down the further we get
- else if(eventchase_current_distance != chase_distance)
- eventchase_current_distance = chase_distance;
+void View_DemoCamera()
+{
+ if(camera_active) // Camera for demo playback
+ {
+ if(autocvar_camera_enable)
+ CSQC_Demo_Camera();
+ else
+ {
+ cvar_set("chase_active", ftos(chase_active_backup));
+ cvar_set("cl_demo_mousegrab", "0");
+ camera_active = false;
+ }
+ }
+ else
+ {
+#ifdef CAMERATEST
+ if(autocvar_camera_enable)
+#else
+ if(autocvar_camera_enable && isdemo())
+#endif
+ {
+ // Enable required Darkplaces cvars
+ chase_active_backup = autocvar_chase_active;
+ cvar_set("chase_active", "2");
+ cvar_set("cl_demo_mousegrab", "1");
+ camera_active = true;
+ camera_mode = false;
+ }
+ }
+}
- vector forward, right, up;
- MAKE_VECTORS(view_angles, forward, right, up);
+#ifdef BLURTEST
+void View_BlurTest()
+{
+ if(time > blurtest_time0 && time < blurtest_time1)
+ {
+ float t = (time - blurtest_time0) / (blurtest_time1 - blurtest_time0);
+ float r = t * blurtest_radius;
+ float f = 1 / (t ** blurtest_power) - 1;
- vector eventchase_target_origin = (current_view_origin - (forward * eventchase_current_distance));
- WarpZone_TraceBox(current_view_origin, autocvar_cl_eventchase_mins, autocvar_cl_eventchase_maxs, eventchase_target_origin, MOVE_WORLDONLY, this);
+ cvar_set("r_glsl_postprocess", "1");
+ cvar_set("r_glsl_postprocess_uservec1", strcat(ftos(r), " ", ftos(f), " 0 0"));
+ }
+ else
+ {
+ cvar_set("r_glsl_postprocess", "0");
+ cvar_set("r_glsl_postprocess_uservec1", "0 0 0 0");
+ }
+}
+#endif
- // If the boxtrace fails, revert back to line tracing.
- if(!local_player.viewloc)
- if(trace_startsolid)
- {
- eventchase_target_origin = (current_view_origin - (forward * eventchase_current_distance));
- WarpZone_TraceLine(current_view_origin, eventchase_target_origin, MOVE_WORLDONLY, this);
- setproperty(VF_ORIGIN, (trace_endpos - (forward * autocvar_cl_eventchase_mins.z)));
- }
- else { setproperty(VF_ORIGIN, trace_endpos); }
+void View_CheckButtonStatus()
+{
+ float is_dead = (STAT(HEALTH) <= 0);
- if(!local_player.viewloc)
- setproperty(VF_ANGLES, WarpZone_TransformVAngles(WarpZone_trace_transform, view_angles));
- }
+ // FIXME do we need this hack?
+ if(isdemo())
+ {
+ // in demos, input_buttons do not work
+ button_zoom = (autocvar__togglezoom == "-");
+ }
+ else if(button_zoom
+ && autocvar_cl_unpress_zoom_on_death
+ && (spectatee_status >= 0)
+ && (is_dead || intermission))
+ {
+ // no zoom while dead or in intermission please
+ localcmd("-zoom\n");
+ button_zoom = false;
+ }
- if (eventchase <= 0 && autocvar_chase_active < 0) // time to disable chase_active if it was set by this code
+ if(autocvar_fov <= 59.5)
+ {
+ if(!zoomscript_caught)
{
- eventchase_running = false;
- cvar_set("chase_active", "0");
- eventchase_current_distance = 0; // start from 0 next time
+ localcmd("+button9\n");
+ zoomscript_caught = 1;
}
}
- // workaround for camera stuck between player's legs when using chase_active 1
- // because the engine stops updating the chase_active camera when the game ends
- else if(intermission)
+ else
{
- cvar_settemp("chase_active", "-1");
- eventchase_current_distance = 0;
+ if(zoomscript_caught)
+ {
+ localcmd("-button9\n");
+ zoomscript_caught = 0;
+ }
}
- LABEL(skip_eventchase_death);
-
- // do lockview after event chase camera so that it still applies whenever necessary.
- if(autocvar_cl_lockview || (!autocvar_hud_cursormode && (autocvar__hud_configure && spectatee_status <= 0 || intermission > 1 || QuickMenu_IsOpened())))
+ if(active_minigame && HUD_MinigameMenu_IsOpened())
{
- setproperty(VF_ORIGIN, freeze_org);
- setproperty(VF_ANGLES, freeze_ang);
+ if(!minigame_wasactive)
+ {
+ localcmd("+button12\n");
+ minigame_wasactive = true;
+ }
}
- else
+ else if(minigame_wasactive)
{
- freeze_org = getpropertyvec(VF_ORIGIN);
- freeze_ang = getpropertyvec(VF_ANGLES);
+ localcmd("-button12\n");
+ minigame_wasactive = false;
}
- WarpZone_FixView();
- //WarpZone_FixPMove();
+ for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
+ {
+ entity wepent = viewmodels[slot];
+
+ if(wepent.last_switchweapon != wepent.switchweapon)
+ {
+ weapontime = time;
+ wepent.last_switchweapon = wepent.switchweapon;
+ if(slot == 0 && button_zoom && autocvar_cl_unpress_zoom_on_weapon_switch)
+ {
+ localcmd("-zoom\n");
+ button_zoom = false;
+ }
+ if(slot == 0 && autocvar_cl_unpress_attack_on_weapon_switch)
+ {
+ localcmd("-fire\n");
+ localcmd("-fire2\n");
+ button_attack2 = false;
+ }
+ }
+ if(wepent.last_activeweapon != wepent.activeweapon)
+ {
+ wepent.last_activeweapon = wepent.activeweapon;
+
+ entity e = wepent.activeweapon;
+ if(e.netname != "")
+ localcmd(strcat("\ncl_hook_activeweapon ", e.netname), "\n");
+ else if(slot == 0)
+ localcmd("\ncl_hook_activeweapon none\n");
+ }
+ }
+}
- vector ov_org = '0 0 0';
- vector ov_mid = '0 0 0';
- vector ov_worldmin = '0 0 0';
- vector ov_worldmax = '0 0 0';
+bool ov_enabled;
+float oldr_nearclip;
+float oldr_farclip_base;
+float oldr_farclip_world;
+float oldr_novis;
+float oldr_useportalculling;
+float oldr_useinfinitefarclip;
+vector ov_org = '0 0 0';
+vector ov_mid = '0 0 0';
+vector ov_worldmin = '0 0 0';
+vector ov_worldmax = '0 0 0';
+
+void View_Ortho()
+{
+ ov_org = '0 0 0';
+ ov_mid = '0 0 0';
+ ov_worldmin = '0 0 0';
+ ov_worldmax = '0 0 0';
if(autocvar_cl_orthoview)
{
ov_worldmin = mi_picmin;
}
ov_enabled = false;
}
+}
+
+void View_UpdateFov()
+{
+ vector fov;
+ if(autocvar_cl_orthoview)
+ fov = GetOrthoviewFOV(ov_worldmin, ov_worldmax, ov_mid, ov_org);
+ else if(csqcplayer.viewloc)
+ fov = GetViewLocationFOV(110); // enforce 110 fov, so things don't look odd
+ else
+ fov = GetCurrentFov(autocvar_fov);
+
+ setproperty(VF_FOV, fov);
+}
+
+void CSQC_UpdateView(entity this, float w, float h)
+{
+ TC(int, w); TC(int, h);
+
+ execute_next_frame();
+
+ ++framecount;
+
+ stats_get();
+ hud = STAT(HUD);
+
+ ReplicateVars(false);
+ if (ReplicateVars_NOT_SENDING())
+ ReplicateVars_DELAY(0.8 + random() * 0.4); // no need to check cvars every frame
+
+ HUD_Scale_Disable();
+
+ if(autocvar__hud_showbinds_reload) // menu can set this one
+ {
+ db_close(binddb);
+ binddb = db_create();
+ cvar_set("_hud_showbinds_reload", "0");
+ }
+
+ if(checkextension("DP_CSQC_MINFPS_QUALITY"))
+ view_quality = getproperty(VF_MINFPS_QUALITY);
+ else
+ view_quality = 1;
+
+ button_attack2 = PHYS_INPUT_BUTTON_ATCK2(this);
+ button_zoom = PHYS_INPUT_BUTTON_ZOOM(this);
+
+ vector vf_size = getpropertyvec(VF_SIZE);
+ vector vf_min = getpropertyvec(VF_MIN);
+ vid_width = vf_size.x;
+ vid_height = vf_size.y;
+
+ ticrate = STAT(MOVEVARS_TICRATE) * STAT(MOVEVARS_TIMESCALE);
+
+ WaypointSprite_Load();
+
+ CSQCPlayer_SetCamera();
+
+ if(player_localentnum <= maxclients) // is it a client?
+ current_player = player_localentnum - 1;
+ else // then player_localentnum is the vehicle I'm driving
+ current_player = player_localnum;
+ myteam = entcs_GetTeam(current_player);
+
+ // abused multiple places below
+ entity local_player = ((csqcplayer) ? csqcplayer : CSQCModel_server2csqc(player_localentnum - 1));
+ if(!local_player)
+ local_player = this; // fall back!
+
+ View_EventChase(local_player);
+
+ // do lockview after event chase camera so that it still applies whenever necessary.
+ View_Lock();
+
+ WarpZone_FixView();
+ //WarpZone_FixPMove();
+
+ View_Ortho();
// run viewmodel_draw before updating view_angles to the angles calculated by WarpZone_FixView
// viewmodel_draw needs to use the view_angles set by the engine on every CSQC_UpdateView call
view_angles = getpropertyvec(VF_ANGLES);
MAKE_VECTORS(view_angles, view_forward, view_right, view_up);
-#ifdef BLURTEST
- if(time > blurtest_time0 && time < blurtest_time1)
- {
- float r, t;
-
- t = (time - blurtest_time0) / (blurtest_time1 - blurtest_time0);
- r = t * blurtest_radius;
- f = 1 / (t ** blurtest_power) - 1;
-
- cvar_set("r_glsl_postprocess", "1");
- cvar_set("r_glsl_postprocess_uservec1", strcat(ftos(r), " ", ftos(f), " 0 0"));
- }
- else
- {
- cvar_set("r_glsl_postprocess", "0");
- cvar_set("r_glsl_postprocess_uservec1", "0 0 0 0");
- }
+#ifdef BLURTEST
+ View_BlurTest();
#endif
TargetMusic_Advance();
Announcer();
- fov = autocvar_fov;
- if(fov <= 59.5)
- {
- if(!zoomscript_caught)
- {
- localcmd("+button9\n");
- zoomscript_caught = 1;
- }
- }
- else
- {
- if(zoomscript_caught)
- {
- localcmd("-button9\n");
- zoomscript_caught = 0;
- }
- }
-
- if(active_minigame && HUD_MinigameMenu_IsOpened())
- {
- if(!minigame_wasactive)
- {
- localcmd("+button12\n");
- minigame_wasactive = true;
- }
- }
- else if(minigame_wasactive)
- {
- localcmd("-button12\n");
- minigame_wasactive = false;
- }
+ View_CheckButtonStatus();
ColorTranslateMode = autocvar_cl_stripcolorcodes;
- for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
- {
- entity wepent = viewmodels[slot];
-
- if(wepent.last_switchweapon != wepent.switchweapon)
- {
- weapontime = time;
- wepent.last_switchweapon = wepent.switchweapon;
- if(slot == 0 && button_zoom && autocvar_cl_unpress_zoom_on_weapon_switch)
- {
- localcmd("-zoom\n");
- button_zoom = false;
- }
- if(slot == 0 && autocvar_cl_unpress_attack_on_weapon_switch)
- {
- localcmd("-fire\n");
- localcmd("-fire2\n");
- button_attack2 = false;
- }
- }
- if(wepent.last_activeweapon != wepent.activeweapon)
- {
- wepent.last_activeweapon = wepent.activeweapon;
-
- e = wepent.activeweapon;
- if(e.netname != "")
- localcmd(strcat("\ncl_hook_activeweapon ", e.netname), "\n");
- else if(slot == 0)
- localcmd("\ncl_hook_activeweapon none\n");
- }
- }
-
// ALWAYS Clear Current Scene First
clearscene();
vid_conheight = autocvar_vid_conheight;
vid_pixelheight = autocvar_vid_pixelheight;
- if(autocvar_cl_orthoview) { setproperty(VF_FOV, GetOrthoviewFOV(ov_worldmin, ov_worldmax, ov_mid, ov_org)); }
- else if(csqcplayer.viewloc) { setproperty(VF_FOV, GetViewLocationFOV(110)); } // enforce 110 fov, so things dont look odd
- else { setproperty(VF_FOV, GetCurrentFov(fov)); }
+ View_UpdateFov();
- if(camera_active) // Camera for demo playback
- {
- if(autocvar_camera_enable)
- CSQC_Demo_Camera();
- else
- {
- cvar_set("chase_active", ftos(chase_active_backup));
- cvar_set("cl_demo_mousegrab", "0");
- camera_active = false;
- }
- }
- else
- {
-#ifdef CAMERATEST
- if(autocvar_camera_enable)
-#else
- if(autocvar_camera_enable && isdemo())
-#endif
- {
- // Enable required Darkplaces cvars
- chase_active_backup = autocvar_chase_active;
- cvar_set("chase_active", "2");
- cvar_set("cl_demo_mousegrab", "1");
- camera_active = true;
- camera_mode = false;
- }
- }
+ View_DemoCamera();
// Draw the Crosshair
setproperty(VF_DRAWCROSSHAIR, 0); //Make sure engine crosshairs are always hidden
addentities(MASK_NORMAL | MASK_ENGINE | MASK_ENGINEVIEWMODELS); // TODO: .health is used in cl_deathfade (a feature we have turned off currently)
renderscene();
- // now switch to 2D drawing mode by calling a 2D drawing function
- // then polygon drawing will draw as 2D stuff, and NOT get queued until the
- // next R_RenderScene call
- drawstring('0 0 0', "", '1 1 0', '1 1 1', 0, 0);
-
- if(autocvar_r_fakelight >= 2 || autocvar_r_fullbright)
- if (!(serverflags & SERVERFLAG_ALLOW_FULLBRIGHT))
- {
- // apply night vision effect
- vector tc_00, tc_01, tc_10, tc_11;
- vector rgb = '0 0 0';
-
- if(!nightvision_noise)
- {
- nightvision_noise = new(nightvision_noise);
- }
- if(!nightvision_noise2)
- {
- nightvision_noise2 = new(nightvision_noise2);
- }
-
- // color tint in yellow
- drawfill('0 0 0', autocvar_vid_conwidth * '1 0 0' + autocvar_vid_conheight * '0 1 0', '0.5 1 0.3', 1, DRAWFLAG_MODULATE);
-
- // draw BG
- a = Noise_Pink(nightvision_noise, frametime * 1.5) * 0.05 + 0.15;
- rgb = '1 1 1';
- tc_00 = '0 0 0' + '0.2 0 0' * sin(time * 0.3) + '0 0.3 0' * cos(time * 0.7);
- tc_01 = '0 2.25 0' + '0.6 0 0' * cos(time * 1.2) - '0 0.3 0' * sin(time * 2.2);
- tc_10 = '1.5 0 0' - '0.2 0 0' * sin(time * 0.5) + '0 0.5 0' * cos(time * 1.7);
- //tc_11 = '1 1 0' + '0.6 0 0' * sin(time * 0.6) + '0 0.3 0' * cos(time * 0.1);
- tc_11 = tc_01 + tc_10 - tc_00;
- R_BeginPolygon("gfx/nightvision-bg.tga", DRAWFLAG_ADDITIVE);
- R_PolygonVertex('0 0 0', tc_00, rgb, a);
- R_PolygonVertex(autocvar_vid_conwidth * '1 0 0', tc_10, rgb, a);
- R_PolygonVertex(autocvar_vid_conwidth * '1 0 0' + autocvar_vid_conheight * '0 1 0', tc_11, rgb, a);
- R_PolygonVertex(autocvar_vid_conheight * '0 1 0', tc_01, rgb, a);
- R_EndPolygon();
-
- // draw FG
- a = Noise_Pink(nightvision_noise2, frametime * 0.1) * 0.05 + 0.12;
- rgb = '0.3 0.6 0.4' + '0.1 0.4 0.2' * Noise_White(nightvision_noise2, frametime);
- tc_00 = '0 0 0' + '1 0 0' * Noise_White(nightvision_noise2, frametime) + '0 1 0' * Noise_White(nightvision_noise2, frametime);
- tc_01 = tc_00 + '0 3 0' * (1 + Noise_White(nightvision_noise2, frametime) * 0.2);
- tc_10 = tc_00 + '2 0 0' * (1 + Noise_White(nightvision_noise2, frametime) * 0.3);
- tc_11 = tc_01 + tc_10 - tc_00;
- R_BeginPolygon("gfx/nightvision-fg.tga", DRAWFLAG_ADDITIVE);
- R_PolygonVertex('0 0 0', tc_00, rgb, a);
- R_PolygonVertex(autocvar_vid_conwidth * '1 0 0', tc_10, rgb, a);
- R_PolygonVertex(autocvar_vid_conwidth * '1 0 0' + autocvar_vid_conheight * '0 1 0', tc_11, rgb, a);
- R_PolygonVertex(autocvar_vid_conheight * '0 1 0', tc_01, rgb, a);
- R_EndPolygon();
- }
-
- if(autocvar_cl_reticle && !MUTATOR_CALLHOOK(DrawReticle))
- {
- string reticle_image = string_null;
- bool wep_zoomed = false;
- for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
- {
- entity wepe = viewmodels[slot];
- Weapon wep = wepe.activeweapon;
- if(wep != WEP_Null && wep.wr_zoom)
- {
- bool do_zoom = wep.wr_zoom(wep, NULL);
- if(!reticle_image && wep.w_reticle && wep.w_reticle != "")
- reticle_image = wep.w_reticle;
- wep_zoomed += do_zoom;
- }
- }
- // Draw the aiming reticle for weapons that use it
- // reticle_type is changed to the item we are zooming / aiming with, to decide which reticle to use
- // It must be a persisted float for fading out to work properly (you let go of the zoom button for
- // the view to go back to normal, so reticle_type would become 0 as we fade out)
- if(spectatee_status || is_dead || hud != HUD_NORMAL || local_player.viewloc)
- {
- // no zoom reticle while dead
- reticle_type = 0;
- }
- else if(wep_zoomed && autocvar_cl_reticle_weapon)
- {
- if(reticle_image) { reticle_type = 2; }
- else { reticle_type = 0; }
- }
- else if(button_zoom || zoomscript_caught)
- {
- // normal zoom
- reticle_type = 1;
- }
-
- if(reticle_type)
- {
- if(autocvar_cl_reticle_stretch)
- {
- reticle_size.x = vid_conwidth;
- reticle_size.y = vid_conheight;
- reticle_pos.x = 0;
- reticle_pos.y = 0;
- }
- else
- {
- reticle_size.x = max(vid_conwidth, vid_conheight);
- reticle_size.y = max(vid_conwidth, vid_conheight);
- reticle_pos.x = (vid_conwidth - reticle_size.x) / 2;
- reticle_pos.y = (vid_conheight - reticle_size.y) / 2;
- }
-
- if(zoomscript_caught)
- f = 1;
- else
- f = current_zoomfraction;
-
- if(f)
- {
- switch(reticle_type)
- {
- case 1: drawpic(reticle_pos, "gfx/reticle_normal", reticle_size, '1 1 1', f * autocvar_cl_reticle_normal_alpha, DRAWFLAG_NORMAL); break;
- case 2: if(reticle_image) drawpic(reticle_pos, reticle_image, reticle_size, '1 1 1', f * autocvar_cl_reticle_weapon_alpha, DRAWFLAG_NORMAL); break;
- }
- }
- }
- }
- else
- {
- if(reticle_type != 0) { reticle_type = 0; }
- }
-
-
- // improved polyblend
- if(autocvar_hud_contents && !MUTATOR_CALLHOOK(HUD_Contents))
- {
- float contentalpha_temp, incontent, liquidalpha, contentfadetime;
- vector liquidcolor;
-
- switch(pointcontents(view_origin))
- {
- case CONTENT_WATER:
- liquidalpha = autocvar_hud_contents_water_alpha;
- liquidcolor = stov(autocvar_hud_contents_water_color);
- incontent = 1;
- break;
-
- case CONTENT_LAVA:
- liquidalpha = autocvar_hud_contents_lava_alpha;
- liquidcolor = stov(autocvar_hud_contents_lava_color);
- incontent = 1;
- break;
-
- case CONTENT_SLIME:
- liquidalpha = autocvar_hud_contents_slime_alpha;
- liquidcolor = stov(autocvar_hud_contents_slime_color);
- incontent = 1;
- break;
-
- default:
- liquidalpha = 0;
- liquidcolor = '0 0 0';
- incontent = 0;
- break;
- }
-
- if(incontent) // fade in/out at different speeds so you can do e.g. instant fade when entering water and slow when leaving it.
- { // also lets delcare previous values for blending properties, this way it isn't reset until after you have entered a different content
- contentfadetime = autocvar_hud_contents_fadeintime;
- liquidalpha_prev = liquidalpha;
- liquidcolor_prev = liquidcolor;
- }
- else
- contentfadetime = autocvar_hud_contents_fadeouttime;
-
- contentalpha_temp = bound(0, drawframetime / max(0.0001, contentfadetime), 1);
- contentavgalpha = contentavgalpha * (1 - contentalpha_temp) + incontent * contentalpha_temp;
-
- if(contentavgalpha)
- drawfill('0 0 0', vec2(vid_conwidth, vid_conheight), liquidcolor_prev, contentavgalpha * liquidalpha_prev, DRAWFLAG_NORMAL);
-
- if(autocvar_hud_postprocessing)
- {
- if(autocvar_hud_contents_blur && contentavgalpha)
- {
- content_blurpostprocess.x = 1;
- content_blurpostprocess.y = contentavgalpha * autocvar_hud_contents_blur;
- content_blurpostprocess.z = contentavgalpha * autocvar_hud_contents_blur_alpha;
- }
- else
- {
- content_blurpostprocess.x = 0;
- content_blurpostprocess.y = 0;
- content_blurpostprocess.z = 0;
- }
- }
- }
-
- if(autocvar_hud_damage && !STAT(FROZEN))
- {
- splash_size.x = max(vid_conwidth, vid_conheight);
- splash_size.y = max(vid_conwidth, vid_conheight);
- splash_pos.x = (vid_conwidth - splash_size.x) / 2;
- splash_pos.y = (vid_conheight - splash_size.y) / 2;
-
- float myhealth_flash_temp;
- myhealth = STAT(HEALTH);
-
- // fade out
- myhealth_flash = max(0, myhealth_flash - autocvar_hud_damage_fade_rate * frametime);
- // add new damage
- myhealth_flash = bound(0, myhealth_flash + dmg_take * autocvar_hud_damage_factor, autocvar_hud_damage_maxalpha);
-
- float pain_threshold, pain_threshold_lower, pain_threshold_lower_health;
- pain_threshold = autocvar_hud_damage_pain_threshold;
- pain_threshold_lower = autocvar_hud_damage_pain_threshold_lower;
- pain_threshold_lower_health = autocvar_hud_damage_pain_threshold_lower_health;
-
- if(pain_threshold_lower && myhealth < pain_threshold_lower_health)
- {
- pain_threshold = pain_threshold - max(autocvar_hud_damage_pain_threshold_pulsating_min, fabs(sin(M_PI * time / autocvar_hud_damage_pain_threshold_pulsating_period))) * pain_threshold_lower * (1 - max(0, myhealth)/pain_threshold_lower_health);
- }
-
- myhealth_flash_temp = bound(0, myhealth_flash - pain_threshold, 1);
-
- if(myhealth_prev < 1)
- {
- if(myhealth >= 1)
- {
- myhealth_flash = 0; // just spawned, clear the flash immediately
- myhealth_flash_temp = 0;
- }
- else
- {
- myhealth_flash += autocvar_hud_damage_fade_rate * frametime; // dead
- }
- }
-
- if(spectatee_status == -1 || intermission)
- {
- myhealth_flash = 0; // observing, or match ended
- myhealth_flash_temp = 0;
- }
-
- myhealth_prev = myhealth;
-
- // IDEA: change damage color/picture based on player model for robot/alien species?
- // pro: matches model better
- // contra: it's not red because blood is red, but because red is an alarming color, so red should stay
- // maybe different reddish pics?
- if(autocvar_cl_gentle_damage || autocvar_cl_gentle)
- {
- if(autocvar_cl_gentle_damage == 2)
- {
- if(myhealth_flash < pain_threshold) // only randomize when the flash is gone
- myhealth_gentlergb = randomvec();
- }
- else
- myhealth_gentlergb = stov(autocvar_hud_damage_gentle_color);
-
- if(myhealth_flash_temp > 0)
- drawfill('0 0 0', vec2(vid_conwidth, vid_conheight), myhealth_gentlergb, autocvar_hud_damage_gentle_alpha_multiplier * bound(0, myhealth_flash_temp, 1) * autocvar_hud_damage, DRAWFLAG_NORMAL);
- }
- else if(myhealth_flash_temp > 0)
- drawpic(splash_pos, "gfx/blood", splash_size, stov(autocvar_hud_damage_color), bound(0, myhealth_flash_temp, 1) * autocvar_hud_damage, DRAWFLAG_NORMAL);
-
- if(autocvar_hud_postprocessing) // we still need to set this anyway even when chase_active is set, this way it doesn't get stuck on.
- {
- if(autocvar_hud_damage_blur && myhealth_flash_temp)
- {
- damage_blurpostprocess.x = 1;
- damage_blurpostprocess.y = bound(0, myhealth_flash_temp, 1) * autocvar_hud_damage_blur;
- damage_blurpostprocess.z = bound(0, myhealth_flash_temp, 1) * autocvar_hud_damage_blur_alpha;
- }
- else
- {
- damage_blurpostprocess.x = 0;
- damage_blurpostprocess.y = 0;
- damage_blurpostprocess.z = 0;
- }
- }
- }
-
- float e1 = (autocvar_hud_postprocessing_maxbluralpha != 0);
- float e2 = (autocvar_hud_powerup != 0);
- if(autocvar_hud_postprocessing && (e1 || e2)) // TODO: Remove this code and re-do the postprocess handling in the engine, where it properly belongs.
- {
- // enable or disable rendering types if they are used or not
- if(cvar("r_glsl_postprocess_uservec1_enable") != e1) { cvar_set("r_glsl_postprocess_uservec1_enable", ftos(e1)); }
- if(cvar("r_glsl_postprocess_uservec2_enable") != e2) { cvar_set("r_glsl_postprocess_uservec2_enable", ftos(e2)); }
-
- // blur postprocess handling done first (used by hud_damage and hud_contents)
- if((damage_blurpostprocess.x || content_blurpostprocess.x))
- {
- float blurradius = bound(0, damage_blurpostprocess.y + content_blurpostprocess.y, autocvar_hud_postprocessing_maxblurradius);
- float bluralpha = bound(0, damage_blurpostprocess.z + content_blurpostprocess.z, autocvar_hud_postprocessing_maxbluralpha);
- if(blurradius != old_blurradius || bluralpha != old_bluralpha) // reduce cvar_set spam as much as possible
- {
- cvar_set("r_glsl_postprocess_uservec1", strcat(ftos(blurradius), " ", ftos(bluralpha), " 0 0"));
- old_blurradius = blurradius;
- old_bluralpha = bluralpha;
- }
- }
- else if(cvar_string("r_glsl_postprocess_uservec1") != "0 0 0 0") // reduce cvar_set spam as much as possible
- {
- cvar_set("r_glsl_postprocess_uservec1", "0 0 0 0");
- old_blurradius = 0;
- old_bluralpha = 0;
- }
-
- // edge detection postprocess handling done second (used by hud_powerup)
- float sharpen_intensity = 0, strength_finished = STAT(STRENGTH_FINISHED), invincible_finished = STAT(INVINCIBLE_FINISHED);
- if (strength_finished - time > 0) { sharpen_intensity += (strength_finished - time); }
- if (invincible_finished - time > 0) { sharpen_intensity += (invincible_finished - time); }
-
- sharpen_intensity = bound(0, ((STAT(HEALTH) > 0) ? sharpen_intensity : 0), 5); // Check to see if player is alive (if not, set 0) - also bound to fade out starting at 5 seconds.
-
- if(autocvar_hud_powerup && sharpen_intensity > 0)
- {
- if(sharpen_intensity != old_sharpen_intensity) // reduce cvar_set spam as much as possible
- {
- cvar_set("r_glsl_postprocess_uservec2", strcat(ftos((sharpen_intensity / 5) * autocvar_hud_powerup), " ", ftos(-sharpen_intensity * autocvar_hud_powerup), " 0 0"));
- old_sharpen_intensity = sharpen_intensity;
- }
- }
- else if(cvar_string("r_glsl_postprocess_uservec2") != "0 0 0 0") // reduce cvar_set spam as much as possible
- {
- cvar_set("r_glsl_postprocess_uservec2", "0 0 0 0");
- old_sharpen_intensity = 0;
- }
-
- if(cvar("r_glsl_postprocess") == 0)
- cvar_set("r_glsl_postprocess", "2");
- }
- else if(cvar("r_glsl_postprocess") == 2)
- cvar_set("r_glsl_postprocess", "0");
+ // Now the the scene has been rendered, begin with the 2D drawing functions
- /*if(ISGAMETYPE(CTF))
- {
- ctf_view();
- } else */
+ View_NightVision();
+ DrawReticle(local_player);
+ HUD_Contents();
+ HUD_Damage();
+ View_PostProcessing();
// draw 2D entities
IL_EACH(g_drawables_2d, it.draw2d, it.draw2d(it));
const int CURSOR_MOVE = 1;
const int CURSOR_RESIZE = 2;
const int CURSOR_RESIZE2 = 3;
+
+float drawtime;
string campaign_mapname[CAMPAIGN_MAX_ENTRIES];
float campaign_bots[CAMPAIGN_MAX_ENTRIES];
float campaign_botskill[CAMPAIGN_MAX_ENTRIES];
-float campaign_fraglimit[CAMPAIGN_MAX_ENTRIES];
-float campaign_timelimit[CAMPAIGN_MAX_ENTRIES];
+string campaign_fraglimit[CAMPAIGN_MAX_ENTRIES];
+string campaign_timelimit[CAMPAIGN_MAX_ENTRIES];
string campaign_mutators[CAMPAIGN_MAX_ENTRIES];
string campaign_shortdesc[CAMPAIGN_MAX_ENTRIES];
string campaign_longdesc[CAMPAIGN_MAX_ENTRIES];
CAMPAIGN_GETARG; campaign_mapname[campaign_entries] = strzone(a);
CAMPAIGN_GETARG; campaign_bots[campaign_entries] = stof(a);
CAMPAIGN_GETARG; campaign_botskill[campaign_entries] = stof(a);
- CAMPAIGN_GETARG; campaign_fraglimit[campaign_entries] = stof(a);
- CAMPAIGN_GETARG; campaign_timelimit[campaign_entries] = stof(a);
+ CAMPAIGN_GETARG; campaign_fraglimit[campaign_entries] = strzone(a);
+ CAMPAIGN_GETARG; campaign_timelimit[campaign_entries] = strzone(a);
CAMPAIGN_GETARG; campaign_mutators[campaign_entries] = strzone(a);
CAMPAIGN_GETARG; campaign_shortdesc[campaign_entries] = strzone(a);
CAMPAIGN_GETARG; campaign_longdesc[campaign_entries] = strzone(strreplace("\\n", "\n", a));
{
strfree(campaign_gametype[i]);
strfree(campaign_mapname[i]);
+ strfree(campaign_fraglimit[i]);
+ strfree(campaign_timelimit[i]);
strfree(campaign_mutators[i]);
strfree(campaign_shortdesc[i]);
strfree(campaign_longdesc[i]);
}
}
-GENERIC_COMMAND(dumpcommands, "Dump all commands on the program to <program>_cmd_dump.txt")
+GENERIC_COMMAND(dumpcommands, "Dump all commands on the program to <program>_cmd_dump.txt", false)
{
switch(request)
{
*/
// Do not hard code aliases for these, instead create them in commands.cfg... also: keep in alphabetical order, please ;)
-GENERIC_COMMAND(addtolist, "Add a string to a cvar") { GenericCommand_addtolist(request, arguments); }
-GENERIC_COMMAND(maplist, "Automatic control of maplist") { GenericCommand_maplist(request, arguments); }
-GENERIC_COMMAND(nextframe, "Execute the given command next frame of this VM") { GenericCommand_nextframe(request, command); }
-GENERIC_COMMAND(qc_curl, "Queries a URL") { GenericCommand_qc_curl(request, arguments); }
-GENERIC_COMMAND(removefromlist, "Remove a string from a cvar") { GenericCommand_removefromlist(request, arguments); }
-GENERIC_COMMAND(restartnotifs, "Re-initialize all notifications") { GenericCommand_restartnotifs(request); }
-GENERIC_COMMAND(rpn, "RPN calculator") { GenericCommand_rpn(request, arguments, command); }
-GENERIC_COMMAND(settemp, "Temporarily set a value to a cvar which is restored later") { GenericCommand_settemp(request, arguments); }
-GENERIC_COMMAND(settemp_restore, "Restore all cvars set by settemp command") { GenericCommand_settemp_restore(request); }
-GENERIC_COMMAND(runtest, "Run unit tests") { GenericCommand_runtest(request, arguments); }
+GENERIC_COMMAND(addtolist, "Add a string to a cvar", true) { GenericCommand_addtolist(request, arguments); }
+GENERIC_COMMAND(maplist, "Automatic control of maplist", true) { GenericCommand_maplist(request, arguments); }
+GENERIC_COMMAND(nextframe, "Execute the given command next frame of this VM", true) { GenericCommand_nextframe(request, command); }
+GENERIC_COMMAND(qc_curl, "Queries a URL", true) { GenericCommand_qc_curl(request, arguments); }
+GENERIC_COMMAND(removefromlist, "Remove a string from a cvar", true) { GenericCommand_removefromlist(request, arguments); }
+GENERIC_COMMAND(restartnotifs, "Re-initialize all notifications", false) { GenericCommand_restartnotifs(request); }
+GENERIC_COMMAND(rpn, "RPN calculator", true) { GenericCommand_rpn(request, arguments, command); }
+GENERIC_COMMAND(settemp, "Temporarily set a value to a cvar which is restored later", false) { GenericCommand_settemp(request, arguments); }
+GENERIC_COMMAND(settemp_restore, "Restore all cvars set by settemp command", false) { GenericCommand_settemp_restore(request); }
+GENERIC_COMMAND(runtest, "Run unit tests", false) { GenericCommand_runtest(request, arguments); }
void GenericCommand_macro_help()
{
REGISTER_REGISTRY(GENERIC_COMMANDS)
REGISTRY_SORT(GENERIC_COMMANDS)
-#define GENERIC_COMMAND(id, description) \
+.bool m_menubased; // switch to tell whether this alias should be registered as a menu or client based command
+
+#define GENERIC_COMMAND(id, description, menubased) \
CLASS(genericcommand_##id, Command) \
ATTRIB(genericcommand_##id, m_name, string, #id); \
ATTRIB(genericcommand_##id, m_description, string, description); \
+ ATTRIB(genericcommand_##id, m_menubased, bool, menubased); \
ENDCLASS(genericcommand_##id) \
REGISTER(GENERIC_COMMANDS, CMD_G, id, m_id, NEW(genericcommand_##id)); \
METHOD(genericcommand_##id, m_invokecmd, void(genericcommand_##id this, int request, entity caller, int arguments, string command))
STATIC_INIT(GENERIC_COMMANDS_aliases) {
- FOREACH(GENERIC_COMMANDS, true, localcmd(sprintf("alias %1$s \"%2$s %1$s ${* ?}\"\n", it.m_name, "qc_cmd_svmenu")));
+ FOREACH(GENERIC_COMMANDS, true, localcmd(sprintf("alias %1$s \"%2$s %1$s ${* ?}\"\n", it.m_name, ((it.m_menubased) ? "qc_cmd_svmenu" : "qc_cmd_svcl"))));
}
void rpn_pushf(float f) { return rpn_push(sprintf("%.9g", f)); }
void rpn_setf(float f) { return rpn_set(sprintf("%.9g", f)); }
+SHUTDOWN(_rpndb)
+{
+ if(rpn_db)
+ db_close(rpn_db);
+}
+
void GenericCommand_rpn(int request, int argc, string command)
{
switch(request)
#endif
-GENERIC_COMMAND(bufstr_get, "Examine a string buffer object")
+GENERIC_COMMAND(bufstr_get, "Examine a string buffer object", false)
{
switch (request)
{
}
-GENERIC_COMMAND(version, "Print the current version")
+GENERIC_COMMAND(version, "Print the current version", false)
{
switch (request)
{
#ifdef CSQC
void(float bufhandle, string pattern, string antipattern) buf_cvarlist = #517;
#endif
-GENERIC_COMMAND(cvar_localchanges, "Print locally changed cvars")
+GENERIC_COMMAND(cvar_localchanges, "Print locally changed cvars", false)
{
switch (request)
{
#endif
-GENERIC_COMMAND(find, "Search through entities for matching classname")
+GENERIC_COMMAND(find, "Search through entities for matching classname", false)
{
switch (request)
{
}
-GENERIC_COMMAND(findat, "Search through entities for matching origin")
+GENERIC_COMMAND(findat, "Search through entities for matching origin", false)
{
switch (request)
{
#undef WRITE
}
-GENERIC_COMMAND(dumpeffectinfo, "Dump all effectinfo to effectinfo_dump.txt")
+GENERIC_COMMAND(dumpeffectinfo, "Dump all effectinfo to effectinfo_dump.txt", false)
{
switch (request) {
case CMD_REQUEST_COMMAND: {
#ifdef SVQC
void SpawnCasing(vector vel, float randomvel, vector ang, vector avel, float randomavel, int casingtype, entity casingowner, .entity weaponentity)
{
- if (!(CS(casingowner).cvar_cl_casings))
- return;
-
- entity wep = casingowner.(weaponentity);
- vector org = casingowner.origin + casingowner.view_ofs + wep.spawnorigin.x * v_forward - wep.spawnorigin.y * v_right + wep.spawnorigin.z * v_up;
-
- if (!sound_allowed(MSG_BROADCAST, casingowner))
- casingtype |= 0x80;
-
- WriteHeader(MSG_ALL, casings);
- WriteByte(MSG_ALL, casingtype);
- WriteVector(MSG_ALL, org);
- WriteShort(MSG_ALL, compressShortVector(vel)); // actually compressed velocity
- WriteByte(MSG_ALL, ang.x * 256 / 360);
- WriteByte(MSG_ALL, ang.y * 256 / 360);
- WriteByte(MSG_ALL, ang.z * 256 / 360);
+ entity wep = casingowner.(weaponentity);
+ vector org = casingowner.origin + casingowner.view_ofs + wep.spawnorigin.x * v_forward - wep.spawnorigin.y * v_right + wep.spawnorigin.z * v_up;
+
+ FOREACH_CLIENT(true, {
+ if (!(CS(it).cvar_cl_casings))
+ continue;
+
+ msg_entity = it;
+ if (!sound_allowed(MSG_ONE, it))
+ casingtype |= 0x80; // silent
+
+ WriteHeader(MSG_ONE, casings);
+ WriteByte(MSG_ONE, casingtype);
+ WriteVector(MSG_ONE, org);
+ WriteShort(MSG_ONE, compressShortVector(vel)); // actually compressed velocity
+ WriteByte(MSG_ONE, ang.x * 256 / 360);
+ WriteByte(MSG_ONE, ang.y * 256 / 360);
+ WriteByte(MSG_ONE, ang.z * 256 / 360);
+ });
}
#endif
casing.velocity = casing.velocity + 2 * prandomvec();
casing.avelocity = '0 250 0' + 100 * prandomvec();
set_movetype(casing, MOVETYPE_BOUNCE);
+ casing.bouncefactor = 0.25;
settouch(casing, Casing_Touch);
casing.move_time = time;
casing.event_damage = Casing_Damage;
if (GetPlayerSoundSampleField_notFound) field = GetVoiceMessageSampleField(key);
if (GetPlayerSoundSampleField_notFound)
{
- LOG_TRACEF("Invalid sound info field: %s", key);
+ LOG_TRACEF("Invalid sound info field in player sound file '%s': %s", f, key);
continue;
}
string file = argv(1);
.bool instanceOfVoiceMessage;
.int m_playersoundvt;
-#define REGISTER_VOICEMSG(id, vt) \
+#define REGISTER_VOICEMSG(id, vt, listed) \
.string _playersound_##id; \
REGISTER(PlayerSounds, playersound, id, m_id, new_pure(VoiceMessage)) \
{ \
- this.instanceOfVoiceMessage = true; \
+ this.instanceOfVoiceMessage = listed; \
this.m_playersoundstr = #id; \
this.m_playersoundfld = _playersound_##id; \
this.m_playersoundvt = vt; \
const int VOICETYPE_AUTOTAUNT = 14;
const int VOICETYPE_TAUNT = 15;
-REGISTER_VOICEMSG(attack, VOICETYPE_TEAMRADIO)
-REGISTER_VOICEMSG(attackinfive, VOICETYPE_TEAMRADIO)
-REGISTER_VOICEMSG(coverme, VOICETYPE_TEAMRADIO)
-REGISTER_VOICEMSG(defend, VOICETYPE_TEAMRADIO)
-REGISTER_VOICEMSG(freelance, VOICETYPE_TEAMRADIO)
-REGISTER_VOICEMSG(incoming, VOICETYPE_TEAMRADIO)
-REGISTER_VOICEMSG(meet, VOICETYPE_TEAMRADIO)
-REGISTER_VOICEMSG(needhelp, VOICETYPE_TEAMRADIO)
-REGISTER_VOICEMSG(seenflag, VOICETYPE_TEAMRADIO)
-REGISTER_VOICEMSG(taunt, VOICETYPE_TAUNT)
-REGISTER_VOICEMSG(teamshoot, VOICETYPE_LASTATTACKER)
-
-// reserved sound names for the future (some models lack sounds for them):
-// _VOICEMSG(flagcarriertakingdamage)
-// _VOICEMSG(getflag)
-// reserved sound names for the future (ALL models lack sounds for them):
-// _VOICEMSG(affirmative)
-// _VOICEMSG(attacking)
-// _VOICEMSG(defending)
-// _VOICEMSG(roaming)
-// _VOICEMSG(onmyway)
-// _VOICEMSG(droppedflag)
-// _VOICEMSG(negative)
-// _VOICEMSG(seenenemy)
+REGISTER_VOICEMSG(attack, VOICETYPE_TEAMRADIO, true)
+REGISTER_VOICEMSG(attackinfive, VOICETYPE_TEAMRADIO, true)
+REGISTER_VOICEMSG(coverme, VOICETYPE_TEAMRADIO, true)
+REGISTER_VOICEMSG(defend, VOICETYPE_TEAMRADIO, true)
+REGISTER_VOICEMSG(freelance, VOICETYPE_TEAMRADIO, true)
+REGISTER_VOICEMSG(incoming, VOICETYPE_TEAMRADIO, true)
+REGISTER_VOICEMSG(meet, VOICETYPE_TEAMRADIO, true)
+REGISTER_VOICEMSG(needhelp, VOICETYPE_TEAMRADIO, true)
+REGISTER_VOICEMSG(seenflag, VOICETYPE_TEAMRADIO, true)
+REGISTER_VOICEMSG(taunt, VOICETYPE_TAUNT, true)
+REGISTER_VOICEMSG(teamshoot, VOICETYPE_LASTATTACKER, true)
+
+//NOTE: some models lack sounds for these:
+REGISTER_VOICEMSG(flagcarriertakingdamage, VOICETYPE_TEAMRADIO, false)
+REGISTER_VOICEMSG(getflag, VOICETYPE_TEAMRADIO, false)
+//NOTE: ALL models lack sounds for these (only available in default sounds currently):
+REGISTER_VOICEMSG(affirmative, VOICETYPE_TEAMRADIO, false)
+REGISTER_VOICEMSG(attacking, VOICETYPE_TEAMRADIO, false)
+REGISTER_VOICEMSG(defending, VOICETYPE_TEAMRADIO, false)
+REGISTER_VOICEMSG(roaming, VOICETYPE_TEAMRADIO, false)
+REGISTER_VOICEMSG(onmyway, VOICETYPE_TEAMRADIO, false)
+REGISTER_VOICEMSG(droppedflag, VOICETYPE_TEAMRADIO, false)
+REGISTER_VOICEMSG(negative, VOICETYPE_TEAMRADIO, false)
+REGISTER_VOICEMSG(seenenemy, VOICETYPE_TEAMRADIO, false)
.string m_globalsoundstr;
REGISTRY(GlobalSounds, BITS(8) - 1)
float autocvar_g_ctf_flag_return_damage;
float autocvar_g_ctf_flag_return_damage_delay;
float autocvar_g_ctf_flag_return_dropped;
+bool autocvar_g_ctf_flag_waypoint = true;
+float autocvar_g_ctf_flag_waypoint_maxdistance;
float autocvar_g_ctf_flagcarrier_auto_helpme_damage;
float autocvar_g_ctf_flagcarrier_auto_helpme_time;
float autocvar_g_ctf_flagcarrier_selfdamagefactor;
default: basename = WP_FlagBaseNeutral; break;
}
- entity wp = WaypointSprite_SpawnFixed(basename, this.origin + FLAG_WAYPOINT_OFFSET, this, wps_flagbase, RADARICON_FLAG);
- wp.colormod = ((this.team) ? Team_ColorRGB(this.team) : '1 1 1');
- WaypointSprite_UpdateTeamRadar(this.wps_flagbase, RADARICON_FLAG, ((this.team) ? colormapPaletteColor(this.team - 1, false) : '1 1 1'));
- setcefc(wp, ctf_FlagBase_Customize);
+ if(autocvar_g_ctf_flag_waypoint)
+ {
+ entity wp = WaypointSprite_SpawnFixed(basename, this.origin + FLAG_WAYPOINT_OFFSET, this, wps_flagbase, RADARICON_FLAG);
+ wp.colormod = ((this.team) ? Team_ColorRGB(this.team) : '1 1 1');
+ wp.fade_rate = autocvar_g_ctf_flag_waypoint_maxdistance;
+ WaypointSprite_UpdateTeamRadar(this.wps_flagbase, RADARICON_FLAG, ((this.team) ? colormapPaletteColor(this.team - 1, false) : '1 1 1'));
+ setcefc(wp, ctf_FlagBase_Customize);
+ }
// captureshield setup
ctf_CaptureShield_Spawn(this);
.bool pushable;
-void ctf_FlagSetup(int teamnumber, entity flag) // called when spawning a flag entity on the map as a spawnfunc
+void ctf_FlagSetup(int teamnum, entity flag) // called when spawning a flag entity on the map as a spawnfunc
{
// main setup
flag.ctf_worldflagnext = ctf_worldflaglist; // link flag into ctf_worldflaglist
setattachment(flag, NULL, "");
- flag.netname = strzone(sprintf("%s%s^7 flag", Team_ColorCode(teamnumber), Team_ColorName_Upper(teamnumber)));
- flag.team = teamnumber;
+ flag.netname = strzone(sprintf("%s%s^7 flag", Team_ColorCode(teamnum), Team_ColorName_Upper(teamnum)));
+ flag.team = teamnum;
flag.classname = "item_flag_team";
flag.target = "###item###"; // for finding the nearest item using findnearest
flag.flags = FL_ITEM | FL_NOTARGET;
if(autocvar_g_ctf_score_ignore_fields)
flag.cnt = flag.score_assist = flag.score_team_capture = flag.score_capture = flag.score_drop = flag.score_pickup = flag.score_return = 0;
- string teamname = Static_Team_ColorName_Lower(teamnumber);
+ string teamname = Static_Team_ColorName_Lower(teamnum);
// appearence
if(!flag.scale) { flag.scale = FLAG_SCALE; }
if(flag.skin == 0) { flag.skin = cvar(sprintf("g_ctf_flag_%s_skin", teamname)); }
if(flag.model == "") { flag.model = cvar_string(sprintf("g_ctf_flag_%s_model", teamname)); }
- if (flag.toucheffect == "") { flag.toucheffect = EFFECT_FLAG_TOUCH(teamnumber).eent_eff_name; }
- if (flag.passeffect == "") { flag.passeffect = EFFECT_PASS(teamnumber).eent_eff_name; }
- if (flag.capeffect == "") { flag.capeffect = EFFECT_CAP(teamnumber).eent_eff_name; }
+ if (flag.toucheffect == "") { flag.toucheffect = EFFECT_FLAG_TOUCH(teamnum).eent_eff_name; }
+ if (flag.passeffect == "") { flag.passeffect = EFFECT_PASS(teamnum).eent_eff_name; }
+ if (flag.capeffect == "") { flag.capeffect = EFFECT_CAP(teamnum).eent_eff_name; }
// sounds
#define X(s,b) \
if(flag.s == "") flag.s = b; \
precache_sound(flag.s);
- X(snd_flag_taken, strzone(SND(CTF_TAKEN(teamnumber))))
- X(snd_flag_returned, strzone(SND(CTF_RETURNED(teamnumber))))
- X(snd_flag_capture, strzone(SND(CTF_CAPTURE(teamnumber))))
- X(snd_flag_dropped, strzone(SND(CTF_DROPPED(teamnumber))))
+ X(snd_flag_taken, strzone(SND(CTF_TAKEN(teamnum))))
+ X(snd_flag_returned, strzone(SND(CTF_RETURNED(teamnum))))
+ X(snd_flag_capture, strzone(SND(CTF_CAPTURE(teamnum))))
+ X(snd_flag_dropped, strzone(SND(CTF_DROPPED(teamnum))))
X(snd_flag_respawn, strzone(SND(CTF_RESPAWN)))
X(snd_flag_touch, strzone(SND(CTF_TOUCH)))
X(snd_flag_pass, strzone(SND(CTF_PASS)))
if(autocvar_g_ctf_flag_glowtrails)
{
- switch(teamnumber)
+ switch(teamnum)
{
case NUM_TEAM_1: flag.glow_color = 251; break;
case NUM_TEAM_2: flag.glow_color = 210; break;
if(autocvar_g_ctf_fullbrightflags) { flag.effects |= EF_FULLBRIGHT; }
if(autocvar_g_ctf_dynamiclights)
{
- switch(teamnumber)
+ switch(teamnum)
{
case NUM_TEAM_1: flag.effects |= EF_RED; break;
case NUM_TEAM_2: flag.effects |= EF_BLUE; break;
if(!round_handler_IsRoundStarted())
return true;
- int n;
entity player = M_ARGV(0, entity);
//if (STAT(FROZEN, player) == FROZEN_NORMAL)
//if(player.freezetag_frozen_timeout > 0 && time < player.freezetag_frozen_timeout)
//player.iceblock.alpha = ICE_MIN_ALPHA + (ICE_MAX_ALPHA - ICE_MIN_ALPHA) * (player.freezetag_frozen_timeout - time) / (player.freezetag_frozen_timeout - player.freezetag_frozen_time);
+ if (!(frametime && IS_PLAYER(player)))
+ return true;
+
entity reviving_players_last = NULL;
entity reviving_players_first = NULL;
+ int n;
if(player.freezetag_frozen_timeout > 0 && time >= player.freezetag_frozen_timeout)
n = -1;
else
return true; // you deceptive little bugger ;3 This needs to be true in order for this function to even count.
}
+MUTATOR_HOOKFUNCTION(ka, Scores_CountFragsRemaining)
+{
+ // announce remaining frags, but only when timed scoring is off
+ return !autocvar_g_keepaway_score_timepoints;
+}
+
MUTATOR_HOOKFUNCTION(ka, PlayerPreThink)
{
entity player = M_ARGV(0, entity);
// Main Control Point Functions
// =============================
-int ons_ControlPoint_CanBeLinked(entity cp, int teamnumber)
+int ons_ControlPoint_CanBeLinked(entity cp, int teamnum)
{
- if(cp.aregensneighbor & BIT(teamnumber)) return 2;
- if(cp.arecpsneighbor & BIT(teamnumber)) return 1;
+ if(cp.aregensneighbor & BIT(teamnum)) return 2;
+ if(cp.arecpsneighbor & BIT(teamnum)) return 1;
return 0;
}
-int ons_ControlPoint_Attackable(entity cp, int teamnumber)
+int ons_ControlPoint_Attackable(entity cp, int teamnum)
// -2: SAME TEAM, attackable by enemy!
// -1: SAME TEAM!
// 0: off limits
else if(cp.goalentity)
{
// if there's already an icon built, nothing happens
- if(cp.team == teamnumber)
+ if(cp.team == teamnum)
{
- a = ons_ControlPoint_CanBeLinked(cp, teamnumber);
+ a = ons_ControlPoint_CanBeLinked(cp, teamnum);
if(a) // attackable by enemy?
return -2; // EMERGENCY!
return -1;
}
// we know it can be linked, so no need to check
// but...
- a = ons_ControlPoint_CanBeLinked(cp, teamnumber);
+ a = ons_ControlPoint_CanBeLinked(cp, teamnum);
if(a == 2) // near our generator?
return 3; // EMERGENCY!
return 1;
else
{
// free point
- if(ons_ControlPoint_CanBeLinked(cp, teamnumber))
+ if(ons_ControlPoint_CanBeLinked(cp, teamnum))
{
- a = ons_ControlPoint_CanBeLinked(cp, teamnumber); // why was this here NUM_TEAM_1 + NUM_TEAM_2 - t
+ a = ons_ControlPoint_CanBeLinked(cp, teamnum); // why was this here NUM_TEAM_1 + NUM_TEAM_2 - t
if(a == 2)
return 4; // GET THIS ONE NOW!
else
void ons_GeneratorSetup(entity gen) // called when spawning a generator entity on the map as a spawnfunc
{
// declarations
- int teamnumber = gen.team;
+ int teamnum = gen.team;
// main setup
gen.ons_worldgeneratornext = ons_worldgeneratorlist; // link generator into ons_worldgeneratorlist
ons_worldgeneratorlist = gen;
- gen.netname = sprintf("%s generator", Team_ColoredFullName(teamnumber));
+ gen.netname = sprintf("%s generator", Team_ColoredFullName(teamnum));
gen.classname = "onslaught_generator";
gen.solid = SOLID_BBOX;
- gen.team_saved = teamnumber;
+ gen.team_saved = teamnum;
IL_PUSH(g_saved_team, gen);
set_movetype(gen, MOVETYPE_NONE);
gen.lasthealth = gen.max_health = autocvar_g_onslaught_gen_health;
// model handled by CSQC
setsize(gen, GENERATOR_MIN, GENERATOR_MAX);
setorigin(gen, (gen.origin + CPGEN_SPAWN_OFFSET));
- gen.colormap = 1024 + (teamnumber - 1) * 17;
+ gen.colormap = 1024 + (teamnum - 1) * 17;
// generator placement
droptofloor(gen);
// declarations for functions used outside gamemode_onslaught.qc
void ons_Generator_UpdateSprite(entity e);
void ons_ControlPoint_UpdateSprite(entity e);
-bool ons_ControlPoint_Attackable(entity cp, int teamnumber);
+bool ons_ControlPoint_Attackable(entity cp, int teamnum);
// CaptureShield: Prevent capturing or destroying control point/generator if it is not available yet
float ons_captureshield_force; // push force of the shield
void Dump_Items();
-GENERIC_COMMAND(dumpitems, "Dump all items to the console") {
+GENERIC_COMMAND(dumpitems, "Dump all items to the console", false) {
switch (request) {
case CMD_REQUEST_COMMAND: {
Dump_Items();
.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);
+ LOG_DEBUGF("%s: %.0f -> %.0f", it.m_name, prev, next);
}
}
return true;
fputs(fh, sprintf("gametype %s // defaults: %s\n", MapInfo_Type_ToString(it), _MapInfo_GetDefaultEx(it)));
});
- if(fexists(strcat("scripts/", pFilename, ".arena")))
- fputs(fh, "settemp_for_type all sv_q3acompat_machineshotgunswap 1\n");
-
- if(fexists(strcat("scripts/", pFilename, ".defi")))
- fputs(fh, "settemp_for_type all sv_vq3compat 1\n");
-
fputs(fh, "// optional: fog density red green blue alpha mindist maxdist\n");
fputs(fh, "// optional: settemp_for_type (all|gametypename) cvarname value\n");
fputs(fh, "// optional: clientsettemp_for_type (all|gametypename) cvarname value\n");
int MapInfo_CurrentFeatures()
{
int req = 0;
- if(!(cvar("g_lms") || cvar("g_instagib") || cvar("g_overkill") || cvar("g_nix") || cvar("g_weaponarena") || !cvar("g_pickup_items") || cvar("g_race") || cvar("g_cts") || cvar("g_nexball")))
+ // TODO: find a better way to check if weapons are required on the map
+ if(!(cvar("g_instagib") || cvar("g_overkill") || cvar("g_nix") || cvar("g_weaponarena") || !cvar("g_pickup_items")
+ || cvar("g_race") || cvar("g_cts") || cvar("g_nexball") || cvar("g_ca") || cvar("g_freezetag") || cvar("g_lms")))
req |= MAPINFO_FEATURE_WEAPONS;
return req;
}
this.dmg_force = 200;
this.mdl = this.model;
- SetBrushEntityModel(this);
+ SetBrushEntityModel(this, true);
if(this.spawnflags & BREAKABLE_NODAMAGE)
this.use = func_breakable_destroy;
if (!this.lip)
this.lip = 4;
+ if(this.wait == -1 && autocvar_sv_q3defragcompat)
+ this.wait = 0.1; // compatibility for q3df: "instant" return
+
if(this.noise != "")
precache_sound(this.noise);
this.angles = '0 0 0';
set_movetype(this, MOVETYPE_NONE);
this.solid = SOLID_NOT;
- SetBrushEntityModel(this);
+ SetBrushEntityModel(this, true);
if (!this.cnt)
{
this.cnt = 12;
this.angles = '0 0 0';
set_movetype(this, MOVETYPE_NONE);
this.solid = SOLID_NOT;
- SetBrushEntityModel(this);
+ SetBrushEntityModel(this, true);
if (!this.cnt)
{
this.cnt = 12;
#define G_MODEL_INIT(ent,sol) \
if(ent.geomtype && autocvar_physics_ode && checkextension("DP_PHYSICS_ODE")) set_movetype(ent, MOVETYPE_PHYSICS); \
if(!ent.scale) ent.scale = ent.modelscale; \
- SetBrushEntityModel(ent); \
+ SetBrushEntityModel(ent,true); \
ent.use = g_model_setcolormaptoactivator; \
InitializeEntity(ent, g_model_dropbyspawnflags, INITPRIO_DROPTOFLOOR); \
if(!ent.solid) ent.solid = (sol); \
#define G_CLIENTMODEL_INIT(ent,sol) \
if(ent.geomtype && autocvar_physics_ode && checkextension("DP_PHYSICS_ODE")) set_movetype(ent, MOVETYPE_PHYSICS); \
if(!ent.scale) ent.scale = ent.modelscale; \
- SetBrushEntityModel(ent); \
+ SetBrushEntityModel(ent,true); \
ent.use = g_clientmodel_use; \
InitializeEntity(ent, g_clientmodel_dropbyspawnflags, INITPRIO_DROPTOFLOOR); \
if(!ent.solid) ent.solid = (sol); \
setsize(e, e.mins, e.maxs);
}
-void SetBrushEntityModel(entity this)
+void SetBrushEntityModel(entity this, bool with_lod)
{
if(this.model != "")
{
}
else
_setmodel(this, this.model); // no precision needed
- InitializeEntity(this, LODmodel_attach, INITPRIO_FINDTARGET);
- }
- setorigin(this, this.origin);
- ApplyMinMaxScaleAngles(this);
-}
+ if(with_lod)
+ InitializeEntity(this, LODmodel_attach, INITPRIO_FINDTARGET);
-void SetBrushEntityModelNoLOD(entity this)
-{
- if(this.model != "")
- {
- precache_model(this.model);
- if(this.mins != '0 0 0' || this.maxs != '0 0 0')
- {
- vector mi = this.mins;
- vector ma = this.maxs;
- _setmodel(this, this.model); // no precision needed
- setsize(this, mi, ma);
- }
- else
- _setmodel(this, this.model); // no precision needed
+ if(endsWith(this.model, ".obj")) // WORKAROUND: darkplaces currently rotates .obj models on entities incorrectly, we need to add 180 degrees to the Y axis
+ this.angles_y = anglemods(this.angles_y - 180);
}
setorigin(this, this.origin);
ApplyMinMaxScaleAngles(this);
// to mean no restrictions, so use a yaw of 360 instead.
SetMovedir(this);
this.solid = SOLID_TRIGGER;
- SetBrushEntityModelNoLOD(this);
+ SetBrushEntityModel(this, false);
set_movetype(this, MOVETYPE_NONE);
this.modelindex = 0;
this.model = "";
// to mean no restrictions, so use a yaw of 360 instead.
SetMovedir(this);
this.solid = SOLID_BSP;
- SetBrushEntityModelNoLOD(this);
+ SetBrushEntityModel(this, false);
set_movetype(this, MOVETYPE_NONE); // why was this PUSH? -div0
// this.modelindex = 0;
this.model = "";
// trigger angles are used for one-way touches. An angle of 0 is assumed
// to mean no restrictions, so use a yaw of 360 instead.
this.solid = SOLID_BSP;
- SetBrushEntityModel(this);
+ SetBrushEntityModel(this, true);
set_movetype(this, MOVETYPE_PUSH);
if(this.modelindex == 0)
{
#ifdef SVQC
void ApplyMinMaxScaleAngles(entity e);
-void SetBrushEntityModel(entity this);
-
-void SetBrushEntityModelNoLOD(entity this);
+void SetBrushEntityModel(entity this, bool with_lod);
int autocvar_loddebug;
.string lodtarget1;
if (toucher.triggerhurttime < time)
{
EXACTTRIGGER_TOUCH(this, toucher);
- toucher.triggerhurttime = time + ((autocvar_sv_vq3compat && !(this.spawnflags & HURT_SLOW)) ? 0.1 : 1);
+ toucher.triggerhurttime = time + ((autocvar_sv_q3defragcompat && !(this.spawnflags & HURT_SLOW)) ? 0.1 : 1);
entity own;
own = this.enemy;
this.use = trigger_hurt_use;
this.enemy = world; // I hate you all
if (!this.dmg)
- this.dmg = ((autocvar_sv_vq3compat) ? 5 : 10000);
+ this.dmg = ((autocvar_sv_q3defragcompat) ? 5 : 10000);
if (this.message == "")
this.message = "was in the wrong place";
if (this.message2 == "")
torg = tgt.origin + (tgt.mins + tgt.maxs) * 0.5;
grav = PHYS_GRAVITY(NULL);
- if(pushed_entity && PHYS_ENTGRAVITY(pushed_entity))
- grav *= PHYS_ENTGRAVITY(pushed_entity);
+ if(pushed_entity && pushed_entity.gravity)
+ grav *= pushed_entity.gravity;
zdist = torg.z - org.z;
sdist = vlen(torg - org - zdist * '0 0 1');
vector org = targ.origin;
#ifdef SVQC
- if(autocvar_sv_vq3compat)
+ if(autocvar_sv_q3defragcompat)
#elif defined(CSQC)
- if(STAT(VQ3COMPAT))
+ if(STAT(Q3DEFRAGCOMPAT))
#endif
{
org.z += targ.mins_z;
this.wait = 0;
this.use = multi_use;
+ if(this.wait == -1 && autocvar_sv_q3defragcompat)
+ this.wait = 0.1; // compatibility for q3df: "instant" return
+
EXACTTRIGGER_INIT;
this.team_saved = this.team;
==============================
*/
-void SUB_UseTargets_Ex(entity this, entity actor, entity trigger, bool preventReuse)
+void SUB_UseTargets_Ex(entity this, entity actor, entity trigger, bool preventReuse, int skiptargets)
{
//
// check for a delay
t.enemy = actor;
t.message = this.message;
t.killtarget = this.killtarget;
- t.target = this.target;
- t.target2 = this.target2;
- t.target3 = this.target3;
- t.target4 = this.target4;
+ if(!(skiptargets & BIT(1))) t.target = this.target;
+ if(!(skiptargets & BIT(2))) t.target2 = this.target2;
+ if(!(skiptargets & BIT(3))) t.target3 = this.target3;
+ if(!(skiptargets & BIT(4))) t.target4 = this.target4;
t.antiwall_flag = this.antiwall_flag;
return;
}
for(int i = 0; i < 4; ++i)
{
+ if(skiptargets & BIT(i + 1))
+ continue;
switch(i)
{
default:
}
}
-void SUB_UseTargets(entity this, entity actor, entity trigger) { SUB_UseTargets_Ex(this, actor, trigger, false); }
-void SUB_UseTargets_PreventReuse(entity this, entity actor, entity trigger) { SUB_UseTargets_Ex(this, actor, trigger, true); }
+void SUB_UseTargets(entity this, entity actor, entity trigger) { SUB_UseTargets_Ex(this, actor, trigger, false, 0); }
+void SUB_UseTargets_PreventReuse(entity this, entity actor, entity trigger) { SUB_UseTargets_Ex(this, actor, trigger, true, 0); }
+void SUB_UseTargets_SkipTargets(entity this, entity actor, entity trigger, int skiptargets) { SUB_UseTargets_Ex(this, actor, trigger, false, skiptargets); }
void SUB_UseTargets_PreventReuse(entity this, entity actor, entity trigger);
+// allow excluding certain .target* fields without needing to nullify them
+// use BIT(1) through BIT(4)
+void SUB_UseTargets_SkipTargets(entity this, entity actor, entity trigger, int skiptargets);
+
void generic_setactive(entity this, int act);
// generic methods for netlinked entities
void generic_netlinked_reset(entity this);
actor.anim_finished = time + 1;
}
if (isPlayer) actor.enemy = Monster_FindTarget(actor);
+ monster_makevectors(actor, actor.enemy);
W_SetupShot_Dir(actor, weaponentity, v_forward, false, 0, SND_SpiderAttack_FIRE, CH_WEAPON_B, 0, DEATH_MONSTER_SPIDER.m_id);
if (!isPlayer) w_shotdir = normalize((actor.enemy.origin + '0 0 10') - actor.origin);
M_Spider_Attack_Web(actor);
TC(WyvernAttack, thiswep);
if (fire & 1)
if (time > actor.attack_finished_single[0] || weapon_prepareattack(thiswep, actor, weaponentity, false, 1.2)) {
+ monster_makevectors(actor, actor.enemy);
if (IS_PLAYER(actor)) W_SetupShot_Dir(actor, weaponentity, v_forward, false, 0, SND_WyvernAttack_FIRE, CH_WEAPON_B, 0, DEATH_MONSTER_WYVERN.m_id);
if (IS_MONSTER(actor)) {
actor.attack_finished_single[0] = time + 1.2;
/**/ o(string, MUTATOR_ARGV_1_string) \
/**/
MUTATOR_HOOKABLE(WeaponModel, EV_WeaponModel);
+
+/** decides whether a player can crouch or not */
+#define EV_PlayerCanCrouch(i, o) \
+ /** player */ i(entity, MUTATOR_ARGV_0_entity) \
+ /** do_crouch */ i(bool, MUTATOR_ARGV_1_bool) \
+ /**/ o(bool, MUTATOR_ARGV_1_bool) \
+ /**/
+MUTATOR_HOOKABLE(PlayerCanCrouch, EV_PlayerCanCrouch);
// generated file; do not modify
-#ifdef SVQC
- #include <common/mutators/mutator/bloodloss/sv_bloodloss.qc>
-#endif
+#include <common/mutators/mutator/bloodloss/bloodloss.qc>
// generated file; do not modify
-#ifdef SVQC
- #include <common/mutators/mutator/bloodloss/sv_bloodloss.qh>
-#endif
+#include <common/mutators/mutator/bloodloss/bloodloss.qh>
--- /dev/null
+#include "bloodloss.qh"
+
+#ifdef GAMEQC
+#ifdef SVQC
+REGISTER_MUTATOR(bloodloss, autocvar_g_bloodloss);
+#elif defined(CSQC)
+REGISTER_MUTATOR(bloodloss, true);
+#endif
+
+#ifdef SVQC
+.float bloodloss_timer;
+
+MUTATOR_HOOKFUNCTION(bloodloss, PlayerPreThink)
+{
+ entity player = M_ARGV(0, entity);
+
+ if(game_stopped)
+ return; // during intermission, the player's health changes to strange values for the engine, let's not cause damage during this phase!
+
+ if(IS_PLAYER(player))
+ if(GetResource(player, RES_HEALTH) <= autocvar_g_bloodloss && !IS_DEAD(player) && time >= player.bloodloss_timer)
+ {
+ if(player.vehicle)
+ vehicles_exit(player.vehicle, VHEF_RELEASE); // TODO: boots player out of their vehicle each health rot tick!
+ if(player.event_damage)
+ player.event_damage(player, player, player, 1, DEATH_ROT.m_id, DMG_NOWEP, player.origin, '0 0 0');
+ player.bloodloss_timer = time + 0.5 + random() * 0.5;
+ }
+}
+
+MUTATOR_HOOKFUNCTION(bloodloss, PlayerCanCrouch)
+{
+ entity player = M_ARGV(0, entity);
+ if(GetResource(player, RES_HEALTH) <= autocvar_g_bloodloss)
+ M_ARGV(1, bool) = true; // do_crouch
+}
+
+MUTATOR_HOOKFUNCTION(bloodloss, PlayerJump)
+{
+ entity player = M_ARGV(0, entity);
+
+ if(GetResource(player, RES_HEALTH) <= autocvar_g_bloodloss)
+ return true;
+}
+
+MUTATOR_HOOKFUNCTION(bloodloss, BuildMutatorsString)
+{
+ M_ARGV(0, string) = strcat(M_ARGV(0, string), ":bloodloss");
+}
+
+MUTATOR_HOOKFUNCTION(bloodloss, BuildMutatorsPrettyString)
+{
+ M_ARGV(0, string) = strcat(M_ARGV(0, string), ", Blood loss");
+}
+#endif
+
+#ifdef CSQC
+MUTATOR_HOOKFUNCTION(bloodloss, PlayerCanCrouch)
+{
+ if(STAT(HEALTH) <= STAT(BLOODLOSS))
+ M_ARGV(1, bool) = true; // do_crouch
+}
+MUTATOR_HOOKFUNCTION(bloodloss, PlayerJump)
+{
+ if(STAT(HEALTH) <= STAT(BLOODLOSS))
+ return true;
+}
+#endif
+
+#endif
--- /dev/null
+#pragma once
+++ /dev/null
-#include "sv_bloodloss.qh"
-
-float autocvar_g_bloodloss;
-REGISTER_MUTATOR(bloodloss, autocvar_g_bloodloss);
-
-.float bloodloss_timer;
-
-MUTATOR_HOOKFUNCTION(bloodloss, PlayerPreThink)
-{
- entity player = M_ARGV(0, entity);
-
- if(IS_PLAYER(player))
- if(GetResource(player, RES_HEALTH) <= autocvar_g_bloodloss && !IS_DEAD(player))
- {
- PHYS_INPUT_BUTTON_CROUCH(player) = true;
-
- if(time >= player.bloodloss_timer)
- {
- if(player.vehicle)
- vehicles_exit(player.vehicle, VHEF_RELEASE);
- if(player.event_damage)
- player.event_damage(player, player, player, 1, DEATH_ROT.m_id, DMG_NOWEP, player.origin, '0 0 0');
- player.bloodloss_timer = time + 0.5 + random() * 0.5;
- }
- }
-}
-
-MUTATOR_HOOKFUNCTION(bloodloss, PlayerJump)
-{
- entity player = M_ARGV(0, entity);
-
- if(GetResource(player, RES_HEALTH) <= autocvar_g_bloodloss)
- return true;
-}
-
-MUTATOR_HOOKFUNCTION(bloodloss, BuildMutatorsString)
-{
- M_ARGV(0, string) = strcat(M_ARGV(0, string), ":bloodloss");
-}
-
-MUTATOR_HOOKFUNCTION(bloodloss, BuildMutatorsPrettyString)
-{
- M_ARGV(0, string) = strcat(M_ARGV(0, string), ", Blood loss");
-}
+++ /dev/null
-#pragma once
this.m_color = '1 0.39 0';
}
BUFF_SPAWNFUNCS(bash, BUFF_BASH)
+BUFF_SPAWNFUNC_Q3TA_COMPAT(doubler, BUFF_BASH)
REGISTER_BUFF(VAMPIRE) {
this.m_name = _("Vampire");
FOREACH(Buffs, buff_Available(it),
{
// if it's already been chosen, give it a lower priority
- RandomSelection_AddEnt(it, max(0.2, 1 / it.buff_seencount), 1);
+ float myseencount = (it.buff_seencount > 0) ? it.buff_seencount : 1; // no division by zero please!
+ RandomSelection_AddEnt(it, max(0.2, 1 / myseencount), 1);
});
entity newbuff = RandomSelection_chosen_ent;
newbuff.buff_seencount += 1; // lower chances of seeing this buff again soon
{
buff_SetCooldown(this, autocvar_g_buffs_cooldown_respawn + frametime);
this.owner = NULL;
- if(autocvar_g_buffs_randomize)
+ if(autocvar_g_buffs_randomize && (!teamplay || autocvar_g_buffs_randomize_teamplay))
buff_NewType(this);
if(autocvar_g_buffs_random_location || (this.spawnflags & 64))
void buff_Reset(entity this)
{
- if(autocvar_g_buffs_randomize)
+ if(autocvar_g_buffs_randomize && (!teamplay || autocvar_g_buffs_randomize_teamplay))
buff_NewType(this);
this.owner = NULL;
buff_SetCooldown(this, autocvar_g_buffs_cooldown_activate);
bool autocvar_g_buffs_pickup_anyway = false;
float autocvar_g_buffs_pickup_delay = 0.7;
bool autocvar_g_buffs_randomize;
+bool autocvar_g_buffs_randomize_teamplay = true;
float autocvar_g_buffs_random_lifetime;
bool autocvar_g_buffs_random_location;
int autocvar_g_buffs_random_location_attempts;
}
}
- int n = 0;
-
- IntrusiveList reviving_players = NULL;
-
- if(player.freezetag_frozen_timeout > 0 && time >= player.freezetag_frozen_timeout)
- n = -1;
- else if (STAT(FROZEN, player) == FROZEN_TEMP_DYING)
+ if (frametime && IS_PLAYER(player))
{
- vector revive_extra_size = '1 1 1' * autocvar_g_freezetag_revive_extra_size;
- n = 0;
- FOREACH_CLIENT(IS_PLAYER(it) && IS_REVIVING(player, it, revive_extra_size), {
- if (!reviving_players)
- reviving_players = IL_NEW();
- IL_PUSH(reviving_players, it);
- ++n;
- });
- }
+ int n = 0;
- if (n > 0 && STAT(FROZEN, player) == FROZEN_TEMP_DYING) // OK, there is at least one teammate reviving us
- {
- STAT(REVIVE_PROGRESS, player) = bound(0, STAT(REVIVE_PROGRESS, player) + frametime * max(1/60, autocvar_g_freezetag_revive_speed), 1);
- SetResource(player, RES_HEALTH, max(1, STAT(REVIVE_PROGRESS, player) * start_health));
+ IntrusiveList reviving_players = NULL;
- if(STAT(REVIVE_PROGRESS, player) >= 1)
+ if(player.freezetag_frozen_timeout > 0 && time >= player.freezetag_frozen_timeout)
+ n = -1;
+ else if (STAT(FROZEN, player) == FROZEN_TEMP_DYING)
{
- Unfreeze(player, false);
-
- entity first = IL_FIRST(reviving_players);
- Send_Notification(NOTIF_ONE, player, MSG_CENTER, CENTER_FREEZETAG_REVIVED, first.netname);
- Send_Notification(NOTIF_ONE, first, MSG_CENTER, CENTER_FREEZETAG_REVIVE, player.netname);
+ vector revive_extra_size = '1 1 1' * autocvar_g_freezetag_revive_extra_size;
+ n = 0;
+ FOREACH_CLIENT(IS_PLAYER(it) && IS_REVIVING(player, it, revive_extra_size), {
+ if (!reviving_players)
+ reviving_players = IL_NEW();
+ IL_PUSH(reviving_players, it);
+ ++n;
+ });
}
- IL_EACH(reviving_players, true, {
- STAT(REVIVE_PROGRESS, it) = STAT(REVIVE_PROGRESS, player);
- });
+ if (n > 0 && STAT(FROZEN, player) == FROZEN_TEMP_DYING) // OK, there is at least one teammate reviving us
+ {
+ STAT(REVIVE_PROGRESS, player) = bound(0, STAT(REVIVE_PROGRESS, player) + frametime * max(1/60, autocvar_g_freezetag_revive_speed), 1);
+ SetResource(player, RES_HEALTH, max(1, STAT(REVIVE_PROGRESS, player) * start_health));
+
+ if(STAT(REVIVE_PROGRESS, player) >= 1)
+ {
+ Unfreeze(player, false);
+
+ entity first = IL_FIRST(reviving_players);
+ Send_Notification(NOTIF_ONE, player, MSG_CENTER, CENTER_FREEZETAG_REVIVED, first.netname);
+ Send_Notification(NOTIF_ONE, first, MSG_CENTER, CENTER_FREEZETAG_REVIVE, player.netname);
+ }
+
+ IL_EACH(reviving_players, true, {
+ STAT(REVIVE_PROGRESS, it) = STAT(REVIVE_PROGRESS, player);
+ });
+ }
+ if (reviving_players)
+ IL_DELETE(reviving_players);
}
- if (reviving_players)
- IL_DELETE(reviving_players);
}
MUTATOR_HOOKFUNCTION(nades, PlayerPhysics_UpdateStats)
(actor.(weaponentity).wframe == WFRAME_FIRE2))
{
// Set secondary fire animation.
- vector a = '0 0 0';
actor.(weaponentity).wframe = WFRAME_FIRE2;
- a = actor.(weaponentity).anim_fire2;
- a.z *= g_weaponratefactor;
FOREACH_CLIENT(true, LAMBDA(
if (it == actor || (IS_SPEC(it) && it.enemy == actor))
{
- wframe_send(it, actor.(weaponentity), a, true);
+ wframe_send(it, actor.(weaponentity), WFRAME_FIRE2, g_weaponratefactor, true);
}
));
animdecide_setaction(actor, ANIMACTION_SHOOT, true);
(actor.(weaponentity).wframe == WFRAME_FIRE2))
{
// Set secondary fire animation.
- vector a = '0 0 0';
actor.(weaponentity).wframe = WFRAME_FIRE2;
- a = actor.(weaponentity).anim_fire2;
- a.z *= g_weaponratefactor;
FOREACH_CLIENT(true, LAMBDA(
if (it == actor || (IS_SPEC(it) && it.enemy == actor))
{
- wframe_send(it, actor.(weaponentity), a, true);
+ wframe_send(it, actor.(weaponentity), WFRAME_FIRE2, g_weaponratefactor, true);
}
));
animdecide_setaction(actor, ANIMACTION_SHOOT, true);
(actor.(weaponentity).wframe == WFRAME_FIRE2))
{
// Set secondary fire animation.
- vector a = '0 0 0';
actor.(weaponentity).wframe = WFRAME_FIRE2;
- a = actor.(weaponentity).anim_fire2;
- a.z *= g_weaponratefactor;
FOREACH_CLIENT(true, LAMBDA(
if (it == actor || (IS_SPEC(it) && it.enemy == actor))
{
- wframe_send(it, actor.(weaponentity), a, true);
+ wframe_send(it, actor.(weaponentity), WFRAME_FIRE2, g_weaponratefactor, true);
}
));
animdecide_setaction(actor, ANIMACTION_SHOOT, true);
(actor.(weaponentity).wframe == WFRAME_FIRE2))
{
// Set secondary fire animation.
- vector a = '0 0 0';
actor.(weaponentity).wframe = WFRAME_FIRE2;
- a = actor.(weaponentity).anim_fire2;
- a.z *= g_weaponratefactor;
FOREACH_CLIENT(true, LAMBDA(
if (it == actor || (IS_SPEC(it) && it.enemy == actor))
{
- wframe_send(it, actor.(weaponentity), a, true);
+ wframe_send(it, actor.(weaponentity), WFRAME_FIRE2, g_weaponratefactor, true);
}
));
animdecide_setaction(actor, ANIMACTION_SHOOT, true);
(actor.(weaponentity).wframe == WFRAME_FIRE2))
{
// Set secondary fire animation.
- vector a = '0 0 0';
actor.(weaponentity).wframe = WFRAME_FIRE2;
- a = actor.(weaponentity).anim_fire2;
- a.z *= g_weaponratefactor;
FOREACH_CLIENT(true, LAMBDA(
if (it == actor || (IS_SPEC(it) && it.enemy == actor))
{
- wframe_send(it, actor.(weaponentity), a, true);
+ wframe_send(it, actor.(weaponentity), WFRAME_FIRE2, g_weaponratefactor, true);
}
));
animdecide_setaction(actor, ANIMACTION_SHOOT, true);
float dist = 10, max_normal = 0.2, scaler = 100;
vector start = this.origin;
- TRACE(start + v_forward * scaler)
- TRACE(start - v_forward * scaler)
- TRACE(start + v_right * scaler)
- TRACE(start - v_right * scaler)
+ vector forward, right, _up;
+ MAKE_VECTORS(this.angles, forward, right, _up);
+ TRACE(start + forward * scaler)
+ TRACE(start - forward * scaler)
+ TRACE(start + right * scaler)
+ TRACE(start - right * scaler)
#undef TRACE
return '0 0 0';
}
v4 = Rotate(v4, rot) + org;
// draw them
- R_BeginPolygon(pic, f);
+ R_BeginPolygon(pic, f, true);
R_PolygonVertex(v1, '0 0 0', rgb, a);
R_PolygonVertex(v2, '1 0 0', rgb, a);
R_PolygonVertex(v3, '1 1 0', rgb, a);
void drawquad(vector o, vector ri, vector up, string pic, vector rgb, float a, float f)
{
- R_BeginPolygon(pic, f);
+ R_BeginPolygon(pic, f, true);
R_PolygonVertex(o, '0 0 0', rgb, a);
R_PolygonVertex(o + ri, '1 0 0', rgb, a);
R_PolygonVertex(o + up + ri, '1 1 0', rgb, a);
vector borderX = eX * (size+borderDiag);
vector borderY = eY * (size+borderDiag+border);
- R_BeginPolygon("", DRAWFLAG_NORMAL);
+ R_BeginPolygon("", DRAWFLAG_NORMAL, true);
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(arrowY + borderX, ang), '0 0 0', '0 0 0', a);
R_EndPolygon();
- R_BeginPolygon("", DRAWFLAG_ADDITIVE);
+ R_BeginPolygon("", DRAWFLAG_ADDITIVE, true);
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);
void Dump_Notifications(int fh, bool alsoprint);
-GENERIC_COMMAND(dumpnotifs, "Dump all notifications into notifications_dump.txt")
+GENERIC_COMMAND(dumpnotifs, "Dump all notifications into notifications_dump.txt", false)
{
switch (request)
{
void ReplicateVars(bool would_destroy)
{
if (!would_destroy)
- FOREACH(Notifications, it.nent_type == MSG_CHOICE, {
- string cvarname = sprintf("notification_%s", Get_Notif_CvarName(it));
+ FOREACH(Notifications, it.nent_type == MSG_CHOICE && (!it.nent_teamnum || it.nent_teamnum == NUM_TEAM_1), {
+ string cvarname = strcat("notification_", Get_Notif_CvarName(it));
// NOTE: REPLICATE_SIMPLE can return;
REPLICATE_SIMPLE(it.cvar_value, cvarname);
});
if(applygravity)
{
this.move_didgravity = 1;
- grav = dt * (PHYS_ENTGRAVITY(this) ? PHYS_ENTGRAVITY(this) : 1) * PHYS_GRAVITY(this);
+ grav = dt * (this.gravity ? this.gravity : 1) * PHYS_GRAVITY(this);
if(!GAMEPLAYFIX_NOGRAVITYONGROUND || !IS_ONGROUND(this))
{
void _Movetype_Impact(entity this, entity oth) // SV_Impact
{
- if(gettouch(this))
+ if(!this && !oth)
+ return;
+
+ if(this.solid != SOLID_NOT && gettouch(this))
gettouch(this)(this, oth);
- if(gettouch(oth))
+ if(oth.solid != SOLID_NOT && gettouch(oth))
gettouch(oth)(oth, this);
}
entity this = _Movetype_TestEntityPosition_ent;
vector org = this.origin + ofs;
- int cont = this.dphitcontentsmask;
- this.dphitcontentsmask = DPCONTENTS_SOLID;
+ //int cont = this.dphitcontentsmask;
+ //this.dphitcontentsmask = DPCONTENTS_SOLID;
tracebox(org, this.mins, this.maxs, org, ((this.move_movetype == MOVETYPE_FLY_WORLDONLY) ? MOVE_WORLDONLY : MOVE_NOMONSTERS), this);
- this.dphitcontentsmask = cont;
+ //this.dphitcontentsmask = cont;
if(trace_startsolid)
return true;
if(vdist(trace_endpos - this.origin, >, 0.0001))
- this.origin = trace_endpos;
+ {
+ tracebox(trace_endpos, this.mins, this.maxs, trace_endpos, MOVE_NOMONSTERS, this);
+ if(!trace_startsolid)
+ this.origin = trace_endpos;
+ }
return false;
}
return UNSTICK_FINE;
}
#define X(v) if (_Movetype_TestEntityPosition(v))
+ X('0 0 -1') X(' 0 0 1')
X('-1 0 0') X(' 1 0 0')
X(' 0 -1 0') X(' 0 1 0')
X('-1 -1 0') X(' 1 -1 0')
#define X(i) \
if (_Movetype_TestEntityPosition('0 0 -1' * i)) \
if (_Movetype_TestEntityPosition('0 0 1' * i))
- X(1) X(2) X(3) X(4) X(5) X(6) X(7) X(8)
+ X(2) X(3) X(4) X(5) X(6) X(7) X(8)
X(9) X(10) X(11) X(12) X(13) X(14) X(15) X(16)
X(17)
#undef X
}
LOG_DEBUGF("Sucessfully unstuck an entity (edict: %d, classname: %s, origin: %s)",
etof(this), this.classname, vtos(this.origin));
- _Movetype_LinkEdict(this, true);
+ _Movetype_LinkEdict(this, false);
return UNSTICK_FIXED;
}
vector last_origin = this.origin;
- if(dolink)
- _Movetype_LinkEdict(this, true);
+ _Movetype_LinkEdict(this, dolink);
- if(trace_fraction < 1)
- if(this.solid >= SOLID_TRIGGER && trace_ent && (!IS_ONGROUND(this) || (this.groundentity != trace_ent)))
- _Movetype_Impact(this, trace_ent);
+ if((this.solid >= SOLID_TRIGGER && trace_fraction < 1 && (!IS_ONGROUND(this) || this.groundentity != trace_ent)))
+ _Movetype_Impact(this, trace_ent);
return (this.origin == last_origin); // false if teleported by touch
}
Movetype_Physics_MatchTicrate(this, TICRATE, sloppy);
}
+// saved .move_*
.vector tic_origin;
.vector tic_velocity;
.int tic_flags;
.vector tic_avelocity;
.vector tic_angles;
+// saved .*
.vector tic_saved_origin;
.vector tic_saved_velocity;
.int tic_saved_flags;
.vector tic_saved_angles;
void Movetype_Physics_MatchTicrate(entity this, float tr, bool sloppy) // SV_Physics_Entity
{
+ // this hack exists to contain the physics feature
+ // (so entities can place themselves in the world and not need to update .tic_* themselves)
#define X(s) \
if(this.(s) != this.tic_saved_##s) \
this.tic_##s = this.(s)
X(angles);
#undef X
+ this.flags = this.tic_flags;
+ this.velocity = this.tic_velocity;
+ setorigin(this, this.tic_origin);
+ this.avelocity = this.tic_avelocity;
+ this.angles = this.tic_angles;
+
if(tr <= 0)
{
- this.flags = this.tic_flags;
- this.velocity = this.tic_velocity;
- this.origin = this.tic_origin;
- this.avelocity = this.tic_avelocity;
- this.angles = this.tic_angles;
Movetype_Physics_NoMatchServer(this);
- this.tic_origin = this.origin;
- this.tic_velocity = this.velocity;
- this.tic_avelocity = this.avelocity;
- this.tic_angles = this.angles;
- this.tic_flags = this.flags;
-
- this.tic_saved_flags = this.flags;
- this.tic_saved_velocity = this.velocity;
- this.tic_saved_origin = this.origin;
- this.tic_saved_avelocity = this.avelocity;
- this.tic_saved_angles = this.angles;
+
+ this.tic_saved_flags = this.tic_flags = this.flags;
+ this.tic_saved_velocity = this.tic_velocity = this.velocity;
+ this.tic_saved_origin = this.tic_origin = this.origin;
+ this.tic_saved_avelocity = this.tic_avelocity = this.avelocity;
+ this.tic_saved_angles = this.tic_angles = this.angles;
return;
}
if(!this.move_didgravity)
this.move_didgravity = ((this.move_movetype == MOVETYPE_BOUNCE || this.move_movetype == MOVETYPE_TOSS) && !(this.tic_flags & FL_ONGROUND));
- for (int i = 0; i < n; ++i)
+ for (int j = 0; j < n; ++j)
{
- this.flags = this.tic_flags;
- this.velocity = this.tic_velocity;
- setorigin(this, this.tic_origin);
- this.avelocity = this.tic_avelocity;
- this.angles = this.tic_angles;
_Movetype_Physics_Frame(this, tr);
- this.tic_origin = this.origin;
- this.tic_velocity = this.velocity;
- this.tic_avelocity = this.avelocity;
- this.tic_angles = this.angles;
- this.tic_flags = this.flags;
if(wasfreed(this))
return;
}
+ // update the physics fields
+ this.tic_origin = this.origin;
+ this.tic_velocity = this.velocity;
+ this.tic_avelocity = this.avelocity;
+ this.tic_angles = this.angles;
+ this.tic_flags = this.flags;
+
+ // restore their actual values
+ this.flags = this.tic_saved_flags;
+ this.velocity = this.tic_saved_velocity;
+ setorigin(this, this.tic_saved_origin);
+ //this.avelocity = this.tic_saved_avelocity;
+ this.angles = this.tic_saved_angles;
+
this.avelocity = this.tic_avelocity;
if(dt > 0 && this.move_movetype != MOVETYPE_NONE && !(this.tic_flags & FL_ONGROUND))
{
this.velocity_z -= (GAMEPLAYFIX_GRAVITYUNAFFECTEDBYTICRATE ? 0.5 : 1)
* dt
- * (this.gravity ? this.gravity : 1)
+ * ((this.gravity) ? this.gravity : 1)
* PHYS_GRAVITY(this);
}
}
else
{
- vector oldorg = this.origin;
- this.origin = this.tic_origin;
+ setorigin(this, this.tic_origin);
_Movetype_PushEntityTrace(this, dt * this.velocity);
- this.origin = oldorg;
if(!trace_startsolid)
setorigin(this, trace_endpos);
+ else
+ setorigin(this, this.tic_saved_origin);
}
if(this.move_didgravity > 0 && GAMEPLAYFIX_GRAVITYUNAFFECTEDBYTICRATE)
- this.velocity_z -= 0.5 * dt * (this.gravity ? this.gravity : 1) * PHYS_GRAVITY(this);
+ this.velocity_z -= 0.5 * dt * ((this.gravity) ? this.gravity : 1) * PHYS_GRAVITY(this);
}
else
{
setorigin(this, this.tic_origin);
}
+ this.flags = this.tic_flags;
+
this.tic_saved_flags = this.flags;
this.tic_saved_velocity = this.velocity;
this.tic_saved_origin = this.origin;
#define GAMEPLAYFIX_STEPMULTIPLETIMES(s) STAT(GAMEPLAYFIX_STEPMULTIPLETIMES)
#define GAMEPLAYFIX_UNSTICKPLAYERS(s) STAT(GAMEPLAYFIX_UNSTICKPLAYERS)
#define GAMEPLAYFIX_WATERTRANSITION(s) STAT(GAMEPLAYFIX_WATERTRANSITION)
+#define GAMEPLAYFIX_SLIDEMOVEPROJECTILES(s) STAT(GAMEPLAYFIX_SLIDEMOVEPROJECTILES)
+#define GAMEPLAYFIX_GRENADEBOUNCESLOPES(s) STAT(GAMEPLAYFIX_GRENADEBOUNCESLOPES)
+#define GAMEPLAYFIX_NOAIRBORNCORPSE(s) STAT(GAMEPLAYFIX_NOAIRBORNCORPSE)
+#define NOAIRBORNCORPSE_ALLOWSUSPENDED(s) STAT(NOAIRBORNCORPSE_ALLOWSUSPENDED)
#define UPWARD_VELOCITY_CLEARS_ONGROUND(s) STAT(GAMEPLAYFIX_UPVELOCITYCLEARSONGROUND)
+
#define PHYS_STEPHEIGHT(s) STAT(MOVEVARS_STEPHEIGHT)
#define PHYS_NOSTEP(s) STAT(NOSTEP)
#define PHYS_JUMPSTEP(s) STAT(MOVEVARS_JUMPSTEP)
void _Movetype_Physics_Toss(entity this, float dt) // SV_Physics_Toss
{
- if (IS_ONGROUND(this))
+ if(IS_ONGROUND(this))
{
- if (this.velocity.z >= 1 / 32 && UPWARD_VELOCITY_CLEARS_ONGROUND(this))
+ if(this.velocity.z >= (1 / 32) && UPWARD_VELOCITY_CLEARS_ONGROUND(this))
{
+ // don't stick to ground if onground and moving upward
UNSET_ONGROUND(this);
}
- else if (!this.groundentity)
+ else if(!this.groundentity || !GAMEPLAYFIX_NOAIRBORNCORPSE(this))
{
return;
}
- else if (this.move_suspendedinair && wasfreed(this.groundentity))
+ else if(this.move_suspendedinair && wasfreed(this.groundentity))
{
this.groundentity = NULL;
+ if(NOAIRBORNCORPSE_ALLOWSUSPENDED(this))
+ return;
+ }
+ else if(boxesoverlap(this.absmin, this.absmax, this.groundentity.absmin, this.groundentity.absmax))
+ {
+ // don't slide if still touching the groundentity
return;
}
}
_Movetype_CheckVelocity(this);
- /*if (this.move_movetype == MOVETYPE_BOUNCE || this.move_movetype == MOVETYPE_TOSS)
+ if(this.move_movetype == MOVETYPE_BOUNCE || this.move_movetype == MOVETYPE_TOSS)
{
- this.move_didgravity = 1;
+ this.move_didgravity = true;
this.velocity_z -= (GAMEPLAYFIX_GRAVITYUNAFFECTEDBYTICRATE ? 0.5 : 1)
* dt
- * (this.gravity ? this.gravity : 1)
+ * ((this.gravity) ? this.gravity : 1)
* PHYS_GRAVITY(this);
- }*/
+ }
- if (this.move_movetype == MOVETYPE_BOUNCE || this.move_movetype == MOVETYPE_TOSS)
+ /*if (this.move_movetype == MOVETYPE_BOUNCE || this.move_movetype == MOVETYPE_TOSS)
{
this.move_didgravity = true;
this.velocity_z -= (((this.gravity) ? this.gravity : 1) * PHYS_GRAVITY(this) * dt);
- }
+ }*/
this.angles = this.angles + this.avelocity * dt;
float movetime = dt;
- for (int bump = 0; bump < MAX_CLIP_PLANES && movetime > 0; ++bump)
+ for (int bump = 0; bump < MAX_CLIP_PLANES && movetime > 0; bump++)
{
vector move = this.velocity * movetime;
- _Movetype_PushEntity(this, move, true, false);
+ if(!_Movetype_PushEntity(this, move, true, true))
+ return;
if (wasfreed(this))
return;
if (trace_startsolid)
{
_Movetype_UnstickEntity(this);
- _Movetype_PushEntity(this, move, false, false);
+ if(!_Movetype_PushEntity(this, move, true, true))
+ return;
if (wasfreed(this))
return;
}
if (this.move_movetype == MOVETYPE_BOUNCEMISSILE)
{
- this.velocity = _Movetype_ClipVelocity(this.velocity, trace_plane_normal, 2.0);
+ float bouncefac = (!this.bouncefactor) ? 1.0 : this.bouncefactor;
+ this.velocity = _Movetype_ClipVelocity(this.velocity, trace_plane_normal, 1 + bouncefac);
UNSET_ONGROUND(this);
+ if(!GAMEPLAYFIX_SLIDEMOVEPROJECTILES(this))
+ movetime = 0;
}
else if (this.move_movetype == MOVETYPE_BOUNCE)
{
- float bouncefac = this.bouncefactor; if (!bouncefac) bouncefac = 0.5;
- float bstop = this.bouncestop; if (!bstop) bstop = 60 / 800;
- bstop *= (this.gravity ? this.gravity : 1) * PHYS_GRAVITY(this);
+ float bouncefac = (!this.bouncefactor) ? 0.5 : this.bouncefactor;
+ float bstop = (!this.bouncestop) ? (60 / 800) : this.bouncestop;
+ float grav = ((this.gravity) ? this.gravity : 1);
this.velocity = _Movetype_ClipVelocity(this.velocity, trace_plane_normal, 1 + bouncefac);
float d = trace_plane_normal * this.velocity;
- if (trace_plane_normal.z > 0.7 && d < bstop && d > -bstop)
+ if(!GAMEPLAYFIX_GRENADEBOUNCESLOPES(this))
+ d = this.velocity.z;
+ if (trace_plane_normal.z > 0.7 && d < PHYS_GRAVITY(this) * bstop * grav)
{
SET_ONGROUND(this);
this.groundentity = trace_ent;
this.velocity = '0 0 0';
this.avelocity = '0 0 0';
+ movetime = 0;
}
else
{
UNSET_ONGROUND(this);
+ if(!GAMEPLAYFIX_SLIDEMOVEPROJECTILES(this))
+ movetime = 0;
}
}
else
this.move_suspendedinair = true;
this.velocity = '0 0 0';
this.avelocity = '0 0 0';
+ movetime = 0;
}
else
{
UNSET_ONGROUND(this);
+ if(!GAMEPLAYFIX_SLIDEMOVEPROJECTILES(this))
+ movetime = 0;
}
}
// DP revision 8905 (just, WHY...)
- if (this.move_movetype == MOVETYPE_BOUNCEMISSILE)
- break;
+ //if (this.move_movetype == MOVETYPE_BOUNCEMISSILE)
+ //break;
// DP revision 8918 (WHY...)
- if (IS_ONGROUND(this))
- break;
+ //if (IS_ONGROUND(this))
+ //break;
}
- //if (GAMEPLAYFIX_GRAVITYUNAFFECTEDBYTICRATE && this.move_didgravity > 0 && !IS_ONGROUND(this))
- // this.velocity_z -= 0.5 * dt * (this.gravity ? this.gravity : 1) * PHYS_GRAVITY(this);
+ if (GAMEPLAYFIX_GRAVITYUNAFFECTEDBYTICRATE && this.move_didgravity > 0 && !IS_ONGROUND(this))
+ this.velocity_z -= 0.5 * dt * ((this.gravity) ? this.gravity : 1) * PHYS_GRAVITY(this);
_Movetype_CheckWaterTransition(this);
}
: 0;
STAT(MOVEVARS_AIRSPEEDLIMIT_NONQW, this) = Physics_ClientOption(this, "airspeedlimit_nonqw", autocvar_sv_airspeedlimit_nonqw) * maxspd_mod;
}
- bool vq3compat = autocvar_sv_vq3compat && autocvar_sv_vq3compat_changehitbox; // NOTE: these hitboxes are off by 1 due to engine differences
- STAT(PL_MIN, this) = (vq3compat) ? '-15 -15 -24' : autocvar_sv_player_mins;
- STAT(PL_MAX, this) = (vq3compat) ? '15 15 32' : autocvar_sv_player_maxs;
- STAT(PL_VIEW_OFS, this) = (vq3compat) ? '0 0 26' : autocvar_sv_player_viewoffset;
- STAT(PL_CROUCH_MIN, this) = (vq3compat) ? '-15 -15 -24' : autocvar_sv_player_crouch_mins;
- STAT(PL_CROUCH_MAX, this) = (vq3compat) ? '15 15 16' : autocvar_sv_player_crouch_maxs;
- STAT(PL_CROUCH_VIEW_OFS, this) = (vq3compat) ? '0 0 12' : autocvar_sv_player_crouch_viewoffset;
+ bool q3dfcompat = autocvar_sv_q3defragcompat && autocvar_sv_q3defragcompat_changehitbox; // NOTE: these hitboxes are off by 1 due to engine differences
+ STAT(PL_MIN, this) = (q3dfcompat) ? '-15 -15 -20' : autocvar_sv_player_mins;
+ STAT(PL_MAX, this) = (q3dfcompat) ? '15 15 36' : autocvar_sv_player_maxs;
+ STAT(PL_VIEW_OFS, this) = (q3dfcompat) ? '0 0 26' : autocvar_sv_player_viewoffset;
+ STAT(PL_CROUCH_MIN, this) = (q3dfcompat) ? '-15 -15 -20' : autocvar_sv_player_crouch_mins;
+ STAT(PL_CROUCH_MAX, this) = (q3dfcompat) ? '15 15 20' : autocvar_sv_player_crouch_maxs;
+ STAT(PL_CROUCH_VIEW_OFS, this) = (q3dfcompat) ? '0 0 12' : autocvar_sv_player_crouch_viewoffset;
// old stats
// fix some new settings
do_crouch = false;
}
+ MUTATOR_CALLHOOK(PlayerCanCrouch, this, do_crouch);
+ do_crouch = M_ARGV(1, bool);
+
if (do_crouch) {
if (!IS_DUCKED(this)) {
SET_DUCKED(this);
if(!IS_ONGROUND(this))
return;
- if(!PHYS_SLICK_APPLYGRAVITY(this))
- return;
-
+ trace_dphitq3surfaceflags = 0;
tracebox(this.origin, this.mins, this.maxs, this.origin - '0 0 1', MOVE_NOMONSTERS, this);
if (trace_dphitq3surfaceflags & Q3SURFACEFLAG_SLICK)
{
- UNSET_ONGROUND(this);
+ if(PHYS_SLICK_APPLYGRAVITY(this))
+ UNSET_ONGROUND(this);
SET_ONSLICK(this);
}
else
}
}
+SHUTDOWN(PlayerStats_PlayerBasic_Shutdown)
+{
+ if(PS_B_IN_DB >= 0)
+ {
+ db_close(PS_B_IN_DB);
+ PS_B_IN_DB = -1;
+ }
+
+ if(PS_GR_OUT_DB >= 0)
+ {
+ db_close(PS_GR_OUT_DB);
+ PS_GR_OUT_DB = -1;
+ }
+}
+
void PlayerStats_PlayerBasic_CheckUpdate(entity joiningplayer)
{
// determine whether we should retrieve playerbasic information again
//float PS_PM_IN_DB = -1; // playerstats_prematch_in_db // db for info COLLECTED at the beginning of a match
int PS_GR_OUT_DB = -1; // playerstats_gamereport_out_db // db of info SENT at the end of a match
//float PS_GR_IN_DB = -1; // playerstats_gamereport_in_db // db for info COLLECTED at the end of a match
-int PS_B_IN_DB = -1; // playerstats_playerbasic_in_db // db for info COLLECTED for basic player info (ELO)
+float PS_B_IN_DB = -1; // playerstats_playerbasic_in_db // db for info COLLECTED for basic player info (ELO)
#endif
#ifdef MENUQC
int autocvar_sv_gameplayfix_stepmultipletimes = 1;
int autocvar_sv_gameplayfix_unstickplayers = 1;
int autocvar_sv_gameplayfix_fixedcheckwatertransition = 1;
+int autocvar_sv_gameplayfix_slidemoveprojectiles = 1;
+int autocvar_sv_gameplayfix_grenadebouncedownslopes = 1;
+int autocvar_sv_gameplayfix_noairborncorpse = 1;
+int autocvar_sv_gameplayfix_noairborncorpse_allowsuspendeditems = 1;
#endif
REGISTER_STAT(GAMEPLAYFIX_DOWNTRACEONGROUND, int, autocvar_sv_gameplayfix_downtracesupportsongroundflag)
REGISTER_STAT(GAMEPLAYFIX_EASIERWATERJUMP, int, autocvar_sv_gameplayfix_easierwaterjump)
REGISTER_STAT(GAMEPLAYFIX_UNSTICKPLAYERS, int, autocvar_sv_gameplayfix_unstickplayers)
REGISTER_STAT(GAMEPLAYFIX_UPVELOCITYCLEARSONGROUND, int, autocvar_sv_gameplayfix_upwardvelocityclearsongroundflag)
REGISTER_STAT(GAMEPLAYFIX_WATERTRANSITION, int, autocvar_sv_gameplayfix_fixedcheckwatertransition)
+REGISTER_STAT(GAMEPLAYFIX_SLIDEMOVEPROJECTILES, int, autocvar_sv_gameplayfix_slidemoveprojectiles)
+REGISTER_STAT(GAMEPLAYFIX_GRENADEBOUNCESLOPES, int, autocvar_sv_gameplayfix_grenadebouncedownslopes)
+REGISTER_STAT(GAMEPLAYFIX_NOAIRBORNCORPSE, int, autocvar_sv_gameplayfix_noairborncorpse)
+REGISTER_STAT(NOAIRBORNCORPSE_ALLOWSUSPENDED, int, autocvar_sv_gameplayfix_noairborncorpse_allowsuspendeditems)
REGISTER_STAT(MOVEVARS_JUMPSTEP, int, cvar("sv_jumpstep"))
REGISTER_STAT(NOSTEP, int, cvar("sv_nostep"))
REGISTER_STAT(WALLJUMP_FORCE, float, autocvar_g_walljump_force)
REGISTER_STAT(LASTWJ, float)
+#ifdef SVQC
+float autocvar_g_bloodloss;
+#endif
+REGISTER_STAT(BLOODLOSS, float, autocvar_g_bloodloss)
+
// freeze tag, clan arena
REGISTER_STAT(REDALIVE, int)
REGISTER_STAT(BLUEALIVE, int)
REGISTER_STAT(SLICK_APPLYGRAVITY, bool, autocvar_sv_slick_applygravity)
#ifdef SVQC
-bool autocvar_sv_vq3compat;
+bool autocvar_sv_q3defragcompat;
#endif
-REGISTER_STAT(VQ3COMPAT, bool, autocvar_sv_vq3compat)
+REGISTER_STAT(Q3DEFRAGCOMPAT, bool, autocvar_sv_q3defragcompat)
#ifdef SVQC
#include "physics/movetypes/movetypes.qh"
#define TR_CONFIG_END()
#endif
-GENERIC_COMMAND(dumpturrets, "Dump all turrets into turrets_dump.txt")
+GENERIC_COMMAND(dumpturrets, "Dump all turrets into turrets_dump.txt", false)
{
switch(request)
{
l *= f;
}
- if(cvar("developer"))
+ if(cvar("developer") > 0)
{
LOG_TRACE("Verifying vector compression table...");
for(i = 0x0F00; i < 0xFFFF; ++i)
vehicles_projectile_explode(this, trigger);
}
-entity vehicles_projectile(entity this, string _mzlfx, Sound _mzlsound,
+entity vehicles_projectile(entity this, entity _mzlfx, Sound _mzlsound,
vector _org, vector _vel,
float _dmg, float _radi, float _force, float _size,
int _deahtype, float _projtype, float _health,
if(_mzlsound != SND_Null)
sound (this, CH_WEAPON_A, _mzlsound, VOL_BASE, ATTEN_NORM);
- if(_mzlfx)
- Send_Effect_(_mzlfx, proj.origin, proj.velocity, 1);
+ if(_mzlfx != EFFECT_Null)
+ Send_Effect(_mzlfx, proj.origin, proj.velocity, 1);
setsize (proj, '-1 -1 -1' * _size, '1 1 1' * _size);
void bumblebee_fire_cannon(entity this, entity _gun, string _tagname, entity _owner)
{
vector v = gettaginfo(_gun, gettagindex(_gun, _tagname));
- vehicles_projectile(this, EFFECT_BIGPLASMA_MUZZLEFLASH.eent_eff_name, SND_VEH_BUMBLEBEE_FIRE,
+ vehicles_projectile(this, EFFECT_BIGPLASMA_MUZZLEFLASH, SND_VEH_BUMBLEBEE_FIRE,
v, normalize(v_forward + randomvec() * autocvar_g_vehicle_bumblebee_cannon_spread) * autocvar_g_vehicle_bumblebee_cannon_speed,
autocvar_g_vehicle_bumblebee_cannon_damage, autocvar_g_vehicle_bumblebee_cannon_radius, autocvar_g_vehicle_bumblebee_cannon_force, 0,
DEATH_VH_BUMB_GUN.m_id, PROJECTILE_BUMBLE_GUN, 0, true, true, _owner);
if (PHYS_INPUT_BUTTON_ATCK(player))
if (wep1.wr_checkammo1(wep1, vehic, weaponentity))
{
- string tagname = (vehic.cnt)
- ? (vehic.cnt = 0, "tag_fire1")
- : (vehic.cnt = 1, "tag_fire2");
- vector org = gettaginfo(vehic, gettagindex(vehic, tagname));
- w_shotorg = org;
- w_shotdir = v_forward;
- // Fix z-aim (for chase mode)
- crosshair_trace(player);
- w_shotdir.z = normalize(trace_endpos - org).z * 0.5;
wep1.wr_think(wep1, vehic, weaponentity, 1);
}
veh.vehicle_energy -= autocvar_g_vehicle_racer_cannon_cost;
veh.wait = time;
}
+ string tagname = (veh.cnt)
+ ? (veh.cnt = 0, "tag_fire1")
+ : (veh.cnt = 1, "tag_fire2");
+ vector shotorg = gettaginfo(veh, gettagindex(veh, tagname));
+ w_shotorg = shotorg;
+ w_shotdir = v_forward;
+ // Fix z-aim (for chase mode)
+ crosshair_trace(player);
+ w_shotdir.z = normalize(trace_endpos - shotorg).z * 0.5;
+
if (isPlayer) W_SetupShot_Dir(player, weaponentity, v_forward, false, 0, SND_Null, CH_WEAPON_B, 0, DEATH_VH_WAKI_GUN.m_id);
vector org = w_shotorg;
vector dir = w_shotdir;
- entity bolt = vehicles_projectile(veh, EFFECT_RACER_MUZZLEFLASH.eent_eff_name, SND_LASERGUN_FIRE,
+ entity bolt = vehicles_projectile(veh, EFFECT_RACER_MUZZLEFLASH, SND_LASERGUN_FIRE,
org, normalize(v_forward + randomvec() * autocvar_g_vehicle_racer_cannon_spread) * autocvar_g_vehicle_racer_cannon_speed,
autocvar_g_vehicle_racer_cannon_damage, autocvar_g_vehicle_racer_cannon_radius, autocvar_g_vehicle_racer_cannon_force, 0,
DEATH_VH_WAKI_GUN.m_id, PROJECTILE_WAKICANNON, 0, true, true, player);
void racer_fire_rocket(entity player, vector org, vector dir, entity trg)
{
- entity rocket = vehicles_projectile(player.vehicle, EFFECT_RACER_ROCKETLAUNCH.eent_eff_name, SND_ROCKET_FIRE,
+ entity rocket = vehicles_projectile(player.vehicle, EFFECT_RACER_ROCKETLAUNCH, SND_ROCKET_FIRE,
org, dir * autocvar_g_vehicle_racer_rocket_speed,
autocvar_g_vehicle_racer_rocket_damage, autocvar_g_vehicle_racer_rocket_radius, autocvar_g_vehicle_racer_rocket_force, 3,
DEATH_VH_WAKI_ROCKET.m_id, PROJECTILE_WAKIROCKET, 20, false, false, player);
// Takeoff sequense
if(vehic.frame < 25)
{
- vehic.frame += 25 / (autocvar_g_vehicle_raptor_takeofftime / PHYS_INPUT_FRAMETIME);
+ vehic.frame += 25 / (autocvar_g_vehicle_raptor_takeofftime / dt);
vehic.velocity_z = min(vehic.velocity_z * 1.5, 256);
vehic.bomb1.gun1.avelocity_y = 90 + ((vehic.frame / 25) * 25000);
vehic.bomb1.gun2.avelocity_y = -vehic.bomb1.gun1.avelocity_y;
entity player = isPlayer ? actor : actor.owner;
entity veh = player.vehicle;
// 1 [wait] 1 [wait] 2 [wait] 2 [wait] [wait]
- float t = autocvar_g_vehicle_raptor_cannon_refire * (1 + veh.misc_bulletcounter == 4);
+ float t = autocvar_g_vehicle_raptor_cannon_refire * (1 + ((veh.misc_bulletcounter + 1) >= 4));
if (fire & 1)
if (weapon_prepareattack(thiswep, player, weaponentity, false, t)) {
if (isPlayer) W_SetupShot_Dir(player, weaponentity, v_forward, false, 0, SND_Null, CH_WEAPON_B, 0, DEATH_VH_RAPT_CANNON.m_id);
if (veh) {
veh.misc_bulletcounter += 1;
org = (veh.misc_bulletcounter <= 2) ? gettaginfo(veh.gun1, gettagindex(veh.gun1, "fire1"))
- : (((veh.misc_bulletcounter == 4) ? veh.misc_bulletcounter = 0 : 0), gettaginfo(veh.gun2, gettagindex(veh.gun2, "fire1")));
+ : (((veh.misc_bulletcounter >= 4) ? veh.misc_bulletcounter = 0 : 0), gettaginfo(veh.gun2, gettagindex(veh.gun2, "fire1")));
dir = v_forward;
veh.vehicle_energy -= autocvar_g_vehicle_raptor_cannon_cost;
actor.cnt = time;
}
- vehicles_projectile(veh, EFFECT_RAPTOR_MUZZLEFLASH.eent_eff_name, SND_LASERGUN_FIRE,
+ vehicles_projectile(veh, EFFECT_RAPTOR_MUZZLEFLASH, SND_LASERGUN_FIRE,
org, normalize(dir + randomvec() * autocvar_g_vehicle_raptor_cannon_spread) * autocvar_g_vehicle_raptor_cannon_speed,
autocvar_g_vehicle_raptor_cannon_damage, autocvar_g_vehicle_raptor_cannon_radius, autocvar_g_vehicle_raptor_cannon_force, 0,
DEATH_VH_RAPT_CANNON.m_id, PROJECTILE_RAPTORCANNON, 0, true, true, player);
entity veh = player.vehicle;
if (fire & 2)
if (!isPlayer || weapon_prepareattack(thiswep, player, weaponentity, true, autocvar_g_vehicle_raptor_flare_refire)) {
+ vector forward, right, up;
+ MAKE_VECTORS(player.v_angle, forward, right, up);
for(int i = 0; i < 3; ++i) {
entity _flare = spawn();
setmodel(_flare, MDL_VEH_RAPTOR_FLARE);
setorigin(_flare, actor.origin - '0 0 16');
set_movetype(_flare, MOVETYPE_TOSS);
_flare.gravity = 0.15;
- _flare.velocity = 0.25 * actor.velocity + (v_forward + randomvec() * 0.25)* -500;
+ _flare.velocity = 0.25 * actor.velocity + (forward + randomvec() * 0.25)* -500;
setthink(_flare, raptor_flare_think);
_flare.nextthink = time;
_flare.owner = veh ? veh : player;
float autocvar_g_vehicle_raptor_cannon_cost = 1;
float autocvar_g_vehicle_raptor_cannon_damage = 10;
float autocvar_g_vehicle_raptor_cannon_radius = 60;
-float autocvar_g_vehicle_raptor_cannon_refire = 0.03;
+float autocvar_g_vehicle_raptor_cannon_refire = 0.033333;
float autocvar_g_vehicle_raptor_cannon_speed = 24000;
float autocvar_g_vehicle_raptor_cannon_spread = 0.01;
float autocvar_g_vehicle_raptor_cannon_force = 25;
switch(STAT(VEHICLESTAT_W2MODE, this))
{
case SBRM_VOLLY:
- rocket = vehicles_projectile(this, EFFECT_SPIDERBOT_ROCKETLAUNCH.eent_eff_name, SND_ROCKET_FIRE,
+ rocket = vehicles_projectile(this, EFFECT_SPIDERBOT_ROCKETLAUNCH, SND_ROCKET_FIRE,
v, normalize(randomvec() * autocvar_g_vehicle_spiderbot_rocket_spread + v_forward) * autocvar_g_vehicle_spiderbot_rocket_speed,
autocvar_g_vehicle_spiderbot_rocket_damage, autocvar_g_vehicle_spiderbot_rocket_radius, autocvar_g_vehicle_spiderbot_rocket_force, 1,
DEATH_VH_SPID_ROCKET.m_id, PROJECTILE_SPIDERROCKET, autocvar_g_vehicle_spiderbot_rocket_health, false, true, this.owner);
this.wait = -10;
break;
case SBRM_GUIDE:
- rocket = vehicles_projectile(this, EFFECT_SPIDERBOT_ROCKETLAUNCH.eent_eff_name, SND_ROCKET_FIRE,
+ rocket = vehicles_projectile(this, EFFECT_SPIDERBOT_ROCKETLAUNCH, SND_ROCKET_FIRE,
v, normalize(v_forward) * autocvar_g_vehicle_spiderbot_rocket_speed,
autocvar_g_vehicle_spiderbot_rocket_damage, autocvar_g_vehicle_spiderbot_rocket_radius, autocvar_g_vehicle_spiderbot_rocket_force, 1,
DEATH_VH_SPID_ROCKET.m_id, PROJECTILE_SPIDERROCKET, autocvar_g_vehicle_spiderbot_rocket_health, false, false, this.owner);
break;
case SBRM_ARTILLERY:
- rocket = vehicles_projectile(this, EFFECT_SPIDERBOT_ROCKETLAUNCH.eent_eff_name, SND_ROCKET_FIRE,
+ rocket = vehicles_projectile(this, EFFECT_SPIDERBOT_ROCKETLAUNCH, SND_ROCKET_FIRE,
v, normalize(v_forward) * autocvar_g_vehicle_spiderbot_rocket_speed,
autocvar_g_vehicle_spiderbot_rocket_damage, autocvar_g_vehicle_spiderbot_rocket_radius, autocvar_g_vehicle_spiderbot_rocket_force, 1,
DEATH_VH_SPID_ROCKET.m_id, PROJECTILE_SPIDERROCKET, autocvar_g_vehicle_spiderbot_rocket_health, false, true, this.owner);
}
}
+string GetAmmoName(int ammotype)
+{
+ switch (ammotype)
+ {
+ case RES_SHELLS: return ITEM_Shells.m_name;
+ case RES_BULLETS: return ITEM_Bullets.m_name;
+ case RES_ROCKETS: return ITEM_Rockets.m_name;
+ case RES_CELLS: return ITEM_Cells.m_name;
+ case RES_PLASMA: return ITEM_Plasma.m_name;
+ case RES_FUEL: return ITEM_JetpackFuel.m_name;
+ default: return "batteries";
+ }
+}
+
#ifdef CSQC
int GetAmmoTypeFromNum(int i)
{
#ifdef CSQC
NET_HANDLE(wframe, bool isNew)
{
- vector a = ReadVector();
+ int fr = ReadByte();
+ float t = ReadFloat();
int slot = ReadByte();
bool restartanim = ReadByte();
entity wepent = viewmodels[slot];
- if(a.x == wepent.anim_idle_x) // we don't need to enforce idle animation
- wepent.animstate_looping = false;
+ if(fr == WFRAME_IDLE)
+ wepent.animstate_looping = false; // we don't need to enforce idle animation
else
+ {
+ vector a = '0 0 0';
+ switch(fr)
+ {
+ case WFRAME_IDLE: a = wepent.anim_idle; break;
+ case WFRAME_FIRE1: a = wepent.anim_fire1; break;
+ case WFRAME_FIRE2: a = wepent.anim_fire2; break;
+ default:
+ case WFRAME_RELOAD: a = wepent.anim_reload; break;
+ }
+ a.z *= t;
anim_set(wepent, a, !restartanim, restartanim, restartanim);
+ }
wepent.state = ReadByte();
wepent.weapon_nextthink = ReadFloat();
switch (wepent.state)
#endif
#ifdef SVQC
-void wframe_send(entity actor, entity weaponentity, vector a, bool restartanim)
+void wframe_send(entity actor, entity weaponentity, int wepframe, float attackrate, bool restartanim)
{
if (!IS_REAL_CLIENT(actor)) return;
int channel = MSG_ONE;
msg_entity = actor;
WriteHeader(channel, wframe);
- WriteVector(channel, a);
+ WriteByte(channel, wepframe);
+ WriteFloat(channel, attackrate);
WriteByte(channel, weaponslot(weaponentity.weaponentity_fld));
WriteByte(channel, restartanim);
WriteByte(channel, weaponentity.state);
#define WepSet_FromWeapon(it) ((it).m_wepset)
WepSet _WepSet_FromWeapon(int i);
-GENERIC_COMMAND(dumpweapons, "Dump all weapons into weapons_dump.txt") // WEAPONTODO: make this work with other progs than just server
+GENERIC_COMMAND(dumpweapons, "Dump all weapons into weapons_dump.txt", false) // WEAPONTODO: make this work with other progs than just server
{
switch(request)
{
#endif
#ifdef SVQC
-void wframe_send(entity actor, entity weaponentity, vector a, bool restartanim);
+void wframe_send(entity actor, entity weaponentity, int wepframe, float attackrate, bool restartanim);
#endif
#endif
string GetAmmoPicture(int ammotype);
+string GetAmmoName(int ammotype);
+
#ifdef CSQC
int GetAmmoTypeFromNum(int i);
int GetAmmoStat(int ammotype);
Draw_CylindricLine(start, end, thickness, beam.beam_image, 0.25, -time * 3, beam.beam_color, beam.beam_alpha, DRAWFLAG_NORMAL, transformed_view_org);
else
{
- R_BeginPolygon(beam.beam_image, DRAWFLAG_NORMAL); // DRAWFLAG_ADDITIVE
+ R_BeginPolygon(beam.beam_image, DRAWFLAG_NORMAL, false); // DRAWFLAG_ADDITIVE
R_PolygonVertex(
top,
'0 0.5 0' + ('0 0.5 0' * (thickness / beam.beam_thickness)),
// into a weapon system for client code.
// find where we are aiming
- makevectors(((autocvar_chase_active) ? warpzone_save_view_angles : view_angles));
- vector forward = v_forward;
- vector right = v_right;
- vector up = v_up;
+ vector myviewangle = ((autocvar_chase_active) ? warpzone_save_view_angles : view_angles);
+ vector forward, right, up;
+ MAKE_VECTORS(myviewangle, forward, right, up);
entity wepent = viewmodels[this.beam_slot];
if(autocvar_chase_active)
else
{ start_pos = this.origin; }
- int v_shot_idx; // used later
- (v_shot_idx = gettagindex(wepent, "shot")) || (v_shot_idx = gettagindex(wepent, "tag_shot"));
- if(v_shot_idx && this.beam_usevieworigin == 2)
- start_pos = gettaginfo(wepent, v_shot_idx) - '0 0 2';
-
// trace forward with an estimation
WarpZone_TraceLine(
start_pos,
this
);
+ int v_shot_idx; // used later
+ (v_shot_idx = gettagindex(wepent, "shot")) || (v_shot_idx = gettagindex(wepent, "tag_shot"));
+ if(v_shot_idx && this.beam_usevieworigin == 2)
+ start_pos = gettaginfo(wepent, v_shot_idx) - '0 0 2';
+
// untransform in case our trace went through a warpzone
vector end_pos = WarpZone_UnTransformOrigin(WarpZone_trace_transform, trace_endpos);
{
this.beam_dir = wantdir;
this.beam_initialized = true;
+
+ this.beam_muzzleentity.drawmask = MASK_NORMAL; // NOTE: this works around the muzzle entity flashing on the middle of the screen for a frame
}
if(this.beam_dir != wantdir)
// if the angle is greater than maxangle, force the blendfactor to make this the maximum factor
float blendfactor = bound(
0,
- (1 - (this.beam_returnspeed * frametime)),
+ (1 - (this.beam_returnspeed * dt)),
min(this.beam_maxangle / angle, 1)
);
this.beam_dir = normalize((wantdir * (1 - blendfactor)) + (this.beam_dir * blendfactor));
// the radius is not too far yet, no worries :D
float blendfactor = bound(
0,
- (1 - (this.beam_returnspeed * frametime)),
+ (1 - (this.beam_returnspeed * dt)),
1
);
this.beam_dir = normalize((wantdir * (1 - blendfactor)) + (this.beam_dir * blendfactor));
this.beam_hiteffect,
last_origin,
beamdir * -1,
- frametime * 2
+ dt * 2
);
}
if(this.beam_hitlight[0])
this.beam_muzzleeffect,
original_start_pos + wantdir * 20,
wantdir * 1000,
- frametime * 0.1
+ dt * 0.1
);
}
if(this.beam_muzzlelight[0])
flash = spawn();
flash.owner = this;
flash.effects = EF_ADDITIVE | EF_FULLBRIGHT;
- flash.drawmask = MASK_NORMAL;
+ //flash.drawmask = MASK_NORMAL;
flash.solid = SOLID_NOT;
flash.avelocity_z = 5000;
setattachment(flash, this, "");
{
if(e.classname == "electro_orb")
{
- // change owner to whoever caused the combo explosion
- e.realowner = this.realowner;
- e.takedamage = DAMAGE_NO;
- e.classname = "electro_orb_chain";
-
- // now set the next one to trigger as well
- setthink(e, W_Electro_ExplodeCombo);
+ bool explode;
+ if (this.owner == e.owner)
+ {
+ explode = WEP_CVAR_PRI(electro, midaircombo_own);
+ }
+ else if (SAME_TEAM(this.owner, e.owner))
+ {
+ explode = WEP_CVAR_PRI(electro, midaircombo_teammate);
+ }
+ else
+ {
+ explode = WEP_CVAR_PRI(electro, midaircombo_enemy);
+ }
- // delay combo chains, looks cooler
- e.nextthink =
+ if (explode)
+ {
+ // change owner to whoever caused the combo explosion
+ e.realowner = this.realowner;
+ e.takedamage = DAMAGE_NO;
+ e.classname = "electro_orb_chain";
+
+ // Only first orb explosion uses midaircombo_speed, others use the normal combo_speed.
+ // This allows to avoid the delay on the first explosion which looks better
+ // (the bolt and orb should explode together because they interacted together)
+ // while keeping the chaining delay.
+ setthink(e, W_Electro_ExplodeCombo);
+ e.nextthink =
(
time
+
- (WEP_CVAR(electro, combo_speed) ?
- (vlen(e.WarpZone_findradius_dist) / WEP_CVAR(electro, combo_speed))
+ (WEP_CVAR_PRI(electro, midaircombo_speed) ?
+ (vlen(e.WarpZone_findradius_dist) / WEP_CVAR_PRI(electro, midaircombo_speed))
:
0
)
);
- ++found;
+
+ ++found;
+ }
}
e = e.chain;
}
P(class, prefix, force, float, BOTH) \
P(class, prefix, health, float, SEC) \
P(class, prefix, lifetime, float, BOTH) \
+ P(class, prefix, midaircombo_enemy, bool, PRI) \
P(class, prefix, midaircombo_explode, float, PRI) \
P(class, prefix, midaircombo_interval, float, PRI) \
+ P(class, prefix, midaircombo_own, bool, PRI) \
P(class, prefix, midaircombo_radius, float, PRI) \
+ P(class, prefix, midaircombo_speed, float, PRI) \
+ P(class, prefix, midaircombo_teammate, float, PRI) \
P(class, prefix, radius, float, BOTH) \
P(class, prefix, refire2, float, SEC) \
P(class, prefix, refire, float, BOTH) \
dir = reflect(dir, trace_plane_normal);
pos = trace_endpos;
wepent.polyline[++idx] = pos;
- if (trace_dphitq3surfaceflags & Q3SURFACEFLAG_SLICK || trace_dphitcontents & DPCONTENTS_PLAYERCLIP)
+ if ((trace_dphitq3surfaceflags & Q3SURFACEFLAG_SLICK) || (trace_dphitcontents & DPCONTENTS_PLAYERCLIP))
{
n += 1;
continue;
if(counter >= 1)
{
// draw from shot origin to min spread radius
- R_BeginPolygon("", DRAWFLAG_NORMAL);
+ R_BeginPolygon("", DRAWFLAG_NORMAL, false);
R_PolygonVertex(prev_min_end, '0 0 0', sw_color, a);
R_PolygonVertex(new_min_end, '0 0 0', sw_color, a);
R_PolygonVertex(this.sw_shotorg, '0 0 0', sw_color, a);
R_EndPolygon();
// draw from min spread radius to max spread radius
- R_BeginPolygon("", DRAWFLAG_NORMAL);
+ R_BeginPolygon("", DRAWFLAG_NORMAL, false);
R_PolygonVertex(new_min_end, '0 0 0', sw_color, a);
R_PolygonVertex(prev_min_end, '0 0 0', sw_color, a);
R_PolygonVertex(prev_max_end, '0 0 0', sw_color, a);
if((counter + 1) == divisions)
{
// draw from shot origin to min spread radius
- R_BeginPolygon("", DRAWFLAG_NORMAL);
+ R_BeginPolygon("", DRAWFLAG_NORMAL, false);
R_PolygonVertex(prev_min_end, '0 0 0', sw_color, a);
R_PolygonVertex(first_min_end, '0 0 0', sw_color, a);
R_PolygonVertex(this.sw_shotorg, '0 0 0', sw_color, a);
R_EndPolygon();
// draw from min spread radius to max spread radius
- R_BeginPolygon("", DRAWFLAG_NORMAL);
+ R_BeginPolygon("", DRAWFLAG_NORMAL, false);
R_PolygonVertex(first_min_end, '0 0 0', sw_color, a);
R_PolygonVertex(prev_min_end, '0 0 0', sw_color, a);
R_PolygonVertex(prev_max_end, '0 0 0', sw_color, a);
// apply edge friction
const float f2 = vlen2(vec2(this.velocity));
if (f2 > 0) {
- trace_dphitq3surfaceflags = 0;
- tracebox(this.origin, this.mins, this.maxs, this.origin - '0 0 1', MOVE_NOMONSTERS, this);
// TODO: apply edge friction
// apply ground friction
- const int realfriction = (trace_dphitq3surfaceflags & Q3SURFACEFLAG_SLICK)
+ const int realfriction = (IS_ONSLICK(this))
? PHYS_FRICTION_SLICK(this)
: PHYS_FRICTION(this);
+For more information, see https://gitlab.com/xonotic/xonotic/-/wikis/Translating
+
+
How to make the .po template:
find . -type f -not -name \*.po -not -name \*.txt | xgettext -LC -k_ -f- --from-code utf-8
csqcplayer_predictionerroro = CSQCPlayer_GetPredictionErrorO() + o;
csqcplayer_predictionerrorv = CSQCPlayer_GetPredictionErrorV() + v;
- csqcplayer_predictionerrorfactor = autocvar_cl_movement_errorcompensation / ticrate;
+ csqcplayer_predictionerrorfactor = autocvar_cl_movement_errorcompensation / ((ticrate) ? ticrate : 1);
csqcplayer_predictionerrortime = time + 1.0 / csqcplayer_predictionerrorfactor;
}
return (this == csqcplayer);
}
+float stairsmoothz;
+float autocvar_cl_stairsmoothspeed = 200;
+float autocvar_cl_smoothviewheight = 0.05;
+float smooth_prevtime;
+float viewheightavg;
+vector CSQCPlayer_ApplySmoothing(entity this, vector v)
+{
+ float smoothtime = bound(0, time - smooth_prevtime, 0.1);
+ smooth_prevtime = max(smooth_prevtime, drawtime); // drawtime is the previous frame's time at this point
+
+ if(this.csqcmodel_teleported || !(this.pmove_flags & PMF_ONGROUND) || autocvar_cl_stairsmoothspeed <= 0)
+ stairsmoothz = v.z;
+ else
+ {
+ if(stairsmoothz < v.z)
+ v.z = stairsmoothz = bound(v.z - PHYS_STEPHEIGHT(this), stairsmoothz + smoothtime * autocvar_cl_stairsmoothspeed, v.z);
+ else if(stairsmoothz > v.z)
+ v.z = stairsmoothz = bound(v.z, stairsmoothz - smoothtime * autocvar_cl_stairsmoothspeed, v.z + PHYS_STEPHEIGHT(this));
+ }
+
+ float viewheight = bound(0, (time - smooth_prevtime) / max(0.0001, autocvar_cl_smoothviewheight), 1);
+ viewheightavg = viewheightavg * (1 - viewheight) + this.view_ofs.z * viewheight;
+ v.z += viewheightavg;
+
+ smooth_prevtime = time;
+
+ return v;
+}
+
+bool autocvar_v_deathtilt;
+float autocvar_v_deathtiltangle;
+void CSQCPlayer_ApplyDeathTilt(entity this)
+{
+ if(!this.csqcmodel_isdead || !autocvar_v_deathtilt)
+ return;
+ view_angles.z = autocvar_v_deathtiltangle;
+}
+
+float autocvar_v_idlescale;
+float autocvar_v_ipitch_cycle;
+float autocvar_v_iyaw_cycle;
+float autocvar_v_iroll_cycle;
+float autocvar_v_ipitch_level;
+float autocvar_v_iyaw_level;
+float autocvar_v_iroll_level;
+void CSQCPlayer_ApplyIdleScaling(entity this)
+{
+ if(!autocvar_v_idlescale)
+ return;
+ view_angles.x += autocvar_v_idlescale * sin(time * autocvar_v_ipitch_cycle) * autocvar_v_ipitch_level;
+ view_angles.y += autocvar_v_idlescale * sin(time * autocvar_v_iyaw_cycle) * autocvar_v_iyaw_level;
+ view_angles.z += autocvar_v_idlescale * sin(time * autocvar_v_iroll_cycle) * autocvar_v_iroll_level;
+ //setproperty(VF_CL_VIEWANGLES, view_angles); // update view angles as well so we can aim
+}
+
+float autocvar_cl_bob = 0;
+float autocvar_cl_bobcycle = 0.5;
+float autocvar_cl_bob_limit = 7;
+float autocvar_cl_bob_limit_heightcheck = 0;
+float autocvar_cl_bob_velocity_limit = 400;
+float autocvar_cl_bobup = 0.5;
+float autocvar_cl_bobfall = 0.05;
+float autocvar_cl_bobfallcycle = 3;
+float autocvar_cl_bobfallminspeed = 200;
+float autocvar_cl_bob2 = 0;
+float autocvar_cl_bob2cycle = 1;
+float autocvar_cl_bob2smooth = 0.05;
+float bobfall_swing;
+float bobfall_speed;
+float bob2_smooth;
+vector CSQCPlayer_ApplyBobbing(entity this, vector v)
+{
+ if(this.csqcmodel_isdead)
+ return v;
+
+ // bounded XY speed, used by several effects below
+ float bob, cycle;
+
+ // vertical view bobbing code
+ if(autocvar_cl_bob && autocvar_cl_bobcycle)
+ {
+ float bob_limit = autocvar_cl_bob_limit;
+
+ if(autocvar_cl_bob_limit_heightcheck)
+ {
+ // use traces to determine what range the view can bob in, and scale down the bob as needed
+ vector bob_height_check_dest = v;
+ bob_height_check_dest.z += autocvar_cl_bob_limit * 1.1;
+ traceline(v, bob_height_check_dest, MOVE_NOMONSTERS, NULL);
+ float trace1fraction = trace_fraction;
+
+ bob_height_check_dest = v;
+ bob_height_check_dest.z += autocvar_cl_bob_limit * -0.5;
+ traceline(v, bob_height_check_dest, MOVE_NOMONSTERS, NULL);
+ float trace2fraction = trace_fraction;
+
+ bob_limit *= min(trace1fraction, trace2fraction);
+ }
+
+ // LordHavoc: figured out bobup: the time at which the sin is at 180
+ // degrees (which allows lengthening or squishing the peak or valley)
+ cycle = time / autocvar_cl_bobcycle;
+ cycle -= rint(cycle);
+ if(cycle < autocvar_cl_bobup)
+ cycle = sin(M_PI * cycle / autocvar_cl_bobup);
+ else
+ cycle = sin(M_PI + M_PI * (cycle - autocvar_cl_bobup) / (1.0 - autocvar_cl_bobup));
+ // bob is proportional to velocity in the xy plane
+ // (don't count Z, or jumping messes it up)
+ float xyspeed = bound(0, sqrt(this.velocity.x * this.velocity.x + this.velocity.y * this.velocity.y), autocvar_cl_bob_velocity_limit);
+ bob = xyspeed * autocvar_cl_bob;
+ bob = bound(0, bob, bob_limit);
+ bob = bob * 0.3 + bob * 0.7 * cycle;
+ v.z += bob;
+ }
+
+ // horizontal view bobbing code
+ if(autocvar_cl_bob2 && autocvar_cl_bob2cycle)
+ {
+ cycle = time / autocvar_cl_bob2cycle;
+ cycle -= rint(cycle);
+ if(cycle < 0.5)
+ cycle = cos(M_PI * cycle / 0.5); // cos looks better here with the other view bobbing using sin
+ else
+ cycle = cos(M_PI + M_PI * (cycle - 0.5) / 0.5);
+ bob = autocvar_cl_bob2 * cycle;
+
+ // this value slowly decreases from 1 to 0 when we stop touching the ground.
+ // The cycle is later multiplied with it so the view smooths back to normal
+ if(IS_ONGROUND(this) && !(input_buttons & BIT(1))) // also block the effect while the jump button is pressed, to avoid twitches when bunny-hopping
+ bob2_smooth = 1;
+ else
+ {
+ if(bob2_smooth > 0)
+ bob2_smooth -= bound(0, autocvar_cl_bob2smooth, 1);
+ else
+ bob2_smooth = 0;
+ }
+
+ // calculate the front and side of the player between the X and Y axes
+ makevectors(view_angles);
+ // now get the speed based on those angles. The bounds should match the same value as xyspeed's
+ float side = bound(-autocvar_cl_bob_velocity_limit, (this.velocity * v_right) * bob2_smooth, autocvar_cl_bob_velocity_limit);
+ float front = bound(-autocvar_cl_bob_velocity_limit, (this.velocity * v_forward) * bob2_smooth, autocvar_cl_bob_velocity_limit);
+ v_forward = v_forward * bob;
+ v_right = v_right * bob;
+ // we use side with forward and front with right, so the bobbing goes
+ // to the side when we walk forward and to the front when we strafe
+ vector bob2vel;
+ bob2vel.x = side * v_forward.x + front * v_right.x + 0 * v_up.x;
+ bob2vel.y = side * v_forward.y + front * v_right.y + 0 * v_up.y;
+ bob2vel.z = side * v_forward.z + front * v_right.z + 0 * v_up.z;
+ v.x += bob2vel.x;
+ v.y += bob2vel.y;
+ }
+
+ // fall bobbing code
+ // causes the view to swing down and back up when touching the ground
+ if(autocvar_cl_bobfall && autocvar_cl_bobfallcycle)
+ {
+ if(!IS_ONGROUND(this))
+ {
+ bobfall_speed = bound(-400, this.velocity.z, 0) * bound(0, autocvar_cl_bobfall, 0.1);
+ if(this.velocity.z < -autocvar_cl_bobfallminspeed)
+ bobfall_swing = 1;
+ else
+ bobfall_swing = 0; // really?
+ }
+ else
+ {
+ bobfall_swing = max(0, bobfall_swing - autocvar_cl_bobfallcycle * frametime);
+ float bobfall = sin(M_PI * bobfall_swing) * bobfall_speed;
+ v.z += bobfall;
+ }
+ }
+
+ return v;
+}
+
+float autocvar_cl_rollangle;
+float autocvar_cl_rollspeed;
+float CSQCPlayer_CalcRoll(entity this)
+{
+ makevectors(view_angles);
+ float side = (this.velocity * v_right);
+ float sign = (side < 0) ? -1 : 1;
+ side = fabs(side);
+
+ if(side < autocvar_cl_rollspeed)
+ side = side * autocvar_cl_rollangle / autocvar_cl_rollspeed;
+ else
+ side = autocvar_cl_rollangle;
+
+ return side * sign;
+}
+
+float autocvar_chase_back;
+float autocvar_chase_up;
+bool autocvar_chase_overhead;
+float autocvar_chase_pitchangle;
+vector CSQCPlayer_ApplyChase(entity this, vector v)
+{
+ vector forward;
+ vector chase_dest;
+
+ if(autocvar_chase_overhead)
+ {
+ view_angles.x = 0;
+ makevectors(view_angles);
+ forward = v_forward;
+ vector up = v_up;
+ // trace a little further so it hits a surface more consistently (to avoid 'snapping' on the edge of the range)
+ chase_dest.x = v.x - forward.x * autocvar_chase_back + up.x * autocvar_chase_up;
+ chase_dest.y = v.y - forward.y * autocvar_chase_back + up.y * autocvar_chase_up;
+ chase_dest.z = v.z - forward.z * autocvar_chase_back + up.z * autocvar_chase_up;
+
+ // trace from first person view location to our chosen third person view location
+ traceline(v, chase_dest, MOVE_NOMONSTERS, NULL);
+
+ vector bestvieworg = trace_endpos;
+ vector offset = '0 0 0';
+ for(offset.x = -16; offset.x <= 16; offset.x += 8)
+ {
+ for(offset.y = -16; offset.y <= 16; offset.y += 8)
+ {
+ makevectors(view_angles);
+ up = v_up;
+ chase_dest.x = v.x - forward.x * autocvar_chase_back + up.x * autocvar_chase_up + offset.x;
+ chase_dest.y = v.y - forward.y * autocvar_chase_back + up.y * autocvar_chase_up + offset.y;
+ chase_dest.z = v.z - forward.z * autocvar_chase_back + up.z * autocvar_chase_up + offset.z;
+ traceline(v, chase_dest, MOVE_NOMONSTERS, NULL);
+ if(bestvieworg.z > trace_endpos.z)
+ bestvieworg.z = trace_endpos.z;
+ }
+ }
+ bestvieworg.z -= 8;
+ v = bestvieworg;
+
+ view_angles.x = autocvar_chase_pitchangle;
+ //setproperty(VF_CL_VIEWANGLES, view_angles); // update view angles as well so we can aim
+ }
+ else
+ {
+ makevectors(view_angles);
+ forward = v_forward;
+ // trace a little further so it hits a surface more consistently (to avoid 'snapping' on the edge of the range)
+ float cdist = -autocvar_chase_back - 8;
+ chase_dest.x = v.x + forward.x * cdist;
+ chase_dest.y = v.y + forward.y * cdist;
+ chase_dest.z = v.z + forward.z * cdist + autocvar_chase_up;
+ traceline(v, chase_dest, MOVE_NOMONSTERS, NULL);
+ v.x = 1 * trace_endpos.x + 8 * forward.x + 4 * trace_plane_normal.x;
+ v.y = 1 * trace_endpos.y + 8 * forward.y + 4 * trace_plane_normal.y;
+ v.z = 1 * trace_endpos.z + 8 * forward.z + 4 * trace_plane_normal.z;
+ }
+
+#if 0
+ tracebox(v, '-4 -4 -4', '4 4 4', v - v_forward * autocvar_chase_back, MOVE_NORMAL, this);
+ v = trace_endpos;
+ tracebox(v, '-4 -4 -4', '4 4 4', v + v_up * autocvar_chase_up, MOVE_NORMAL, this);
+ v = trace_endpos;
+#endif
+ return v;
+}
+
+void CSQCPlayer_CalcRefdef(entity this)
+{
+ vector vieworg = this.origin;
+ if(intermission)
+ {
+ // just update view offset, don't need to do anything else
+ vieworg.z += this.view_ofs.z;
+ }
+ else
+ {
+ vieworg = CSQCPlayer_ApplySmoothing(this, vieworg);
+ if(autocvar_chase_active)
+ vieworg = CSQCPlayer_ApplyChase(this, vieworg);
+ else
+ {
+ // angles
+ CSQCPlayer_ApplyDeathTilt(this);
+ view_angles = view_angles + view_punchangle;
+ view_angles.z += CSQCPlayer_CalcRoll(this);
+ // TODO? we don't have damage time accessible here
+ // origin
+ vieworg = vieworg + view_punchvector;
+ vieworg = CSQCPlayer_ApplyBobbing(this, vieworg);
+ }
+ CSQCPlayer_ApplyIdleScaling(this);
+ }
+ setproperty(VF_ORIGIN, vieworg);
+ setproperty(VF_ANGLES, view_angles);
+}
+
+bool autocvar_cl_useenginerefdef = true;
+
/** Called once per CSQC_UpdateView() */
void CSQCPlayer_SetCamera()
{
InterpolateOrigin_Do(view);
view.view_ofs = '0 0 1' * vh;
}
- int refdefflags = 0;
- if (view.csqcmodel_teleported) refdefflags |= REFDEFFLAG_TELEPORTED;
- if (input_buttons & BIT(1)) refdefflags |= REFDEFFLAG_JUMPING;
- // note: these two only work in WIP2, but are harmless in WIP1
- if (PHYS_HEALTH(NULL) <= 0 && PHYS_HEALTH(NULL) != -666 && PHYS_HEALTH(NULL) != -2342) refdefflags |= REFDEFFLAG_DEAD;
- if (intermission) refdefflags |= REFDEFFLAG_INTERMISSION;
- V_CalcRefdef(view, refdefflags); // TODO? uses .health stat in the engine when this isn't called here, may be broken!
+ if(autocvar_cl_useenginerefdef)
+ {
+ int refdefflags = 0;
+ if (view.csqcmodel_teleported) refdefflags |= REFDEFFLAG_TELEPORTED;
+ if (input_buttons & BIT(1)) refdefflags |= REFDEFFLAG_JUMPING;
+ // note: these two only work in WIP2, but are harmless in WIP1
+ if (PHYS_HEALTH(NULL) <= 0 && PHYS_HEALTH(NULL) != -666 && PHYS_HEALTH(NULL) != -2342) refdefflags |= REFDEFFLAG_DEAD;
+ if (intermission) refdefflags |= REFDEFFLAG_INTERMISSION;
+ V_CalcRefdef(view, refdefflags); // TODO? uses .health stat in the engine when this isn't called here, may be broken!
+ }
+ else
+ {
+ CSQCPlayer_CalcRefdef(view);
+ }
+
}
else
{
C = to + thickdir * (thickness / 2);
D = to - thickdir * (thickness / 2);
- R_BeginPolygon(texture, drawflag);
+ R_BeginPolygon(texture, drawflag, false);
R_PolygonVertex(A, '0 0 0' + shift * '1 0 0', rgb, theAlpha);
R_PolygonVertex(B, '0 1 0' + shift * '1 0 0', rgb, theAlpha);
R_PolygonVertex(C, '0 1 0' + (shift + length_tex) * '1 0 0', rgb, theAlpha);
string prvm_language;
/**
- * @deprecated prefer _("translated")
+ * @deprecated prefer _("translated") - GMQCC's -ftranslatable-strings feature
*/
ERASEABLE
string language_filename(string s)
void print_assertfailed_fatal(string expr);
#define assert(expr, ...) _assert(print_assertfailed_severe, expr, __VA_ARGS__)
-#define devassert(...) MACRO_BEGIN if (autocvar_developer) assert(__VA_ARGS__); MACRO_END
+#define devassert(...) MACRO_BEGIN if (autocvar_developer > 0) assert(__VA_ARGS__); MACRO_END
#define assert_once(expr, ...) \
MACRO_BEGIN \
__once = true; \
} \
MACRO_END
-#define devassert_once(...) MACRO_BEGIN if (autocvar_developer) assert_once(__VA_ARGS__); MACRO_END
+#define devassert_once(...) MACRO_BEGIN if (autocvar_developer > 0) assert_once(__VA_ARGS__); MACRO_END
#define demand(expr, ...) _assert(print_assertfailed_fatal, expr, __VA_ARGS__)
-#define devdemand(...) MACRO_BEGIN if (autocvar_developer) demand(__VA_ARGS__); MACRO_END
+#define devdemand(...) MACRO_BEGIN if (autocvar_developer > 0) demand(__VA_ARGS__); MACRO_END
#define _assert(f, expr, then) \
MACRO_BEGIN \
#include <common/command/_mod.qh>
-GENERIC_COMMAND(mx, "Send a matrix command") {
+GENERIC_COMMAND(mx, "Send a matrix command", false) {
switch (argv(1)) {
case "user":
strcpy(matrix_user, substring(command, argv_start_index(2), -1));
{
TC(Object, this);
string s = _("No description");
- if (cvar("developer"))
+ if (cvar("developer") > 0)
{
for (int i = 0, n = numentityfields(); i < n; ++i)
{
store.fld = field; \
}
#elif defined(CSQC)
- float ReplicateVars_time;
+ noref float ReplicateVars_time;
#define ReplicateVars_NOT_SENDING() (time > ReplicateVars_time)
#define ReplicateVars_DELAY(t) ReplicateVars_time = time + t
#define ReplicateVars_DELAY_1FRAME() ReplicateVars_time = time
}
#define REPLICATE_SIMPLE(field, cvarname) MACRO_BEGIN \
- if (ReplicateVars_NOT_SENDING() && field != cvar(cvarname)) \
+ if (ReplicateVars_NOT_SENDING()) \
{ \
- localcmd(strcat("cl_cmd sendcvar ", cvarname, "\n")); \
- ReplicateVars_DELAY_1FRAME(); \
- field = cvar(cvarname); \
- return; \
+ float thecvar = cvar(cvarname); \
+ if(field != thecvar) \
+ { \
+ localcmd(strcat("cl_cmd sendcvar ", cvarname, "\n")); \
+ ReplicateVars_DELAY_1FRAME(); \
+ field = thecvar; \
+ return; \
+ } \
} \
MACRO_END
#endif
}
#define _STATIC_INIT(func, where) \
- ACCUMULATE void _static_##func##profile() { profile(#func); } \
- ACCUMULATE_FUNCTION(where, _static_##func##profile) \
+ /* ACCUMULATE void _static_##func##profile() { profile(#func); } */ \
+ /* ACCUMULATE_FUNCTION(where, _static_##func##profile) */ \
ACCUMULATE void _static_##func(); \
ACCUMULATE_FUNCTION(where, _static_##func) \
void _static_##func()
const int STATS_ENGINE_RESERVE = 32;
// must be listed in ascending order
#define MAGIC_STATS(_, x) \
+ _(x, MOVEVARS_AIRACCEL_QW_STRETCHFACTOR, 220) \
+ _(x, MOVEVARS_AIRCONTROL_PENALTY, 221) \
+ _(x, MOVEVARS_AIRSPEEDLIMIT_NONQW, 222) \
+ _(x, MOVEVARS_AIRSTRAFEACCEL_QW, 223) \
+ _(x, MOVEVARS_AIRCONTROL_POWER, 224) \
+ _(x, MOVEFLAGS, 225) \
+ _(x, MOVEVARS_WARSOWBUNNY_AIRFORWARDACCEL, 226) \
+ _(x, MOVEVARS_WARSOWBUNNY_ACCEL, 227) \
+ _(x, MOVEVARS_WARSOWBUNNY_TOPSPEED, 228) \
+ _(x, MOVEVARS_WARSOWBUNNY_TURNACCEL, 229) \
+ _(x, MOVEVARS_WARSOWBUNNY_BACKTOSIDERATIO, 230) \
+ _(x, MOVEVARS_AIRSTOPACCELERATE, 231) \
+ _(x, MOVEVARS_AIRSTRAFEACCELERATE, 232) \
+ _(x, MOVEVARS_MAXAIRSTRAFESPEED, 233) \
+ _(x, MOVEVARS_AIRCONTROL, 234) \
+ _(x, FRAGLIMIT, 235) \
+ _(x, TIMELIMIT, 236) \
+ _(x, MOVEVARS_WALLFRICTION, 237) \
+ _(x, MOVEVARS_FRICTION, 238) \
+ _(x, MOVEVARS_WATERFRICTION, 239) \
+ _(x, MOVEVARS_TICRATE, 240) \
_(x, MOVEVARS_TIMESCALE, 241) \
+ _(x, MOVEVARS_GRAVITY, 242) \
+ _(x, MOVEVARS_STOPSPEED, 243) \
+ _(x, MOVEVARS_MAXSPEED, 244) \
+ _(x, MOVEVARS_SPECTATORMAXSPEED, 245) \
+ _(x, MOVEVARS_ACCELERATE, 246) \
+ _(x, MOVEVARS_AIRACCELERATE, 247) \
+ _(x, MOVEVARS_WATERACCELERATE, 248) \
+ _(x, MOVEVARS_ENTGRAVITY, 249) \
+ _(x, MOVEVARS_JUMPVELOCITY, 250) \
+ _(x, MOVEVARS_EDGEFRICTION, 251) \
+ _(x, MOVEVARS_MAXAIRSPEED, 252) \
+ _(x, MOVEVARS_STEPHEIGHT, 253) \
+ _(x, MOVEVARS_AIRACCEL_QW, 254) \
+ _(x, MOVEVARS_AIRACCEL_SIDEWAYS_FRICTION, 255) \
/**/
int g_magic_stats_hole = 0;
addstat_##T(STAT_##id.m_id, fld); \
}
void GlobalStats_update(entity this) {}
+ void GlobalStats_updateglobal() {}
/** TODO: do we want the global copy to update? */
#define REGISTER_STAT_3(id, T, expr) \
REGISTER_STAT_2(id, T); \
ACCUMULATE void GlobalStats_update(entity this) { STAT(id, this) = (expr); } \
+ ACCUMULATE void GlobalStats_updateglobal() { entity this = STATS; STAT(id, this) = (expr); } \
STATIC_INIT(worldstat_##id) { entity this = STATS; STAT(id, this) = (expr); }
#else
#define REGISTER_STAT_2(id, type)
#include <server/utils.qh>
#endif
+#ifdef SVQC
+bool autocvar_sv_warpzone_allow_selftarget;
+#endif
+
#ifdef WARPZONELIB_KEEPDEBUG
#define WARPZONELIB_REMOVEHACK
#endif
if(WarpZone_Teleport(this, toucher, f, 0))
{
#ifdef SVQC
- string save1, save2;
-
- save1 = this.target; this.target = string_null;
- save2 = this.target3; this.target3 = string_null;
- SUB_UseTargets(this, toucher, toucher); // use toucher too?
- if (!this.target) this.target = save1;
- if (!this.target3) this.target3 = save2;
-
- save1 = this.target; this.target = string_null;
- save2 = this.target2; this.target2 = string_null;
- SUB_UseTargets(this.enemy, toucher, toucher); // use toucher too?
- if (!this.target) this.target = save1;
- if (!this.target2) this.target2 = save2;
+ SUB_UseTargets_SkipTargets(this, toucher, toucher, BIT(1) | BIT(3)); // use toucher too?
+ SUB_UseTargets_SkipTargets(this.enemy, toucher, toucher, BIT(1) | BIT(2)); // use toucher too?
#endif
}
else
player.velocity = player.warpzone_oldvelocity;
if(WarpZone_Teleport(wz, player, 0, 1))
{
- string save1, save2;
-
- save1 = wz.target; wz.target = string_null;
- save2 = wz.target3; wz.target3 = string_null;
- SUB_UseTargets(wz, player, player);
- if (!wz.target) wz.target = save1;
- if (!wz.target3) wz.target3 = save2;
-
- save1 = wz.enemy.target; wz.enemy.target = string_null;
- save2 = wz.enemy.target2; wz.enemy.target2 = string_null;
- SUB_UseTargets(wz.enemy, player, player);
- if (!wz.enemy.target) wz.enemy.target = save1;
- if (!wz.enemy.target2) wz.enemy.target2 = save2;
+ SUB_UseTargets_SkipTargets(wz, player, player, BIT(1) | BIT(3));
+ SUB_UseTargets_SkipTargets(wz.enemy, player, player, BIT(1) | BIT(2));
}
else
{
// this way only one of the two ents needs to target
if(this.target != "")
{
- this.enemy = this; // so the if(!e.enemy) check also skips this, saves one IF
+ if(!autocvar_sv_warpzone_allow_selftarget)
+ this.enemy = this; // so the if(!e.enemy) check also skips this, saves one IF
e2 = NULL;
for(e = NULL, i = 0; (e = find(e, targetname, this.target)); )
gamestatus = 0;
if (isserver()) gamestatus |= GAME_ISSERVER;
if (clientstate() == CS_CONNECTED || isdemo()) gamestatus |= GAME_CONNECTED;
- if (cvar("developer")) gamestatus |= GAME_DEVELOPER;
+ if (cvar("developer") > 0) gamestatus |= GAME_DEVELOPER;
}
void m_init()
#endif
// list all game dirs (TEST)
- if (cvar("developer"))
+ if (cvar("developer") > 0)
{
for (int i = 0; ; ++i)
{
me.checkMarkOrigin = eY + eX * (me.columnCheckMarkOrigin + me.columnCheckMarkSize) - me.checkMarkSize;
+ me.typeIconOrigin = vec3(me.columnPreviewSize - me.checkMarkSize.x, me.checkMarkOrigin.y, 0);
+ me.typeIconSize = me.checkMarkSize;
+
rewrapCampaign(me.columnNameSize, me.rowsPerItem - 3, me.emptyLineHeight, me.realFontSize);
}
void XonoticCampaignList_doubleClickListBoxItem(entity me, float i, vector where)
else
draw_Picture(me.columnPreviewOrigin * eX, strcat("/maps/", campaign_mapname[i]), me.columnPreviewSize * eX + eY, '1 1 1', theAlpha);
+ s = strcat("/gfx/menu/", cvar_string("menu_skin"), "/gametype_", campaign_gametype[i]);
+ if(i <= me.campaignIndex && draw_PictureSize(s) != '0 0 0')
+ draw_Picture(me.typeIconOrigin, s, me.typeIconSize, '1 1 1', 1);
+
if(i < me.campaignIndex)
draw_Picture(me.checkMarkOrigin, "checkmark", me.checkMarkSize, '1 1 1', 1);
if(i <= me.campaignIndex)
ATTRIB(XonoticCampaignList, columnCheckMarkSize, float, 0);
ATTRIB(XonoticCampaignList, checkMarkOrigin, vector, '0 0 0');
ATTRIB(XonoticCampaignList, checkMarkSize, vector, '0 0 0');
+ ATTRIB(XonoticCampaignList, typeIconOrigin, vector, '0 0 0');
+ ATTRIB(XonoticCampaignList, typeIconSize, vector, '0 0 0');
ATTRIB(XonoticCampaignList, realUpperMargin1, float, 0);
ATTRIB(XonoticCampaignList, realUpperMargin2, float, 0);
me.TR(me);
me.TDempty(me, 0.2);
me.TD(me, 1, 1.8, e = makeXonoticCheckBox_T(0, "g_dodging", _("Dodging"),
- _("Enable dodging")));
+ _("Enable dodging (quick acceleration in a given direction). Double-tap a directional key to dodge")));
me.TR(me);
me.TDempty(me, 0.2);
- me.TD(me, 1, 1.8, e = makeXonoticCheckBox(0, "g_touchexplode", _("Touch explode")));
+ me.TD(me, 1, 1.8, e = makeXonoticCheckBox_T(0, "g_touchexplode", _("Touch explode"),
+ _("An explosion occurs when two players collide")));
me.TR(me);
me.TDempty(me, 0.2);
me.TD(me, 1, 1.8, e = makeXonoticCheckBox_T(0, "g_cloaked", _("Cloaked"),
_("All players are almost invisible")));
me.TR(me);
me.TDempty(me, 0.2);
- me.TD(me, 1, 1.8, e = makeXonoticCheckBox(0, "g_buffs", _("Buffs")));
+ me.TD(me, 1, 1.8, e = makeXonoticCheckBox_T(0, "g_buffs", _("Buffs"),
+ _("Enable buff pickups (random bonuses like Medic, Invisible, etc.) on the maps that support it")));
e.cvarOffValue = "-1"; // TODO: make this a radio button?
me.TR(me);
me.TDempty(me, 0.2);
me.TR(me);
me.TDempty(me, 0.2);
s = makeXonoticSlider_T(10, 50, 1, "g_bloodloss",
- _("Amount of health below which your player gets stunned because of blood loss"));
+ _("Amount of health below which players start bleeding out (health rots and they can't jump)"));
me.TD(me, 1, 1.8, e = makeXonoticSliderCheckBox(0, 1, s, _("Blood loss")));
setDependent(e, "g_instagib", 0, 0);
me.TR(me);
me.TR(me);
me.TDempty(me, 0.2);
s = makeXonoticSlider_T(80, 400, 8, "sv_gravity",
- _("Make things fall to the ground slower, lower value means lower gravity"));
+ _("Make things fall to the ground slower (percentage of normal gravity)"));
s.valueDigits = 0;
s.valueDisplayMultiplier = 0.125; // show gravity in percent
me.TD(me, 1, 1.8, e = makeXonoticSliderCheckBox(800, 1, s, _("Low gravity")));
me.TR(me);
me.TDempty(me, 0.2);
me.TD(me, 1, 1.8, e = makeXonoticCheckBox_T(0, "g_grappling_hook", _("Grappling hook"),
- _("Players spawn with the grappling hook")));
+ _("Players spawn with the grappling hook. Press the 'hook' key to use it")));
me.TR(me);
me.TDempty(me, 0.2);
me.TD(me, 1, 1.8, e = makeXonoticCheckBox_T(0, "g_jetpack", _("Jetpack"),
- _("Players spawn with the jetpack")));
+ _("Players spawn with the jetpack. Double-tap 'jump' or press the 'jetpack' key to use it")));
me.TR(me);
me.TDempty(me, 0.2);
- me.TD(me, 1, 1.8, e = makeXonoticCheckBox(0, "g_invincible_projectiles", _("Invincible Projectiles")));
+ me.TD(me, 1, 1.8, e = makeXonoticCheckBox_T(0, "g_invincible_projectiles", _("Invincible Projectiles"),
+ _("Projectiles can't be destroyed. However, Electro combos still work")));
setDependent(e, "g_instagib", 0, 0);
me.TR(me);
me.TDempty(me, 0.2);
- me.TD(me, 1, 1.8, e = makeXonoticCheckBox(0, "g_new_toys", _("New Toys")));
+ me.TD(me, 1, 1.8, e = makeXonoticCheckBox_T(0, "g_new_toys", _("New Toys"),
+ _("Some weapon spawns will be randomly replaced with new weapons: Heavy Laser Assault Cannon, Mine Layer, Rifle, T.A.G. Seeker")));
setDependentWeird(e, checkCompatibility_newtoys);
me.TR(me);
me.TDempty(me, 0.2);
- me.TD(me, 1, 1.8, e = makeXonoticCheckBox(0, "g_rocket_flying", _("Rocket Flying")));
+ me.TD(me, 1, 1.8, e = makeXonoticCheckBox_T(0, "g_rocket_flying", _("Rocket Flying"),
+ _("Devastator rockets can be detonated instantly (otherwise, there's a short delay). This allows players to fire and detonate a Devastator rocket while in the air for a strong mid-air boost even while moving fast")));
setDependent(e, "g_instagib", 0, 0);
me.TR(me);
me.TDempty(me, 0.2);
me.TD(me, 1, 2, makeXonoticTextLabel(0.5, _("Are you sure you want to quit?")));
me.TR(me);
me.TR(me);
- me.TD(me, 1, 1, e = makeXonoticCommandButton_T(_("Yes"), '1 0 0', "echo ]quit\nquit", 0,
+ me.TD(me, 1, 1, e = makeXonoticCommandButton_T(_("Yes"), '1 0 0', "echo ]quit; quit", 0,
_("Back to work...")));
me.TD(me, 1, 1, e = makeXonoticButton_T(_("No"), '0 1 0',
_("I got some more fragging to do!")));
e.sendCvars = true;
me.TR(me);
me.TR(me);
- if(cvar("developer"))
+ if(cvar("developer") > 0)
me.TD(me, 1, 3, makeXonoticCheckBox(0, "showsound", _("Debug info about sounds")));
me.gotoRC(me, me.rows - 1, 0);
float n;
me.TR(me);
me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Quality preset:")));
- n = 5 + 2 * boolean(cvar("developer"));
- if(cvar("developer"))
+ n = 5 + 2 * boolean(cvar("developer") > 0);
+ if(cvar("developer") > 0)
{
me.TD(me, 1, 5 / n, e = makeXonoticCommandButton(ZCTX(_("PRE^OMG!")), '1 0 1', "exec effects-omg.cfg", 0));
e.applyButton = effectsApplyButton;
e.applyButton = effectsApplyButton;
me.TD(me, 1, 5 / n, e = makeXonoticCommandButton(ZCTX(_("PRE^Ultra")), '0 0 0', "exec effects-ultra.cfg", 0));
e.applyButton = effectsApplyButton;
- if(cvar("developer"))
+ if(cvar("developer") > 0)
{
me.TD(me, 1, 5 / n, e = makeXonoticCommandButton(ZCTX(_("PRE^Ultimate")), '0.5 0 0', "exec effects-ultimate.cfg", 0));
e.applyButton = effectsApplyButton;
me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Texture resolution:")));
setDependent(e, "r_showsurfaces", 0, 0);
me.TD(me, 1, 2, e = makeXonoticPicmipSlider());
- if(cvar("developer"))
+ if(cvar("developer") > 0)
e.addValue(e, ZCTX(_("RES^Leet")), "1337");
e.addValue(e, ZCTX(_("RES^Lowest")), "3");
e.addValue(e, ZCTX(_("RES^Very low")), "2");
}
}
me.TR(me);
- if(cvar("developer"))
+ me.TDempty(me, 0.2);
+ me.TD(me, 1, 1, e = makeXonoticCheckBoxEx_T(1, 0, "r_sky", _("Show skyboxes"), _("Disable skyboxes for performance and visibility")));
+ if(cvar("developer") > 0)
{
- me.TDempty(me, 0.2);
- me.TD(me, 1, 2.8, e = makeXonoticCheckBoxEx_T(3, 0, "r_showsurfaces", _("Show surfaces"),
+ me.TD(me, 1, 1, e = makeXonoticCheckBoxEx_T(3, 0, "r_showsurfaces", _("Show surfaces"),
_("Disable textures completely for very slow hardware. This gives a huge performance boost, but looks very ugly.")));
}
me.TR(me);
me.TR(me);
me.TD(me, 1, 3, e = makeXonoticRadioButton(1, "chase_active", "0", _("1st person perspective")));
- makeMulti(e, "crosshair_hittest_showimpact");
me.TR(me);
me.TDempty(me, 0.2);
me.TD(me, 1, 2.8, e = makeXonoticCheckBox(0, "cl_eventchase_death", _("Slide to third person upon death")));
me.TR(me);
me.TR(me);
me.TD(me, 1, 3, e = makeXonoticRadioButton(1, "chase_active", "1", _("3rd person perspective")));
- makeMulti(e, "crosshair_hittest_showimpact");
me.TR(me);
me.TDempty(me, 0.2);
me.TD(me, 1, 0.8, e = makeXonoticTextLabel(0, _("Back distance")));
#include "weaponslist.qh"
#include "commandbutton.qh"
#include "textlabel.qh"
+#include "textslider.qh"
#include "checkbox.qh"
#include "button.qh"
#include "radiobutton.qh"
me.TD(me, 1, 1.0, e = makeXonoticRadioButton_T(1, "cl_gunalign", "3", _("Right align"),
_("Position of the weapon model; requires reconnect")));
setDependent(e, "r_drawviewmodel", 1, 1);
+ me.TR(me);
+ me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Weapon model opacity:")));
+ setDependent(e, "r_drawviewmodel", 1, 1);
+
+ me.TD(me, 1, 2, e = makeXonoticTextSlider("cl_viewmodel_alpha"));
+ setDependent(e, "r_drawviewmodel", 1, 1);
+ e.addValue(e, "15%", "0.15");
+ e.addValue(e, "25%", "0.25");
+ e.addValue(e, "50%", "0.5");
+ e.addValue(e, "75%", "0.75");
+ e.addValue(e, "100%", "1");
+ e.configureXonoticTextSliderValues(e);
me.TR(me);
me.TR(me);
me.TDempty(me, 0.2);
e.addValue(e, strzone(_("Unlimited")), "0");
e.configureXonoticTextSliderValues(e);
me.TR(me);
- if(cvar("developer"))
+ if(cvar("developer") > 0)
{
me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Local latency:")));
me.TD(me, 1, 2, e = makeXonoticSlider(0, 1000, 25, "cl_netlocalping"));
_("Enable vertical synchronization to prevent tearing, will cap your fps to the screen refresh rate")));
me.TR(me);
- if(cvar("developer"))
+ if(cvar("developer") > 0)
{
me.TD(me, 1, 3, e = makeXonoticCheckBox_T(0, "v_flipped", _("Flip view horizontally"),
_("Poor man's left handed mode")));
me.TD(me, 1, 2.8, e = makeXonoticCheckBox_T(0, "v_glslgamma", _("Use GLSL to handle color control"),
_("Enable use of GLSL to apply gamma correction, note that it might decrease performance by a lot")));
setDependent(e, "vid_gl20", 1, 1);
- if(cvar("developer"))
+ if(cvar("developer") > 0)
{
me.TR(me);
me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "v_psycho", _("Psycho coloring (easter egg)")));
me.gotoRC(me, me.rows - 2, 0);
me.TD(me, 1, 2, e = makeXonoticTextLabel(0.5, _("Campaign Difficulty:")));
me.TD(me, 1, 1, e = makeXonoticRadioButton(1, "g_campaign_skill", "-2", ZCTX(_("CSKL^Easy"))));
- me.TD(me, 1, 1, e = makeXonoticRadioButton(1, "g_campaign_skill", "-1", ZCTX(_("CSKL^Medium"))));
- me.TD(me, 1, 1, e = makeXonoticRadioButton(1, "g_campaign_skill", "0", ZCTX(_("CSKL^Hard"))));
+ me.TD(me, 1, 1, e = makeXonoticRadioButton(1, "g_campaign_skill", "0", ZCTX(_("CSKL^Medium"))));
+ me.TD(me, 1, 1, e = makeXonoticRadioButton(1, "g_campaign_skill", "2", ZCTX(_("CSKL^Hard"))));
me.TR(me);
me.TD(me, 1, me.columns, e = makeXonoticButton(_("Start Singleplayer!"), '0 0 0'));
e.onClick = CampaignList_LoadMap;
{
me.configureXonoticTextSlider(me, "cl_particles_quality",
_("Multiplier for amount of particles. Less means less particles, which in turn gives for better performance"));
- if(cvar("developer")) { me.addValue(me, ZCTX(_("PART^OMG")), "0.25 250 0"); }
+ if(cvar("developer") > 0) { me.addValue(me, ZCTX(_("PART^OMG")), "0.25 250 0"); }
me.addValue(me, ZCTX(_("PART^Low")), "0.5 500 0");
me.addValue(me, ZCTX(_("PART^Medium")), "0.75 750 0");
me.addValue(me, ZCTX(_("PART^Normal")), "1.0 1000 1");
me.addValue(me, ZCTX(_("PART^High")), "1.5 1500 1");
me.addValue(me, ZCTX(_("PART^Ultra")), "2.0 2000 2");
- if(cvar("developer")) { me.addValue(me, ZCTX(_("PART^Ultimate")), "3.0 3000 2"); }
+ if(cvar("developer") > 0) { me.addValue(me, ZCTX(_("PART^Ultimate")), "3.0 3000 2"); }
me.configureXonoticTextSliderValues(me);
}
void XonoticParticlesSlider_loadCvars(entity me)
#define GAMETYPE(id) ++i;
GAMETYPES
#undef GAMETYPE
- #define GAMETYPE(it) { if (dev) ++i; }
+ #define GAMETYPE(it) { if (dev > 0) ++i; }
HIDDEN_GAMETYPES
#undef GAMETYPE
return i;
float autocvar_g_balance_falldamage_factor;
int autocvar_g_balance_falldamage_maxdamage;
float autocvar_g_balance_falldamage_minspeed;
+bool autocvar_g_balance_falldamage_onlyvertical;
int autocvar_g_balance_firetransfer_damage;
int autocvar_g_balance_firetransfer_time;
float autocvar_g_balance_fuel_limit;
float autocvar_g_ballistics_density_player;
float autocvar_g_ballistics_mindistance;
bool autocvar_g_ballistics_penetrate_clips = true;
-float autocvar_g_ballistics_solidpenetration_exponent = 0.25;
+float autocvar_g_ballistics_solidpenetration_exponent = 1;
float autocvar_g_ban_default_bantime;
float autocvar_g_ban_default_masksize;
float autocvar_g_ban_sync_interval;
bool autocvar_g_weaponswitch_debug;
bool autocvar_g_weaponswitch_debug_alternate;
bool autocvar_g_allow_checkpoints;
-bool autocvar_sv_vq3compat_changehitbox = false;
+bool autocvar_sv_q3defragcompat_changehitbox = false;
}
else
{
+ entity balance = TeamBalance_CheckAllowedTeams(NULL);
+ TeamBalance_GetTeamCounts(balance, NULL);
+ int smallest_team = -1;
+ int smallest_count = -1;
+ if (teamplay)
+ {
+ for (int i = 1; i <= AvailableTeams(); ++i)
+ {
+ // NOTE if (autocvar_g_campaign && autocvar_g_campaign_forceteam == i)
+ // TeamBalance_GetNumberOfPlayers(balance, i); returns the number of players + 1
+ // since it keeps a spot for the real player in the desired team
+ int count = TeamBalance_GetNumberOfPlayers(balance, i);
+ if (smallest_count < 0 || count < smallest_count)
+ {
+ smallest_team = i;
+ smallest_count = count;
+ }
+ }
+ }
+ TeamBalance_Destroy(balance);
RandomSelection_Init();
while((readfile = fgets(file)))
{
continue;
if(substring(readfile, 0, 1) == "#")
continue;
+ // NOTE if the line is empty tokenizebyseparator(readfile, "\t")
+ // will create 1 empty token because there's no separator (bug?)
+ if (readfile == "")
+ continue;
tokens = tokenizebyseparator(readfile, "\t");
if(tokens == 0)
continue;
s = argv(0);
- prio = 1;
+ prio = 0;
+ bool conflict = false;
FOREACH_CLIENT(IS_BOT_CLIENT(it), {
- if(s == it.cleanname)
+ if (s == it.cleanname)
{
- prio = 0;
+ conflict = true;
break;
}
});
+ if (!conflict)
+ prio += 1;
+ if (teamplay && !(autocvar_bot_vs_human && AvailableTeams() == 2))
+ {
+ int forced_team = stof(argv(5));
+ if (!Team_IsValidIndex(forced_team))
+ forced_team = 0;
+ if (!forced_team || forced_team == smallest_team)
+ prio += 2;
+ }
RandomSelection_AddString(readfile, 1, prio);
}
readfile = RandomSelection_chosen_string;
if(argv(4) != "" && stof(argv(4)) >= 0) bot_pants = argv(4);
else bot_pants = ftos(floor(random() * 15));
- if (teamplay && autocvar_bot_vs_human && AvailableTeams() == 2)
- this.bot_forced_team = 0;
- else
+ if (teamplay && !(autocvar_bot_vs_human && AvailableTeams() == 2))
this.bot_forced_team = stof(argv(5));
+ else
+ this.bot_forced_team = 0;
prio = 6;
}
else
{
- if(autocvar_developer)
+ if(autocvar_developer > 0)
{
LOG_INFO("A generated waypoint is stuck in solid at ", vtos(w.origin));
backtrace("Waypoint stuck");
return;
}
- baseskill = autocvar_g_campaign_skill;
- baseskill = baseskill + campaign_botskill[0];
- if(baseskill < 0)
- baseskill = 0;
-
+ baseskill = max(0, autocvar_g_campaign_skill + campaign_botskill[0]);
campaign_forcewin = false;
cvar_set("sv_public", "0");
if(autocvar__campaign_testrun)
{
cvar_set("fraglimit", "0");
+ cvar_set("leadlimit", "0");
cvar_set("timelimit", "0.01");
cvar_set_normal("fraglimit", "0");
+ cvar_set_normal("leadlimit", "0");
cvar_set_normal("timelimit", "0.01");
}
else
{
- cvar_set("fraglimit", ftos(campaign_fraglimit[0]));
- cvar_set("timelimit", ftos(campaign_timelimit[0]));
- cvar_set_normal("fraglimit", ftos(campaign_fraglimit[0]));
- cvar_set_normal("timelimit", ftos(campaign_timelimit[0]));
+ // "default" uses implicit values, "" or "0" means no limit
+ tokenizebyseparator(campaign_fraglimit[0], "+");
+ if(argv(0) != "default") {
+ cvar_set("fraglimit", argv(0));
+ cvar_set_normal("fraglimit", argv(0));
+ }
+ if(argv(1) != "default") {
+ cvar_set("leadlimit", argv(1));
+ cvar_set_normal("leadlimit", argv(1));
+ }
+ if(campaign_timelimit[0] != "default") {
+ cvar_set("timelimit", campaign_timelimit[0]);
+ cvar_set_normal("timelimit", campaign_timelimit[0]);
+ }
}
}
#include "campaign.qh"
#include "command/common.qh"
#include "scores_rules.qh"
+#include "weapons/common.qh"
#include "bot/api.qh"
this.respawn_flags = 0;
this.respawn_time = 0;
STAT(RESPAWN_TIME, this) = 0;
- this.scale = autocvar_sv_player_scale;
+ bool q3dfcompat = autocvar_sv_q3defragcompat && autocvar_sv_q3defragcompat_changehitbox;
+ this.scale = ((q3dfcompat) ? 0.9 : autocvar_sv_player_scale);
this.fade_time = 0;
this.pain_frame = 0;
this.pain_finished = 0;
for (int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
{
.entity weaponentity = weaponentities[slot];
- entity oldwep = this.(weaponentity);
CL_SpawnWeaponentity(this, weaponentity);
- if(oldwep && oldwep.owner == this)
- this.(weaponentity).m_gunalign = oldwep.m_gunalign;
}
this.alpha = default_player_alpha;
this.colormod = '1 1 1' * autocvar_g_player_brightness;
if (CS(this).impulse) ImpulseCommands(this);
+ W_ResetGunAlign(this, CS(this).cvar_cl_gunalign);
for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
{
.entity weaponentity = weaponentities[slot];
ERASEABLE
void DebugPrintToChat(entity client, string text)
{
- if (autocvar_developer)
+ if (autocvar_developer > 0)
{
PrintToChat(client, text);
}
ERASEABLE
void DebugPrintToChatAll(string text)
{
- if (autocvar_developer)
+ if (autocvar_developer > 0)
{
PrintToChatAll(text);
}
ERASEABLE
void DebugPrintToChatTeam(int team_num, string text)
{
- if (autocvar_developer)
+ if (autocvar_developer > 0)
{
PrintToChatTeam(team_num, text);
}
.int items_added;
.string shootfromfixedorigin;
+.bool dualwielding_prev;
bool PlayerThink(entity this)
{
if (game_stopped || intermission_running) {
stuffcmd(this, sprintf("\ncl_shootfromfixedorigin \"%s\"\n", autocvar_g_shootfromfixedorigin));
}
+ // reset gun alignment when dual wielding status changes
+ // to ensure guns are always aligned right and left
+ bool dualwielding = W_DualWielding(this);
+ if(this.dualwielding_prev != dualwielding)
+ {
+ W_ResetGunAlign(this, CS(this).cvar_cl_gunalign);
+ this.dualwielding_prev = dualwielding;
+ }
+
// LordHavoc: allow firing on move frames (sub-ticrate), this gives better timing on slow servers
//if(frametime)
{
this.items |= this.items_added;
}
- player_regen(this);
-
- // WEAPONTODO: Add a weapon request for this
- // rot vortex charge to the charge limit
- for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
+ if (frametime)
{
- .entity weaponentity = weaponentities[slot];
- if (WEP_CVAR(vortex, charge_rot_rate) && this.(weaponentity).vortex_charge > WEP_CVAR(vortex, charge_limit) && this.(weaponentity).vortex_charge_rottime < time)
- this.(weaponentity).vortex_charge = bound(WEP_CVAR(vortex, charge_limit), this.(weaponentity).vortex_charge - WEP_CVAR(vortex, charge_rot_rate) * frametime / W_TICSPERFRAME, 1);
- }
+ // WEAPONTODO: Add a weapon request for this
+ // rot vortex charge to the charge limit
+ for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
+ {
+ .entity weaponentity = weaponentities[slot];
+ if (WEP_CVAR(vortex, charge_rot_rate) && this.(weaponentity).vortex_charge > WEP_CVAR(vortex, charge_limit) && this.(weaponentity).vortex_charge_rottime < time)
+ this.(weaponentity).vortex_charge = bound(WEP_CVAR(vortex, charge_limit), this.(weaponentity).vortex_charge - WEP_CVAR(vortex, charge_rot_rate) * frametime / W_TICSPERFRAME, 1);
+ }
- if (frametime) player_anim(this);
+ player_regen(this);
+ player_anim(this);
+ this.dmg_team = max(0, this.dmg_team - autocvar_g_teamdamage_resetspeed * frametime);
+ }
- // secret status
secrets_setstatus(this);
-
- // monsters status
monsters_setstatus(this);
- this.dmg_team = max(0, this.dmg_team - autocvar_g_teamdamage_resetspeed * frametime);
-
return true;
}
this.max_armorvalue = 0;
}
- if(IS_PLAYER(this))
+ if (frametime && IS_PLAYER(this))
{
if (STAT(FROZEN, this) == FROZEN_TEMP_REVIVING)
{
{
if (!intermission_running && IS_CLIENT(caller))
{
- if((IS_SPEC(caller) || IS_OBSERVER(caller)) && argv(1) != "")
+ if(argv(1) != "")
{
- entity client = GetFilteredEntity(argv(1));
- int spec_accepted = VerifyClientEntity(client, false, false);
- if(spec_accepted > 0 && IS_PLAYER(client))
+ if(IS_SPEC(caller) || IS_OBSERVER(caller))
{
- if(Spectate(caller, client))
- return; // fall back to regular handling
+ entity client = GetFilteredEntity(argv(1));
+ int spec_accepted = VerifyClientEntity(client, false, false);
+ if(spec_accepted > 0 && IS_PLAYER(client))
+ {
+ Spectate(caller, client);
+ }
+ else
+ sprint(caller, "can't spectate ", argv(1), "^7\n");
}
+ else
+ sprint(caller, "cmd spectate client only works when you are spectator/observer\n");
+ return;
}
int mutator_returnvalue = MUTATOR_CALLHOOK(ClientCommand_Spectate, caller);
default:
case CMD_REQUEST_USAGE:
{
- sprint(caller, "\nUsage:^3 cmd spectate <client>\n");
+ sprint(caller, "\nUsage:^3 cmd spectate [client]\n");
sprint(caller, " Where 'client' can be the player to spectate.\n");
return;
}
void ReadyRestart()
{
if (MUTATOR_CALLHOOK(ReadyRestart_Deny) || game_stopped || race_completing) localcmd("restart\n");
- else localcmd("\nsv_hook_gamerestart\n");
+ else localcmd("\nsv_hook_readyrestart\n");
// Reset ALL scores, but only do that at the beginning of the countdown if sv_ready_restart_after_countdown is off!
// Otherwise scores could be manipulated during the countdown.
SPAWNFUNC_ITEM(item_enviro, ITEM_Shield)
// medkit -> armor (we have no holdables)
-SPAWNFUNC_ITEM(holdable_medkit, ITEM_ArmorMega)
-
-// doubler -> strength
-SPAWNFUNC_ITEM(item_doubler, ITEM_Strength)
+SPAWNFUNC_ITEM(holdable_medkit, ITEM_ArmorBig)
.float wait;
.float delay;
}
//spawnfunc(item_flight) /* handled by buffs mutator */
+//spawnfunc(item_doubler) /* handled by buffs mutator */
//spawnfunc(item_haste) /* handled by buffs mutator */
//spawnfunc(item_health) /* handled in t_quake.qc */
//spawnfunc(item_health_large) /* handled in t_items.qc */
if(weaponLocked(actor)) return;
if(actor.vehicle) return;
- // TODO: offhand hook shoots from eye
+ int s = W_GunAlign(actor.(weaponentity), STAT(GUNALIGN, actor)) - 1;
+ vector vs = hook_shotorigin[s];
+ vector oldmovedir = actor.(weaponentity).movedir;
+ actor.(weaponentity).movedir = vs;
W_SetupShot_ProjectileSize(actor, weaponentity, '-3 -3 -3', '3 3 3', true, 0, SND_HOOK_FIRE, CH_WEAPON_B, 0, WEP_HOOK.m_id);
Send_Effect(EFFECT_HOOK_MUZZLEFLASH, w_shotorg, '0 0 0', 1);
+ actor.(weaponentity).movedir = oldmovedir;
entity missile = WarpZone_RefSys_SpawnSameRefSys(actor);
missile.owner = missile.realowner = actor;
BADCVAR("g_balance_kill_delay");
BADCVAR("g_buffs_pickup_anyway");
BADCVAR("g_buffs_randomize");
+ BADCVAR("g_buffs_randomize_teamplay");
BADCVAR("g_campcheck_distance");
BADCVAR("g_ca_point_leadlimit");
BADCVAR("g_ca_point_limit");
MapInfo_Enumerate();
MapInfo_FilterGametype(MapInfo_CurrentGametype(), MapInfo_CurrentFeatures(), MapInfo_RequiredFlags(), MapInfo_ForbiddenFlags(), 1);
+ if(fexists(strcat("scripts/", mapname, ".arena")))
+ cvar_settemp("sv_q3acompat_machineshotgunswap", "1");
+
+ if(fexists(strcat("scripts/", mapname, ".defi")))
+ cvar_settemp("sv_q3defragcompat", "1");
+
if(whichpack(strcat("maps/", mapname, ".cfg")) != "")
{
int fd = fopen(strcat("maps/", mapname, ".cfg"), FILE_READ);
else
db_save(ServerProgsDB, strcat("server.db", autocvar_sessionid));
}
- if(autocvar_developer)
+ if(autocvar_developer > 0)
{
if(autocvar_sv_db_saveasdump)
db_dump(TemporaryDB, "server-temp.db");
#include "ipban.qh"
#include <server/mutators/_mod.qh>
#include "../common/t_items.qh"
+#include "mapvoting.qh"
#include "resources.qh"
#include "items.qh"
#include "player.qh"
#include "../common/state.qh"
#include "../common/effects/qc/globalsound.qh"
#include "../common/wepent.qh"
+#include <common/weapons/weapon.qh>
#include "../lib/csqcmodel/sv_model.qh"
#include "../lib/warpzone/anglestransform.qh"
#include "../lib/warpzone/server.qh"
return ret;
}
-string AmmoNameFromWeaponentity(Weapon wep)
+string PlayerHealth(entity this)
{
- string ammoitems = "batteries";
- switch (wep.ammo_type)
- {
- case RES_SHELLS: ammoitems = ITEM_Shells.m_name; break;
- case RES_BULLETS: ammoitems = ITEM_Bullets.m_name; break;
- case RES_ROCKETS: ammoitems = ITEM_Rockets.m_name; break;
- case RES_CELLS: ammoitems = ITEM_Cells.m_name; break;
- case RES_PLASMA: ammoitems = ITEM_Plasma.m_name; break;
- case RES_FUEL: ammoitems = ITEM_JetpackFuel.m_name; break;
- }
- return ammoitems;
+ float myhealth = floor(GetResource(this, RES_HEALTH));
+ if(myhealth == -666)
+ return "spectating";
+ else if(myhealth == -2342 || (myhealth == 2342 && mapvote_initialized))
+ return "observing";
+ else if(myhealth <= 0 || IS_DEAD(this))
+ return "dead";
+ return ftos(myhealth);
+}
+
+string WeaponNameFromWeaponentity(entity this, .entity weaponentity)
+{
+ entity wepent = this.(weaponentity);
+ if(!wepent)
+ return "none";
+ else if(wepent.m_weapon != WEP_Null)
+ return wepent.m_weapon.m_name;
+ else if(wepent.m_switchweapon != WEP_Null)
+ return wepent.m_switchweapon.m_name;
+ return "none"; //Weapons_from(wepent.cnt).m_name;
}
string formatmessage(entity this, string msg)
case "\\":replacement = "\\"; break;
case "n": replacement = "\n"; break;
case "a": replacement = ftos(floor(GetResource(this, RES_ARMOR))); break;
- case "h": replacement = ftos(floor(GetResource(this, RES_HEALTH))); break;
+ case "h": replacement = PlayerHealth(this); break;
case "l": replacement = NearestLocation(this.origin); break;
case "y": replacement = NearestLocation(cursor); break;
case "d": replacement = NearestLocation(this.death_origin); break;
- case "w": replacement = ((this.(weaponentity).m_weapon == WEP_Null) ? ((this.(weaponentity).m_switchweapon == WEP_Null) ? Weapons_from(this.(weaponentity).cnt) : this.(weaponentity).m_switchweapon) : this.(weaponentity).m_weapon).m_name; break;
- case "W": replacement = AmmoNameFromWeaponentity(this.(weaponentity).m_weapon); break;
+ case "w": replacement = WeaponNameFromWeaponentity(this, weaponentity); break;
+ case "W": replacement = GetAmmoName(this.(weaponentity).m_weapon.ammo_type); break;
case "x": replacement = ((cursor_ent.netname == "" || !cursor_ent) ? "nothing" : cursor_ent.netname); break;
case "s": replacement = ftos(vlen(this.velocity - this.velocity_z * '0 0 1')); break;
case "S": replacement = ftos(vlen(this.velocity)); break;
}
if (s == "cl_allow_uidtracking")
PlayerStats_GameReport_AddPlayer(this);
+ //if (s == "cl_gunalign")
+ //W_ResetGunAlign(this, store.cvar_cl_gunalign);
}
}
void readplayerstartcvars()
{
- float i, t;
-
// initialize starting values for players
start_weapons = '0 0 0';
start_weapons_default = '0 0 0';
else
{
g_weaponarena = 1;
- t = tokenize_console(s);
+ float t = tokenize_console(s);
g_weaponarena_list = "";
- for (i = 0; i < t; ++i)
+ for (int j = 0; j < t; ++j)
{
- s = argv(i);
+ s = argv(j);
Weapon wep = Weapons_fromstr(s);
if(wep != WEP_Null)
{
return false;
}
-#define SUB_OwnerCheck(ent,oth) ((oth) && ((oth) == (ent).owner))
-
bool WarpZone_Projectile_Touch_ImpactFilter_Callback(entity this, entity toucher)
{
- if(SUB_OwnerCheck(this, toucher))
+ // owner check
+ if(toucher && toucher == this.owner)
return true;
if(SUB_NoImpactCheck(this, toucher))
{
}
}
-string uid2name(string myuid) {
- string s;
- s = db_get(ServerProgsDB, strcat("/uid2name/", myuid));
+string uid2name(string myuid)
+{
+ string s = db_get(ServerProgsDB, strcat("/uid2name/", myuid));
// FIXME remove this later after 0.6 release
// convert old style broken records to correct style
return s;
}
-float MoveToRandomLocationWithinBounds(entity e, vector boundmin, vector boundmax, float goodcontents, float badcontents, float badsurfaceflags, float attempts, float maxaboveground, float minviewdistance)
+bool MoveToRandomLocationWithinBounds(entity e, vector boundmin, vector boundmax, float goodcontents, float badcontents, float badsurfaceflags, int attempts, float maxaboveground, float minviewdistance)
{
- float m, i;
- vector start, org, delta, end, enddown, mstart;
-
- m = e.dphitcontentsmask;
+ float m = e.dphitcontentsmask;
e.dphitcontentsmask = goodcontents | badcontents;
- org = boundmin;
- delta = boundmax - boundmin;
+ vector org = boundmin;
+ vector delta = boundmax - boundmin;
+ vector start, end;
start = end = org;
-
- for (i = 0; i < attempts; ++i)
+ int j; // used after the loop
+ for(j = 0; j < attempts; ++j)
{
start.x = org.x + random() * delta.x;
start.y = org.y + random() * delta.y;
// rule 2: if we are too high, lower the point
if (trace_fraction * delta.z > maxaboveground)
start = trace_endpos + '0 0 1' * maxaboveground;
- enddown = trace_endpos;
+ vector enddown = trace_endpos;
// rule 3: make sure we aren't outside the map. This only works
// for somewhat well formed maps. A good rule of thumb is that
// the map should have a convex outside hull.
// these can be traceLINES as we already verified the starting box
- mstart = start + 0.5 * (e.mins + e.maxs);
+ vector mstart = start + 0.5 * (e.mins + e.maxs);
traceline(mstart, mstart + '1 0 0' * delta.x, MOVE_NORMAL, e);
if (trace_fraction >= 1 || trace_dphittexturename == "common/caulk")
continue;
if (trace_fraction >= 1 || trace_dphittexturename == "common/caulk")
continue;
- // rule 4: we must "see" some spawnpoint or item
- entity sp = NULL;
- IL_EACH(g_spawnpoints, checkpvs(mstart, it),
- {
- if((traceline(mstart, it.origin, MOVE_NORMAL, e), trace_fraction) >= 1)
- {
- sp = it;
- break;
- }
- });
- if(!sp)
- {
- int items_checked = 0;
- IL_EACH(g_items, checkpvs(mstart, it),
+ // rule 4: we must "see" some spawnpoint or item
+ entity sp = NULL;
+ IL_EACH(g_spawnpoints, checkpvs(mstart, it),
+ {
+ if((traceline(mstart, it.origin, MOVE_NORMAL, e), trace_fraction) >= 1)
+ {
+ sp = it;
+ break;
+ }
+ });
+ if(!sp)
{
- if((traceline(mstart, it.origin + (it.mins + it.maxs) * 0.5, MOVE_NORMAL, e), trace_fraction) >= 1)
+ int items_checked = 0;
+ IL_EACH(g_items, checkpvs(mstart, it),
{
- sp = it;
- break;
- }
+ if((traceline(mstart, it.origin + (it.mins + it.maxs) * 0.5, MOVE_NORMAL, e), trace_fraction) >= 1)
+ {
+ sp = it;
+ break;
+ }
- ++items_checked;
- if(items_checked >= attempts)
- break; // sanity
- });
+ ++items_checked;
+ if(items_checked >= attempts)
+ break; // sanity
+ });
- if(!sp)
- continue;
- }
+ if(!sp)
+ continue;
+ }
// find a random vector to "look at"
end.x = org.x + random() * delta.x;
// rule 4: start TO end must not be too short
tracebox(start, e.mins, e.maxs, end, MOVE_NORMAL, e);
- if (trace_startsolid)
+ if(trace_startsolid)
continue;
- if (trace_fraction < minviewdistance / vlen(delta))
+ if(trace_fraction < minviewdistance / vlen(delta))
continue;
// rule 5: don't want to look at sky
- if (trace_dphitq3surfaceflags & Q3SURFACEFLAG_SKY)
+ if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_SKY)
continue;
// rule 6: we must not end up in trigger_hurt
- if (tracebox_hits_trigger_hurt(start, e.mins, e.maxs, enddown))
+ if(tracebox_hits_trigger_hurt(start, e.mins, e.maxs, enddown))
continue;
break;
e.dphitcontentsmask = m;
- if (i < attempts)
+ if(j < attempts)
{
setorigin(e, start);
e.angles = vectoangles(end - start);
- LOG_DEBUG("Needed ", ftos(i + 1), " attempts");
+ LOG_DEBUG("Needed ", ftos(j + 1), " attempts");
return true;
}
- else
- return false;
+ return false;
}
float MoveToRandomMapLocation(entity e, float goodcontents, float badcontents, float badsurfaceflags, float attempts, float maxaboveground, float minviewdistance)
e.v_angle = e.angles - to.angles; // relative angles
}
+#if 0
+// TODO: unused, likely for a reason, possibly needs extensions (allow setting the new movetype as a parameter?)
void unfollow_sameorigin(entity e)
{
set_movetype(e, MOVETYPE_NONE);
}
-
-entity gettaginfo_relative_ent;
-vector gettaginfo_relative(entity e, float tag)
-{
- if (!gettaginfo_relative_ent)
- {
- gettaginfo_relative_ent = spawn();
- gettaginfo_relative_ent.effects = EF_NODRAW;
- }
- gettaginfo_relative_ent.model = e.model;
- gettaginfo_relative_ent.modelindex = e.modelindex;
- gettaginfo_relative_ent.frame = e.frame;
- return gettaginfo(gettaginfo_relative_ent, tag);
-}
+#endif
.string aiment_classname;
.float aiment_deadflag;
string uid2name(string myuid);
-float MoveToRandomLocationWithinBounds(entity e, vector boundmin, vector boundmax, float goodcontents, float badcontents, float badsurfaceflags, float attempts, float maxaboveground, float minviewdistance);
+bool MoveToRandomLocationWithinBounds(entity e, vector boundmin, vector boundmax, float goodcontents, float badcontents, float badsurfaceflags, int attempts, float maxaboveground, float minviewdistance);
float MoveToRandomMapLocation(entity e, float goodcontents, float badcontents, float badsurfaceflags, float attempts, float maxaboveground, float minviewdistance);
string NearestLocation(vector p);
-string AmmoNameFromWeaponentity(Weapon wep);
-
void play2(entity e, string filename);
string playername(entity p, bool team_colorize);
if(attacker == this)
{
- // don't reset pushltime for this damage as it may be an attempt to
+ // don't reset pushltime for self damage as it may be an attempt to
// escape a lava pit or similar
//this.pushltime = 0;
this.istypefrag = 0;
#include "../lib/warpzone/common.qh"
#include "../common/vehicles/vehicle.qh"
#include "../common/vehicles/sv_vehicles.qh"
+#include <server/player.qh>
#define PORTALS_ARE_NOT_SOLID
}
.vector right_vector;
-float Portal_TeleportPlayer(entity teleporter, entity player)
+float Portal_TeleportPlayer(entity teleporter, entity player, entity portal_owner)
{
vector from, to, safe, step, transform, ang, newvel;
float planeshift, s, t;
if(time < teleporter.teleport_time + 1)
Send_Notification(NOTIF_ONE, player, MSG_ANNCE, ANNCE_ACHIEVEMENT_AMAZING);
}
+ else if(player != portal_owner && IS_PLAYER(portal_owner) && IS_PLAYER(player))
+ {
+ player.pusher = portal_owner;
+ player.pushltime = time + autocvar_g_maxpushtime;
+ player.istypefrag = PHYS_INPUT_BUTTON_CHAT(player);
+ }
if (!teleporter.enemy)
{
}
*/
- if(Portal_TeleportPlayer(this, toucher))
+ if(Portal_TeleportPlayer(this, toucher, this.aiment))
if(toucher.classname == "porto")
if(toucher.effects & EF_RED)
toucher.effects += EF_BLUE - EF_RED;
Portal_Remove(this, 1);
}
-void Portal_Think_TryTeleportPlayer(entity this, entity e, vector g)
+void Portal_Think_TryTeleportPlayer(entity this, entity e, vector g, entity portal_owner)
{
if(!Portal_WillHitPlane(e.origin, e.mins, e.maxs, e.velocity + g, this.origin, v_forward, this.maxs.x))
return;
// already teleport him
tracebox(e.origin, e.mins, e.maxs, e.origin + e.velocity * 2 * frametime, MOVE_NORMAL, e);
if(trace_ent == this)
- Portal_TeleportPlayer(this, e);
+ Portal_TeleportPlayer(this, e, portal_owner);
}
void Portal_Think(entity this)
continue; // cannot go through someone else's portal
if(it != o || time >= this.portal_activatetime)
- Portal_Think_TryTeleportPlayer(this, it, g);
+ Portal_Think_TryTeleportPlayer(this, it, g, o);
for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
{
.entity weaponentity = weaponentities[slot];
if(it.(weaponentity).hook)
- Portal_Think_TryTeleportPlayer(this, it.(weaponentity).hook, g);
+ Portal_Think_TryTeleportPlayer(this, it.(weaponentity).hook, g, o);
}
});
this.solid = SOLID_TRIGGER;
return; // if the entity hasn't moved and isn't moving, then don't do anything
// check for falling damage
- float velocity_len = vlen(this.velocity);
bool have_hook = false;
for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
{
}
if(!have_hook)
{
- float dm = vlen(this.oldvelocity) - velocity_len; // dm is now the velocity DECREASE. Velocity INCREASE should never cause a sound or any damage.
+ float dm; // dm is the velocity DECREASE. Velocity INCREASE should never cause a sound or any damage.
+ if(autocvar_g_balance_falldamage_onlyvertical)
+ dm = fabs(this.oldvelocity.z) - vlen(this.velocity);
+ else
+ dm = vlen(this.oldvelocity) - vlen(this.velocity);
if (IS_DEAD(this))
dm = (dm - autocvar_g_balance_falldamage_deadminspeed) * autocvar_g_balance_falldamage_factor;
else
dm = min((dm - autocvar_g_balance_falldamage_minspeed) * autocvar_g_balance_falldamage_factor, autocvar_g_balance_falldamage_maxdamage);
if (dm > 0)
- Damage (this, NULL, NULL, dm, DEATH_FALL.m_id, DMG_NOWEP, this.origin, '0 0 0');
+ {
+ tracebox(this.origin, this.mins, this.maxs, this.origin - '0 0 1', MOVE_NOMONSTERS, this);
+ if (!(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NODAMAGE))
+ Damage (this, NULL, NULL, dm, DEATH_FALL.m_id, DMG_NOWEP, this.origin, '0 0 0');
+ }
}
- if(autocvar_g_maxspeed > 0 && velocity_len > autocvar_g_maxspeed)
+ if(autocvar_g_maxspeed > 0 && vdist(this.velocity, >, autocvar_g_maxspeed))
Damage (this, NULL, NULL, 100000, DEATH_SHOOTING_STAR.m_id, DMG_NOWEP, this.origin, '0 0 0');
}
anticheat_startframe();
MUTATOR_CALLHOOK(SV_StartFrame);
+ GlobalStats_updateglobal();
FOREACH_CLIENT(true, GlobalStats_update(it));
IL_EACH(g_players, IS_FAKE_CLIENT(it), PlayerPostThink(it));
}
restartanim = fr != WFRAME_IDLE;
}
- vector a = '0 0 0';
this.wframe = fr;
- if (fr == WFRAME_IDLE) a = this.anim_idle;
- else if (fr == WFRAME_FIRE1) a = this.anim_fire1;
- else if (fr == WFRAME_FIRE2) a = this.anim_fire2;
- else // if (fr == WFRAME_RELOAD)
- a = this.anim_reload;
- a.z *= g_weaponratefactor;
if (this.weapon_think == w_ready && func != w_ready && this.state == WS_RAISE) backtrace(
"Tried to override initial weapon think function - should this really happen?");
{
FOREACH_CLIENT(true, {
if(it == actor || (IS_SPEC(it) && it.enemy == actor))
- wframe_send(it, this, a, restartanim);
+ wframe_send(it, this, fr, g_weaponratefactor, restartanim);
});
}
return false;
}
+void W_ResetGunAlign(entity player, int preferred_alignment)
+{
+ if(W_DualWielding(player))
+ preferred_alignment = 3; // right align, the second gun will default to left
+
+ // clear current weapon slots' alignments so we can redo the calculations!
+ for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
+ {
+ .entity weaponentity = weaponentities[slot];
+ if (player.(weaponentity))
+ player.(weaponentity).m_gunalign = 0;
+ }
+
+ // now set the new values
+ for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
+ {
+ .entity weaponentity = weaponentities[slot];
+ if (player.(weaponentity))
+ player.(weaponentity).m_gunalign = W_GunAlign(player.(weaponentity), preferred_alignment);
+ }
+}
+
.bool hook_switchweapon;
void W_WeaponFrame(Player actor, .entity weaponentity)
void W_Reload(entity actor, .entity weaponentity, float sent_ammo_min, Sound sent_sound);
+void W_ResetGunAlign(entity player, int preferred_alignment);
+
void W_WeaponFrame(Player actor, .entity weaponentity);
float W_WeaponRateFactor(entity this);
g_spawn_near_teammate_ignore_spawnpoint 1
g_spawnshieldtime 0.5
g_respawn_delay_forced 2
+
+g_ballistics_solidpenetration_exponent 0.25
{
{
map textures/electro_plasma_hull.tga
- alphaFunc GT0
+ alphaFunc GE128
rgbGen Vertex
}
}
map textures/electronew.tga
rgbgen lightingDiffuse
}
-}
\ No newline at end of file
+}
set g_vehicle_raptor_cannon_cost 1
set g_vehicle_raptor_cannon_damage 10
set g_vehicle_raptor_cannon_radius 60
-set g_vehicle_raptor_cannon_refire 0.03
+set g_vehicle_raptor_cannon_refire 0.033333
set g_vehicle_raptor_cannon_speed 24000
set g_vehicle_raptor_cannon_spread 0.01
set g_vehicle_raptor_cannon_force 25
seta cl_spawn_event_sound 1 "sound effect whenever a player spawns"
//seta cl_spawn_point_model 0 "place a model at all spawn points" // still needs a model
seta cl_spawn_point_particles 1 "pointparticles effect at all spawn points" // managed by effects-.cfg files
-seta cl_spawn_point_dist_min 1200
-seta cl_spawn_point_dist_max 1600
+seta cl_spawn_point_dist_min 800
+seta cl_spawn_point_dist_max 1200
freelook 1
sensitivity 6
seta cl_hitsound_max_pitch 1.5 "maximum pitch of hit sound"
seta cl_hitsound_nom_damage 25 "damage amount at which hitsound bases pitch off"
-seta cl_eventchase_spectated_change 1 "camera goes into 3rd person mode for a moment when changing spectated player"
+seta cl_eventchase_spectated_change 0 "camera goes into 3rd person mode for a moment when changing spectated player"
seta cl_eventchase_spectated_change_time 1 "how much time the effect lasts when changing spectated player"
seta cl_eventchase_death 1 "camera goes into 3rd person mode when the player is dead; set to 2 to active the effect only when the corpse doesn't move anymore"
seta cl_eventchase_frozen 0 "camera goes into 3rd person mode when the player is frozen"
seta cl_movement_errorcompensation 1 "try to compensate for prediction errors and reduce perceived lag"
seta cl_movement_intermissionrunning 0 "keep velocity after the match ends, players may appear to continue running while stationary"
-seta cl_viewmodel_alpha 0 "Maximum transparency of the view model, set to 0 to disable"
+seta cl_viewmodel_alpha 1 "Maximum opacity of the view model, use a value between 0 and 1"
set debugdraw 0
set debugdraw_filter ""
set g_campaign 0
set g_campaign_forceteam 0 "Forces the player to a given team in campaign mode, 1 = red, 2 = blue, 3 = yellow, 4 = pink"
seta g_campaign_name "xonoticbeta"
-seta g_campaign_skill -1 // -2 easy -1 medium 0 hard
+seta g_campaign_skill 0 // -2 easy, 0 medium, 2 hard
alias singleplayer_start "g_campaign_index 0; set scmenu_campaign_goto 0"
alias singleplayer_continue "set scmenu_campaign_goto -1"
set sv_ready_restart_after_countdown 0 "reset players and map items after the countdown ended, instead of at the beginning of the countdown"
set sv_ready_restart_repeatable 0 "allows the players to restart the game as often as needed"
+alias sv_hook_readyrestart
+
//nifreks lockonrestart feature, used in team-based game modes, if set to 1 and all players readied up no other player can then join the game anymore, useful to block spectators from joining
set teamplay_lockonrestart 0 "lock teams once all players readied up and the game restarted (no new players can join after restart unless using the server-command unlockteams)"
set g_maplist_votable_suggestions 2 "number of maps a player is allowed to suggest for the map voting screen using 'suggestmap'"
set g_maplist_votable_suggestions_override_mostrecent 0 "allow players to suggest maps that have been played recently"
set g_maplist_votable_nodetail 0 "hide per-map vote counts (to avoid influential first votes)"
-set g_maplist_votable_abstain 0 "offer a "\don't care\" option on the voting screen"
+set g_maplist_votable_abstain 0 "offer a \"don't care\" option on the voting screen"
set g_maplist_votable_screenshot_dir "maps levelshots" "where to look for map screenshots"
set sv_vote_gametype 0 "show a vote screen for gametypes before map vote screen"
set g_ballistics_density_player 0.50 "how hard players are to shoot through compared to walls"
set g_ballistics_density_corpse 0.10 "how hard corpses are to shoot through compared to walls"
set g_ballistics_penetrate_clips 1 "allow ballistics to pass through weapon clips"
-set g_ballistics_solidpenetration_exponent 0.25 "how fast damage falls off when bullets pass through walls - 1 means linear, lower values mean slower initial falloff but faster once there's little solidpenetration left (damage_fraction = solidpen_fraction^exp for solidpen_fraction between 0 and 1)"
+set g_ballistics_solidpenetration_exponent 1 "how fast damage falls off when bullets pass through walls - 1 means linear, lower values mean slower initial falloff but faster once there's little solidpenetration left (damage_fraction = solidpen_fraction^exp for solidpen_fraction between 0 and 1)"
sv_status_show_qcstatus 1 "Xonotic uses this field instead of frags"
set g_full_getstatus_responses 0 "this currently breaks qstat"
sv_gameplayfix_nogravityonground 1
set sv_q3acompat_machineshotgunswap 0 "shorthand for swapping machinegun and shotgun (for Q3A map compatibility in mapinfo files)"
-set sv_vq3compat 0 "toggle for some compatibility hacks (for VQ3 and CPM map compatibility in mapinfo files)"
+set sv_q3defragcompat 0 "toggle for some compatibility hacks (for Q3DF map compatibility)"
set g_movement_highspeed 1 "multiplier scale for movement speed (applies to sv_maxspeed and sv_maxairspeed, also applies to air acceleration when g_movement_highspeed_q3_compat is set to 0)"
set g_movement_highspeed_q3_compat 0 "apply speed modifiers to air movement in a more Q3-compatible way (only apply speed buffs and g_movement_highspeed to max air speed, not to acceleration)"
set sv_damagetext 2 "<= 0: disabled, >= 1: visible to spectators, >= 2: visible to attacker, >= 3: all players see everyone's damage"
set sv_showfps 5 "Show player's FPS counters in the scoreboard. This setting acts as a delay in seconds between updates"
-set autocvar_sv_doors_always_open 0 "If set to 1 don't close doors which after they were open"
+set sv_doors_always_open 0 "If set to 1 don't close doors which after they were open"
+
+set sv_warpzone_allow_selftarget 0 "do not touch"