- cd gmqcc && make -j $(nproc) && export QCC="$PWD/gmqcc"
- cd ..
+test_compilation_units:
+ stage: test
+ script:
+ - ./qcsrc/tools/compilationunits.sh
+
test_sv_game:
stage: test
script:
- cd darkplaces && make sv-debug -j $(nproc) && export ENGINE="$PWD/darkplaces-dedicated -xonotic"
- cd ..
+ - mkdir -p data/maps
- wget -O data/g-23.pk3 http://beta.xonotic.org/autobuild-bsp/latest/g-23.pk3
+ - wget -O data/maps/g-23.mapinfo https://gitlab.com/xonotic/xonotic-maps.pk3dir/raw/master/maps/g-23.mapinfo
+ - wget -O data/maps/g-23.waypoints https://gitlab.com/xonotic/xonotic-maps.pk3dir/raw/master/maps/g-23.waypoints
+ - wget -O data/maps/g-23.waypoints.cache https://gitlab.com/xonotic/xonotic-maps.pk3dir/raw/master/maps/g-23.waypoints.cache
+ - wget -O data/maps/g-23.waypoints.hardwired https://gitlab.com/xonotic/xonotic-maps.pk3dir/raw/master/maps/g-23.waypoints.hardwired
- make
- - EXPECT=8573348372f9b9f82183b01598950eb5
+ - EXPECT=814b0e609bcf01dc2a44f2b17fa366b4
- HASH=$(${ENGINE} -noconfig -nohome +exec serverbench.cfg
| tee /dev/stderr
| grep '^:'
done < <(${ENGINE} +developer 1 +map gitlab-ci +sv_cmd runtest +exit)
- exit 1
-test_compilation_units:
- stage: test
- script:
- - ./qcsrc/tools/compilationunits.sh
-
doxygen: # rename to 'pages' when gitlab.com allows pages to exceed 100MiB
stage: deploy
script:
seta hud_colorset_background "7" "neutral/unimportant text"
// general hud panel cvars (i.e. shouldn't be adjusted by a skin config)
+seta hud_panel_weapons 1 "enable this panel"
+seta hud_panel_ammo 1 "enable this panel"
+seta hud_panel_powerups 1 "enable this panel"
+seta hud_panel_healtharmor 1 "enable this panel"
+seta hud_panel_notify 1 "enable this panel"
+seta hud_panel_timer 1 "enable this panel"
+seta hud_panel_radar 1 "enable this panel, 2 = also enable in non-teambased gamemodes"
+seta hud_panel_score 1 "enable this panel"
+seta hud_panel_racetimer 1 "enable this panel"
+seta hud_panel_vote 1 "enable this panel"
+seta hud_panel_modicons 1 "enable this panel"
+seta hud_panel_pressedkeys 1 "enable this panel, 1 = show only when spectating other players, 2 = show always"
+seta hud_panel_chat 1 "enable this panel"
+seta hud_panel_engineinfo 0 "enable this panel"
+seta hud_panel_infomessages 1 "enable this panel"
+seta hud_panel_physics 3 "enable this panel, 1 = show if not observing, 2 = show always, 3 = show only in race/cts if not observing"
+seta hud_panel_centerprint 1 "enable this panel"
+seta hud_panel_minigameboard 1 "enable this panel"
+seta hud_panel_minigamestatus 1 "enable this panel"
+seta hud_panel_minigamehelp 1 "enable this panel"
+seta hud_panel_minigamemenu 0 "enable this panel"
+seta hud_panel_mapvote 1 "enable this panel"
+seta hud_panel_itemstime 2 "enable this panel, 1 = show when spectating, 2 = even playing in warmup stage"
+seta hud_panel_quickmenu 1 "enable this panel"
+
seta hud_panel_weapons_ammo_full_shells 60 "show 100% of the status bar at this ammo count"
seta hud_panel_weapons_ammo_full_nails 320 "show 100% of the status bar at this ammo count"
seta hud_panel_weapons_ammo_full_cells 180 "show 100% of the status bar at this ammo count"
seta hud_configure_grid_xsize "" "snap to X * vid_conwidth"
seta hud_configure_grid_ysize "" "snap to Y * vid_conheight"
-seta hud_panel_weapons "" "enable/disable this panel"
seta hud_panel_weapons_pos "" "position of this panel"
seta hud_panel_weapons_size "" "size of this panel"
seta hud_panel_weapons_bg "" "if set to something else than \"\" = override default background"
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_ammo "" "enable/disable this panel"
seta hud_panel_ammo_pos "" "position of this panel"
seta hud_panel_ammo_size "" "size of this panel"
seta hud_panel_ammo_onlycurrent "" "1 = show only current ammo type"
seta hud_panel_ammo_progressbar_name "" "name of progressbar to use behind ammo icons"
seta hud_panel_ammo_text "" "show text/icons in the ammo panel"
-seta hud_panel_powerups "" "enable/disable this panel"
seta hud_panel_powerups_pos "" "position of this panel"
seta hud_panel_powerups_size "" "size of this panel"
seta hud_panel_powerups_baralign "" "0 = align bars to the left, 1 = align bars to the right, 2 = align only left bar to the right, 3 = align only right bar to the right"
seta hud_panel_powerups_progressbar "" "enable progressbar in panel"
seta hud_panel_powerups_text "" "show text and icons in the powerups panel"
-seta hud_panel_healtharmor "" "enable/disable this panel, 2 = combined health/armor display"
seta hud_panel_healtharmor_pos "" "position of this panel"
seta hud_panel_healtharmor_size "" "size of this panel"
+seta hud_panel_healtharmor_combined "" "combined health/armor display"
seta hud_panel_healtharmor_flip "" "flip health/armor positions"
seta hud_panel_healtharmor_baralign "" "0 = align bars to the left, 1 = align bars to the right, 2 = align only left bar to the right, 3 = align only right bar to the right"
seta hud_panel_healtharmor_iconalign "" "0 = align icons to the left, 1 = align icons to the right, 2 = align only left icon to the right, 3 = align only right icon to the right"
seta hud_panel_healtharmor_progressbar_gfx "" "enable graphic effects on the progressbars"
seta hud_panel_healtharmor_progressbar_gfx_smooth "" "smooth changes of the progressbar when health/armor change at least by this amount; 0 disables the effect"
-seta hud_panel_notify "" "enable/disable this panel"
seta hud_panel_notify_pos "" "position of this base of the panel"
seta hud_panel_notify_size "" "size of this panel with all notifications on"
seta hud_panel_notify_bg "" "if set to something else than \"\" = override default background"
seta hud_panel_notify_time "" "time that a new entry stays until it fades out"
seta hud_panel_notify_icon_aspect "" "aspect ratio of total drawing area per icon"
-seta hud_panel_timer "" "enable/disable this panel"
seta hud_panel_timer_pos "" "position of this base of the panel"
seta hud_panel_timer_size "" "size of this panel"
seta hud_panel_timer_bg "" "if set to something else than \"\" = override default background"
seta hud_panel_timer_bg_border "" "if set to something else than \"\" = override default size of border around the background"
seta hud_panel_timer_bg_padding "" "if set to something else than \"\" = override default padding of contents from border"
-seta hud_panel_radar "" "enable/disable this panel, 2 = also enable in non-teambased gamemodes"
seta hud_panel_radar_pos "" "position of this base of the panel"
seta hud_panel_radar_size "" "size of this panel"
seta hud_panel_radar_bg "" "if set to something else than \"\" = override default background"
seta hud_panel_radar_maximized_rotation "" "rotation mode: you set what points up. 0 = player, 1 = west, 2 = south, 3 = east, 4 = north"
seta hud_panel_radar_maximized_zoommode "" "zoom mode: 0 = zoomed by default, 1 = zoomed when +zoom, 2 = always zoomed, 3 = always zoomed out"
-seta hud_panel_score "" "enable/disable this panel"
seta hud_panel_score_pos "" "position of this base of the panel"
seta hud_panel_score_size "" "size of this panel"
seta hud_panel_score_bg "" "if set to something else than \"\" = override default background"
seta hud_panel_score_bg_padding "" "if set to something else than \"\" = override default padding of contents from border"
seta hud_panel_score_rankings "" "show rankings: 1 always show my own score; 2 pure rankings"
-seta hud_panel_racetimer "" "enable/disable this panel"
seta hud_panel_racetimer_pos "" "position of this base of the panel"
seta hud_panel_racetimer_size "" "size of this panel"
seta hud_panel_racetimer_bg "" "if set to something else than \"\" = override default background"
seta hud_panel_racetimer_bg_border "" "if set to something else than \"\" = override default size of border around the background"
seta hud_panel_racetimer_bg_padding "" "if set to something else than \"\" = override default padding of contents from border"
-seta hud_panel_vote "" "enable/disable this panel"
seta hud_panel_vote_pos "" "position of this base of the panel"
seta hud_panel_vote_size "" "size of this panel"
seta hud_panel_vote_alreadyvoted_alpha "" "alpha of the vote dialog after you have voted"
seta hud_panel_vote_bg_border "" "if set to something else than \"\" = override default size of border around the background"
seta hud_panel_vote_bg_padding "" "if set to something else than \"\" = override default padding of contents from border"
-seta hud_panel_modicons "" "enable/disable this panel"
seta hud_panel_modicons_pos "" "position of this base of the panel"
seta hud_panel_modicons_size "" "size of this panel"
seta hud_panel_modicons_bg "" "if set to something else than \"\" = override default background"
seta hud_panel_modicons_dom_layout "" "3 possible layouts: 0) only icons; 1) icons and percentage of average pps (points per second); 2) icons and average pps"
seta hud_panel_modicons_freezetag_layout "" "2 possible layouts: 0) number of alive players; 1) icons and number of alive players"
-seta hud_panel_pressedkeys "" "enable/disable this panel, 1 = show only when spectating other players, 2 = show always"
seta hud_panel_pressedkeys_pos "" "position of this base of the panel"
seta hud_panel_pressedkeys_size "" "size of this panel"
seta hud_panel_pressedkeys_bg "" "if set to something else than \"\" = override default background"
seta hud_panel_pressedkeys_aspect "" "forced aspect on panel"
seta hud_panel_pressedkeys_attack "" "show attack buttons too"
-seta hud_panel_chat "" "enable/disable this panel"
seta hud_panel_chat_pos "" "position of this base of the panel"
seta hud_panel_chat_size "" "size of this panel"
seta hud_panel_chat_bg "" "if set to something else than \"\" = override default background"
seta hud_panel_chat_bg_border "" "if set to something else than \"\" = override default size of border around the background"
seta hud_panel_chat_bg_padding "" "if set to something else than \"\" = override default padding of contents from border"
-seta hud_panel_engineinfo "" "enable/disable this panel"
seta hud_panel_engineinfo_pos "" "position of this base of the panel"
seta hud_panel_engineinfo_size "" "size of this panel"
seta hud_panel_engineinfo_bg "" "if set to something else than \"\" = override default background"
seta hud_panel_engineinfo_framecounter_decimals "" "amount of decimals to show"
seta hud_panel_engineinfo_framecounter_time "" "time between framerate display updates"
-seta hud_panel_infomessages "" "enable/disable this panel"
seta hud_panel_infomessages_pos "" "position of this base of the panel"
seta hud_panel_infomessages_size "" "size of this panel"
seta hud_panel_infomessages_bg "" "if set to something else than \"\" = override default background"
seta hud_panel_infomessages_bg_padding "" "if set to something else than \"\" = override default padding of contents from border"
seta hud_panel_infomessages_flip "" "1 = align the items to the right"
-seta hud_panel_physics "" "enable/disable this panel, 1 = show if not observing, 2 = show always, 3 = show only in race/cts if not observing"
seta hud_panel_physics_pos "" "position of this base of the panel"
seta hud_panel_physics_size "" "size of this panel"
seta hud_panel_physics_bg "" "if set to something else than \"\" = override default background"
seta hud_panel_physics_topspeed "" "also show top speed"
seta hud_panel_physics_topspeed_time "" "how many seconds the top speed takes to fade out"
-seta hud_panel_centerprint "" "enable/disable this panel"
seta hud_panel_centerprint_pos "" "position of this base of the panel"
seta hud_panel_centerprint_size "" "size of this panel"
seta hud_panel_centerprint_bg "" "if set to something else than \"\" = override default background"
seta hud_panel_centerprint_fade_subsequent_minfontsize "" "minimum factor for the font size from the subsequent fading effects"
seta hud_panel_centerprint_fade_minfontsize "" "minimum factor for the font size from the fading in/out effects"
-seta hud_panel_minigameboard "" "enable/disable this panel"
seta hud_panel_minigameboard_pos "" "position of this panel"
seta hud_panel_minigameboard_size "" "size of this panel"
seta hud_panel_minigameboard_bg "" "if set to something else than \"\" = override default background"
seta hud_panel_minigameboard_bg_border "" "if set to something else than \"\" = override default size of border around the background"
seta hud_panel_minigameboard_bg_padding "" "if set to something else than \"\" = override default padding of contents from border"
-seta hud_panel_minigamestatus "" "enable/disable this panel"
seta hud_panel_minigamestatus_pos "" "position of this panel"
seta hud_panel_minigamestatus_size "" "size of this panel"
seta hud_panel_minigamestatus_bg "" "if set to something else than \"\" = override default background"
seta hud_panel_minigamestatus_bg_border "" "if set to something else than \"\" = override default size of border around the background"
seta hud_panel_minigamestatus_bg_padding "" "if set to something else than \"\" = override default padding of contents from border"
-seta hud_panel_minigamehelp "" "enable/disable this panel"
seta hud_panel_minigamehelp_pos "" "position of this panel"
seta hud_panel_minigamehelp_size "" "size of this panel"
seta hud_panel_minigamehelp_bg "" "if set to something else than \"\" = override default background"
seta hud_panel_minigamehelp_bg_border "" "if set to something else than \"\" = override default size of border around the background"
seta hud_panel_minigamehelp_bg_padding "" "if set to something else than \"\" = override default padding of contents from border"
-seta hud_panel_minigamemenu "" "enable/disable this panel"
seta hud_panel_minigamemenu_pos "" "position of this panel"
seta hud_panel_minigamemenu_size "" "size of this panel"
seta hud_panel_minigamemenu_bg "" "if set to something else than \"\" = override default background"
seta hud_panel_minigamemenu_bg_border "" "if set to something else than \"\" = override default size of border around the background"
seta hud_panel_minigamemenu_bg_padding "" "if set to something else than \"\" = override default padding of contents from border"
-seta hud_panel_mapvote "" "enable/disable this panel"
seta hud_panel_mapvote_pos "" "position of this panel"
seta hud_panel_mapvote_size "" "size of this panel"
seta hud_panel_mapvote_bg "" "if set to something else than \"\" = override default background"
seta hud_panel_mapvote_bg_border "" "if set to something else than \"\" = override default size of border around the background"
seta hud_panel_mapvote_bg_padding "" "if set to something else than \"\" = override default padding of contents from border"
-seta hud_panel_itemstime "" "enable/disable this panel, it shows left time until important items (mega health, large armor, powerups, superweapons, etc...) respawn in the map: 1 when spectating, 2 even playing in warmup stage"
seta hud_panel_itemstime_pos "" "position of this base of the panel"
seta hud_panel_itemstime_size "" "size of this panel"
seta hud_panel_itemstime_bg "" "if set to something else than \"\" = override default background"
seta hud_panel_itemstime_ratio "" "ratio between space reserved for text and icon width of each item entry (min value is 2)"
seta hud_panel_itemstime_dynamicsize "" "allow panel size reduction by removing spacing among items"
-seta hud_panel_quickmenu "" "enable/disable this panel"
seta hud_panel_quickmenu_pos "" "position of this base of the panel"
seta hud_panel_quickmenu_size "" "size of this panel"
seta hud_panel_quickmenu_bg "" "if set to something else than \"\" = override default background"
set sv_spectator_speed_multiplier 1.5
seta sv_spectate 1 "if set to 1, new clients are allowed to spectate or observe the game, if set to 0 joining clients spawn as players immediately (no spectating)"
seta sv_defaultcharacter 0 "master switch, if set to 1 the further configuration for replacing all player models, skins and colors is taken from the sv_defaultplayermodel, sv_defaultplayerskin and sv_defaultplayercolors variables"
+seta sv_defaultcharacterskin 0 "if set to 1 the further configuration for replacing all skins is taken from the sv_defaultplayerskin variables"
seta sv_defaultplayermodel "models/player/erebus.iqm" "default model selection, only works if sv_defaultcharacter is set to 1; you may append a :<skinnumber> suffix to model names; you can specify multiple, separated by space, and a random one will be chosen"
seta sv_defaultplayerskin 0 "each model has 1 or more skins (combination of model and skin = character), set which skin of the model you wish the default character to have, only works if sv_defaultcharacter is set to 1; can be overriden by :<skinnumber> suffix in sv_defaultplayermodel"
seta sv_defaultplayermodel_red "" "\"\" means see sv_defaultplayermodel"
seta g_waypointsprite_turrets_maxdist 5000 "max distace for turret sprites"
seta g_waypointsprite_tactical 1 "tactical overlay on turrets when in a vehicle"
+seta cl_damagetext "0" "Draw damage dealt where you hit the enemy"
+seta cl_damagetext_format "-{total}" "How to format the damage text. {health}, {armor}, {total}"
+seta cl_damagetext_color "1 1 0" "Damage text color"
+seta cl_damagetext_color_per_weapon "0" "Damage text uses weapon color"
+seta cl_damagetext_size "8" "Damage text font size"
+seta cl_damagetext_alpha_start "1" "Damage text initial alpha"
+seta cl_damagetext_alpha_lifetime "3" "Damage text lifetime in seconds"
+seta cl_damagetext_velocity "0 0 20" "Damage text move direction"
+seta cl_damagetext_offset "0 -40 0" "Damage text offset"
+seta cl_damagetext_accumulate_range "30" "Damage text spawned within this range is accumulated"
+
set sv_itemstime 1 "enable networking of left time until respawn for items such as mega health and large armor"
// so it can be stuffcmd-ed still
// ======
set g_race 0 "Race: be faster than your opponents"
set g_race_qualifying_timelimit 0
-set g_race_qualifying_timelimit_override -1
+set g_race_qualifying_timelimit_override -1 "qualifying session time limit overriding the mapinfo specified one (use 0 to play without limit, and -1 to use the mapinfo's limit)"
set g_race_teams 0 "when 2, 3, or 4, the race is played as a team game (the team members can add up their laps)"
// ==========
seta hud_dock_color_team "1"
seta hud_dock_alpha "1"
-seta hud_progressbar_alpha "0.600000"
+seta hud_progressbar_alpha "0.6"
seta hud_progressbar_strength_color "1 0.39 0"
seta hud_progressbar_superweapons_color "0.77 0.67 0"
seta hud_progressbar_shield_color "0.36 1 0.07"
seta hud_configure_grid_xsize "0.005000"
seta hud_configure_grid_ysize "0.005000"
-seta hud_panel_weapons "1"
seta hud_panel_weapons_pos "0.965000 0.125000"
seta hud_panel_weapons_size "0.035000 0.770000"
seta hud_panel_weapons_bg "border_default_east"
seta hud_panel_weapons_bg_padding "0"
seta hud_panel_weapons_accuracy "0"
seta hud_panel_weapons_label "1"
-seta hud_panel_weapons_label_scale "0.300000"
+seta hud_panel_weapons_label_scale "0.3"
seta hud_panel_weapons_complainbubble "1"
seta hud_panel_weapons_complainbubble_padding "0"
seta hud_panel_weapons_complainbubble_time "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_noncurrent_alpha "0.800000"
-seta hud_panel_weapons_noncurrent_scale "0.900000"
+seta hud_panel_weapons_noncurrent_alpha "0.8"
+seta hud_panel_weapons_noncurrent_scale "0.9"
-seta hud_panel_ammo "1"
seta hud_panel_ammo_pos "0.315000 0.865000"
seta hud_panel_ammo_size "0.370000 0.060000"
seta hud_panel_ammo_bg "border_tab_south"
seta hud_panel_ammo_bg_border ""
seta hud_panel_ammo_bg_padding "4"
seta hud_panel_ammo_onlycurrent "0"
-seta hud_panel_ammo_noncurrent_alpha "0.600000"
-seta hud_panel_ammo_noncurrent_scale "0.400000"
+seta hud_panel_ammo_noncurrent_alpha "0.6"
+seta hud_panel_ammo_noncurrent_scale "0.4"
seta hud_panel_ammo_iconalign "0"
seta hud_panel_ammo_progressbar "0"
seta hud_panel_ammo_progressbar_name "progressbar"
seta hud_panel_ammo_progressbar_xoffset "0"
seta hud_panel_ammo_text "1"
-seta hud_panel_powerups "1"
seta hud_panel_powerups_pos "0.325000 0.815000"
seta hud_panel_powerups_size "0.350000 0.055000"
seta hud_panel_powerups_bg "border_shadow_south"
seta hud_panel_powerups_progressbar "1"
seta hud_panel_powerups_text "1"
-seta hud_panel_healtharmor "1"
seta hud_panel_healtharmor_pos "0.300000 0.925000"
seta hud_panel_healtharmor_size "0.400000 0.070000"
seta hud_panel_healtharmor_bg "border_default_south"
seta hud_panel_healtharmor_bg_alpha ""
seta hud_panel_healtharmor_bg_border "4"
seta hud_panel_healtharmor_bg_padding ""
+seta hud_panel_healtharmor_combined "0"
seta hud_panel_healtharmor_flip "0"
seta hud_panel_healtharmor_iconalign "3"
seta hud_panel_healtharmor_baralign "3"
seta hud_panel_healtharmor_progressbar_gfx_smooth "2"
seta hud_panel_healtharmor_text "1"
-seta hud_panel_notify "1"
seta hud_panel_notify_pos "0.730000 0.800000"
seta hud_panel_notify_size "0.265000 0.200000"
seta hud_panel_notify_bg "0"
seta hud_panel_notify_fadetime "3"
seta hud_panel_notify_icon_aspect "1"
-seta hud_panel_timer "1"
seta hud_panel_timer_pos "0.456000 0"
seta hud_panel_timer_size "0.088000 0.030000"
seta hud_panel_timer_bg "border_plain_north"
seta hud_panel_timer_bg_border ""
seta hud_panel_timer_bg_padding "0"
-seta hud_panel_radar "1"
seta hud_panel_radar_pos "0 0"
seta hud_panel_radar_size "0.200000 0.250000"
seta hud_panel_radar_bg "border_corner_northwest"
seta hud_panel_radar_maximized_rotation "1"
seta hud_panel_radar_maximized_zoommode "3"
-seta hud_panel_score "1"
seta hud_panel_score_pos "0.880000 0"
seta hud_panel_score_size "0.120000 0.080000"
seta hud_panel_score_bg "border_corner_northeast"
seta hud_panel_score_bg_padding "1"
seta hud_panel_score_rankings "1"
-seta hud_panel_racetimer "1"
seta hud_panel_racetimer_pos "0.360000 0.110000"
seta hud_panel_racetimer_size "0.280000 0.090000"
seta hud_panel_racetimer_bg "0"
seta hud_panel_racetimer_bg_border ""
seta hud_panel_racetimer_bg_padding ""
-seta hud_panel_vote "1"
seta hud_panel_vote_pos "0.740000 0.690000"
seta hud_panel_vote_size "0.190000 0.090000"
seta hud_panel_vote_bg " "
seta hud_panel_vote_bg_alpha ""
seta hud_panel_vote_bg_border ""
seta hud_panel_vote_bg_padding ""
-seta hud_panel_vote_alreadyvoted_alpha "0.700000"
+seta hud_panel_vote_alreadyvoted_alpha "0.7"
-seta hud_panel_modicons "1"
seta hud_panel_modicons_pos "0.370000 0.030000"
seta hud_panel_modicons_size "0.260000 0.07000"
seta hud_panel_modicons_bg "border_fading_north"
seta hud_panel_modicons_dom_layout "1"
seta hud_panel_modicons_freezetag_layout "1"
-seta hud_panel_pressedkeys "1"
seta hud_panel_pressedkeys_pos "0.445000 0.710000"
seta hud_panel_pressedkeys_size "0.110000 0.090000"
seta hud_panel_pressedkeys_bg " "
seta hud_panel_pressedkeys_bg_alpha ""
seta hud_panel_pressedkeys_bg_border ""
seta hud_panel_pressedkeys_bg_padding "1"
-seta hud_panel_pressedkeys_aspect "1.600000"
+seta hud_panel_pressedkeys_aspect "1.6"
seta hud_panel_pressedkeys_attack "0"
-seta hud_panel_chat "1"
seta hud_panel_chat_pos "0.010000 0.700000"
seta hud_panel_chat_size "0.460000 0.190000"
seta hud_panel_chat_bg "0"
seta hud_panel_chat_bg_border ""
seta hud_panel_chat_bg_padding ""
-seta hud_panel_engineinfo "0"
seta hud_panel_engineinfo_pos "0.930000 0.970000"
seta hud_panel_engineinfo_size "0.070000 0.030000"
seta hud_panel_engineinfo_bg "0"
seta hud_panel_engineinfo_framecounter_time "0.1"
seta hud_panel_engineinfo_framecounter_decimals "0"
-seta hud_panel_infomessages "1"
seta hud_panel_infomessages_pos "0.720000 0.100000"
seta hud_panel_infomessages_size "0.280000 0.080000"
seta hud_panel_infomessages_bg "0"
seta hud_panel_infomessages_bg_padding "0"
seta hud_panel_infomessages_flip "1"
-seta hud_panel_physics "3"
seta hud_panel_physics_pos "0.410000 0.625000"
seta hud_panel_physics_size "0.180000 0.080000"
seta hud_panel_physics_bg "0"
seta hud_panel_physics_bg_color ""
seta hud_panel_physics_bg_color_team ""
-seta hud_panel_physics_bg_alpha "0.700000"
+seta hud_panel_physics_bg_alpha "0.7"
seta hud_panel_physics_bg_border ""
seta hud_panel_physics_bg_padding ""
seta hud_panel_physics_speed_unit_show "1"
seta hud_panel_physics_text "1"
seta hud_panel_physics_text_scale "0.7"
-seta hud_panel_centerprint "1"
seta hud_panel_centerprint_pos "0.175000 0.220000"
seta hud_panel_centerprint_size "0.650000 0.220000"
seta hud_panel_centerprint_bg "0"
seta hud_panel_centerprint_fade_subsequent_minfontsize "0.75"
seta hud_panel_centerprint_fade_minfontsize "0"
-seta hud_panel_minigameboard "1"
seta hud_panel_minigameboard_pos "0.22 0.15"
seta hud_panel_minigameboard_size "0.50 0.60"
seta hud_panel_minigameboard_bg "border_small"
seta hud_panel_minigameboard_bg_border ""
seta hud_panel_minigameboard_bg_padding ""
-seta hud_panel_minigamestatus "1"
seta hud_panel_minigamestatus_pos "0.74 0.15"
seta hud_panel_minigamestatus_size "0.2 0.60"
seta hud_panel_minigamestatus_bg "border_small"
seta hud_panel_minigamestatus_bg_border ""
seta hud_panel_minigamestatus_bg_padding ""
-seta hud_panel_minigamehelp "1"
seta hud_panel_minigamehelp_pos "0.22 0.78"
seta hud_panel_minigamehelp_size "0.50 0.20"
seta hud_panel_minigamehelp_bg ""
seta hud_panel_minigamehelp_bg_border ""
seta hud_panel_minigamehelp_bg_padding ""
-seta hud_panel_minigamemenu "0"
seta hud_panel_minigamemenu_pos "0 0.26"
seta hud_panel_minigamemenu_size "0.2 0.49"
seta hud_panel_minigamemenu_bg "border_small"
seta hud_panel_minigamemenu_bg_border ""
seta hud_panel_minigamemenu_bg_padding ""
-seta hud_panel_mapvote "1"
seta hud_panel_mapvote_pos "0 0"
seta hud_panel_mapvote_size "1 1"
seta hud_panel_mapvote_bg "border_default"
seta hud_panel_mapvote_bg_border ""
seta hud_panel_mapvote_bg_padding ""
-seta hud_panel_itemstime "2"
seta hud_panel_itemstime_pos "0.030000 0.260000"
seta hud_panel_itemstime_size "0.070000 0.230000"
-seta hud_panel_itemstime_bg "border_itemstime"
+seta hud_panel_itemstime_bg "border_default"
seta hud_panel_itemstime_bg_color ""
seta hud_panel_itemstime_bg_color_team ""
seta hud_panel_itemstime_bg_alpha ""
seta hud_panel_itemstime_ratio "2"
seta hud_panel_itemstime_dynamicsize "1"
-seta hud_panel_quickmenu "1"
seta hud_panel_quickmenu_pos "0.600000 0.445000"
seta hud_panel_quickmenu_size "0.220000 0.240000"
seta hud_panel_quickmenu_bg ""
seta hud_dock_color_team "1"
seta hud_dock_alpha "1"
-seta hud_progressbar_alpha "0.500000"
+seta hud_progressbar_alpha "0.5"
seta hud_progressbar_strength_color "0 0 0.6"
seta hud_progressbar_superweapons_color "0.6 0.3 0"
seta hud_progressbar_shield_color "0.6 0 0.6"
seta hud_configure_grid_xsize "0.010000"
seta hud_configure_grid_ysize "0.010000"
-seta hud_panel_weapons "1"
seta hud_panel_weapons_pos "0.930000 0.170000"
seta hud_panel_weapons_size "0.070000 0.650000"
seta hud_panel_weapons_bg "border_small_weapons"
seta hud_panel_weapons_bg_padding "4"
seta hud_panel_weapons_accuracy "1"
seta hud_panel_weapons_label "1"
-seta hud_panel_weapons_label_scale "0.500000"
+seta hud_panel_weapons_label_scale "0.5"
seta hud_panel_weapons_complainbubble "1"
seta hud_panel_weapons_complainbubble_padding "-1"
seta hud_panel_weapons_complainbubble_time "0"
seta hud_panel_weapons_noncurrent_alpha "1"
seta hud_panel_weapons_noncurrent_scale "1"
-seta hud_panel_ammo "1"
seta hud_panel_ammo_pos "0.330000 0.960000"
seta hud_panel_ammo_size "0.350000 0.040000"
seta hud_panel_ammo_bg ""
seta hud_panel_ammo_bg_border ""
seta hud_panel_ammo_bg_padding ""
seta hud_panel_ammo_onlycurrent "0"
-seta hud_panel_ammo_noncurrent_alpha "0.700000"
+seta hud_panel_ammo_noncurrent_alpha "0.7"
seta hud_panel_ammo_noncurrent_scale "1"
seta hud_panel_ammo_iconalign "0"
seta hud_panel_ammo_progressbar "0"
seta hud_panel_ammo_progressbar_xoffset "0"
seta hud_panel_ammo_text "1"
-seta hud_panel_powerups "1"
seta hud_panel_powerups_pos "0.360000 0.850000"
seta hud_panel_powerups_size "0.290000 0.030000"
seta hud_panel_powerups_bg "border_small_powerups"
seta hud_panel_powerups_progressbar "1"
seta hud_panel_powerups_text "1"
-seta hud_panel_healtharmor "1"
seta hud_panel_healtharmor_pos "0.320000 0.910000"
seta hud_panel_healtharmor_size "0.370000 0.060000"
seta hud_panel_healtharmor_bg "border_small_healtharmor"
seta hud_panel_healtharmor_bg_alpha ""
seta hud_panel_healtharmor_bg_border ""
seta hud_panel_healtharmor_bg_padding ""
+seta hud_panel_healtharmor_combined "0"
seta hud_panel_healtharmor_flip "0"
seta hud_panel_healtharmor_iconalign "3"
seta hud_panel_healtharmor_baralign "3"
seta hud_panel_healtharmor_progressbar_gfx_smooth "2"
seta hud_panel_healtharmor_text "1"
-seta hud_panel_notify "1"
seta hud_panel_notify_pos "0.710000 0.800000"
seta hud_panel_notify_size "0.290000 0.190000"
seta hud_panel_notify_bg "0"
seta hud_panel_notify_fadetime "3"
seta hud_panel_notify_icon_aspect "2"
-seta hud_panel_timer "1"
seta hud_panel_timer_pos "0.800000 0.040000"
seta hud_panel_timer_size "0.070000 0.040000"
seta hud_panel_timer_bg "border_small_timer"
seta hud_panel_timer_bg_border ""
seta hud_panel_timer_bg_padding "0"
-seta hud_panel_radar "2"
seta hud_panel_radar_pos "0 0"
seta hud_panel_radar_size "0.200000 0.240000"
seta hud_panel_radar_bg "border_small_radar"
seta hud_panel_radar_bg_color ""
seta hud_panel_radar_bg_color_team ""
-seta hud_panel_radar_bg_alpha "0.800000"
+seta hud_panel_radar_bg_alpha "0.8"
seta hud_panel_radar_bg_border ""
seta hud_panel_radar_bg_padding "-1"
-seta hud_panel_radar_foreground_alpha "0.800000"
+seta hud_panel_radar_foreground_alpha "0.8"
seta hud_panel_radar_rotation "0"
seta hud_panel_radar_zoommode "0"
seta hud_panel_radar_scale "4096"
seta hud_panel_radar_maximized_rotation "1"
seta hud_panel_radar_maximized_zoommode "3"
-seta hud_panel_score "1"
seta hud_panel_score_pos "0.890000 0.030000"
seta hud_panel_score_size "0.100000 0.050000"
seta hud_panel_score_bg "border_small_score"
seta hud_panel_score_bg_padding "0"
seta hud_panel_score_rankings "1"
-seta hud_panel_racetimer "1"
seta hud_panel_racetimer_pos "0.360000 0.110000"
seta hud_panel_racetimer_size "0.280000 0.090000"
seta hud_panel_racetimer_bg "0"
seta hud_panel_racetimer_bg_border ""
seta hud_panel_racetimer_bg_padding ""
-seta hud_panel_vote "1"
seta hud_panel_vote_pos "0.720000 0.670000"
seta hud_panel_vote_size "0.190000 0.090000"
-seta hud_panel_vote_bg "border_vote"
+seta hud_panel_vote_bg "border_default"
seta hud_panel_vote_bg_color ""
seta hud_panel_vote_bg_color_team ""
seta hud_panel_vote_bg_alpha ""
seta hud_panel_vote_bg_border ""
seta hud_panel_vote_bg_padding ""
-seta hud_panel_vote_alreadyvoted_alpha "0.500000"
+seta hud_panel_vote_alreadyvoted_alpha "0.5"
-seta hud_panel_modicons "1"
seta hud_panel_modicons_pos "0.410000 0"
seta hud_panel_modicons_size "0.180000 0.080000"
seta hud_panel_modicons_bg "border_small_modicons"
seta hud_panel_modicons_dom_layout "1"
seta hud_panel_modicons_freezetag_layout "1"
-seta hud_panel_pressedkeys "1"
seta hud_panel_pressedkeys_pos "0.450000 0.720000"
seta hud_panel_pressedkeys_size "0.110000 0.090000"
seta hud_panel_pressedkeys_bg "0"
seta hud_panel_pressedkeys_bg_alpha ""
seta hud_panel_pressedkeys_bg_border ""
seta hud_panel_pressedkeys_bg_padding ""
-seta hud_panel_pressedkeys_aspect "1.600000"
+seta hud_panel_pressedkeys_aspect "1.6"
seta hud_panel_pressedkeys_attack "0"
-seta hud_panel_chat "1"
seta hud_panel_chat_pos "0.010000 0.700000"
seta hud_panel_chat_size "0.460000 0.190000"
seta hud_panel_chat_bg "0"
seta hud_panel_chat_bg_border ""
seta hud_panel_chat_bg_padding ""
-seta hud_panel_engineinfo "0"
seta hud_panel_engineinfo_pos "0.930000 0.970000"
seta hud_panel_engineinfo_size "0.070000 0.030000"
seta hud_panel_engineinfo_bg "0"
seta hud_panel_engineinfo_framecounter_time "0.1"
seta hud_panel_engineinfo_framecounter_decimals "0"
-seta hud_panel_infomessages "1"
seta hud_panel_infomessages_pos "0.720000 0.100000"
seta hud_panel_infomessages_size "0.280000 0.080000"
seta hud_panel_infomessages_bg "0"
seta hud_panel_infomessages_bg_padding "0"
seta hud_panel_infomessages_flip "1"
-seta hud_panel_physics "3"
seta hud_panel_physics_pos "0.420000 0.620000"
seta hud_panel_physics_size "0.170000 0.080000"
seta hud_panel_physics_bg ""
seta hud_panel_physics_text "1"
seta hud_panel_physics_text_scale "0.7"
-seta hud_panel_centerprint "1"
seta hud_panel_centerprint_pos "0.175000 0.220000"
seta hud_panel_centerprint_size "0.650000 0.220000"
seta hud_panel_centerprint_bg "0"
seta hud_panel_centerprint_fade_subsequent_minfontsize "0.75"
seta hud_panel_centerprint_fade_minfontsize "0"
-seta hud_panel_minigameboard "1"
seta hud_panel_minigameboard_pos "0.22 0.15"
seta hud_panel_minigameboard_size "0.50 0.60"
seta hud_panel_minigameboard_bg "border_small"
seta hud_panel_minigameboard_bg_border ""
seta hud_panel_minigameboard_bg_padding ""
-seta hud_panel_minigamestatus "1"
seta hud_panel_minigamestatus_pos "0.74 0.15"
seta hud_panel_minigamestatus_size "0.2 0.60"
seta hud_panel_minigamestatus_bg "border_small"
seta hud_panel_minigamestatus_bg_border ""
seta hud_panel_minigamestatus_bg_padding ""
-seta hud_panel_minigamehelp "1"
seta hud_panel_minigamehelp_pos "0.22 0.78"
seta hud_panel_minigamehelp_size "0.50 0.20"
seta hud_panel_minigamehelp_bg ""
seta hud_panel_minigamehelp_bg_border ""
seta hud_panel_minigamehelp_bg_padding ""
-seta hud_panel_minigamemenu "0"
seta hud_panel_minigamemenu_pos "0 0.26"
seta hud_panel_minigamemenu_size "0.2 0.49"
seta hud_panel_minigamemenu_bg "border_small"
seta hud_panel_minigamemenu_bg_border ""
seta hud_panel_minigamemenu_bg_padding ""
-seta hud_panel_mapvote "1"
seta hud_panel_mapvote_pos "0 0"
seta hud_panel_mapvote_size "1 1"
seta hud_panel_mapvote_bg "0"
seta hud_panel_mapvote_bg_border ""
seta hud_panel_mapvote_bg_padding ""
-seta hud_panel_itemstime "2"
seta hud_panel_itemstime_pos "0.030000 0.260000"
seta hud_panel_itemstime_size "0.070000 0.230000"
-seta hud_panel_itemstime_bg "border_itemstime"
+seta hud_panel_itemstime_bg "border_default"
seta hud_panel_itemstime_bg_color ""
seta hud_panel_itemstime_bg_color_team ""
seta hud_panel_itemstime_bg_alpha ""
seta hud_panel_itemstime_ratio "2"
seta hud_panel_itemstime_dynamicsize "1"
-seta hud_panel_quickmenu "1"
seta hud_panel_quickmenu_pos "0.610000 0.450000"
seta hud_panel_quickmenu_size "0.200000 0.210000"
seta hud_panel_quickmenu_bg ""
seta hud_dock "0"
seta hud_dock_color "0 0.449576 0.860796"
-seta hud_dock_color_team "0.700000"
+seta hud_dock_color_team "0.7"
seta hud_dock_alpha "1"
-seta hud_progressbar_alpha "0.500000"
+seta hud_progressbar_alpha "0.5"
seta hud_progressbar_strength_color "0 0 0.6"
seta hud_progressbar_superweapons_color "0.6 0.3 0"
seta hud_progressbar_shield_color "0.6 0 0.6"
seta hud_configure_grid_xsize "0.010000"
seta hud_configure_grid_ysize "0.010000"
-seta hud_panel_weapons "1"
seta hud_panel_weapons_pos "0.350000 0.940000"
seta hud_panel_weapons_size "0.300000 0.060000"
seta hud_panel_weapons_bg ""
seta hud_panel_weapons_noncurrent_alpha "1"
seta hud_panel_weapons_noncurrent_scale "1"
-seta hud_panel_ammo "1"
seta hud_panel_ammo_pos "0.650000 0.890000"
seta hud_panel_ammo_size "0.055000 0.110000"
seta hud_panel_ammo_bg ""
seta hud_panel_ammo_progressbar_xoffset "0"
seta hud_panel_ammo_text "1"
-seta hud_panel_powerups "1"
seta hud_panel_powerups_pos "0.290000 0.890000"
seta hud_panel_powerups_size "0.055000 0.110000"
seta hud_panel_powerups_bg "0"
seta hud_panel_powerups_progressbar "1"
seta hud_panel_powerups_text "1"
-seta hud_panel_healtharmor "1"
seta hud_panel_healtharmor_pos "0.350000 0.890000"
seta hud_panel_healtharmor_size "0.300000 0.050000"
seta hud_panel_healtharmor_bg ""
seta hud_panel_healtharmor_bg_alpha ""
seta hud_panel_healtharmor_bg_border ""
seta hud_panel_healtharmor_bg_padding "0"
+seta hud_panel_healtharmor_combined "0"
seta hud_panel_healtharmor_flip "0"
seta hud_panel_healtharmor_iconalign "3"
seta hud_panel_healtharmor_baralign "3"
seta hud_panel_healtharmor_progressbar_gfx_smooth "2"
seta hud_panel_healtharmor_text "1"
-seta hud_panel_notify "1"
seta hud_panel_notify_pos "0 0"
seta hud_panel_notify_size "0.210000 0.260000"
seta hud_panel_notify_bg "0"
seta hud_panel_notify_fadetime "3"
seta hud_panel_notify_icon_aspect "2"
-seta hud_panel_timer "1"
seta hud_panel_timer_pos "0.435000 0"
seta hud_panel_timer_size "0.135000 0.060000"
seta hud_panel_timer_bg "0"
seta hud_panel_timer_bg_border ""
seta hud_panel_timer_bg_padding "0"
-seta hud_panel_radar "2"
seta hud_panel_radar_pos "0.810000 0"
seta hud_panel_radar_size "0.190000 0.250000"
-seta hud_panel_radar_bg "border_radar"
+seta hud_panel_radar_bg "border_default"
seta hud_panel_radar_bg_color ""
seta hud_panel_radar_bg_color_team ""
-seta hud_panel_radar_bg_alpha "0.500000"
+seta hud_panel_radar_bg_alpha "0.5"
seta hud_panel_radar_bg_border "0"
seta hud_panel_radar_bg_padding "0"
-seta hud_panel_radar_foreground_alpha "0.500000"
+seta hud_panel_radar_foreground_alpha "0.5"
seta hud_panel_radar_rotation "0"
seta hud_panel_radar_zoommode "0"
seta hud_panel_radar_scale "4096"
seta hud_panel_radar_maximized_rotation "1"
seta hud_panel_radar_maximized_zoommode "3"
-seta hud_panel_score "1"
seta hud_panel_score_pos "0.465000 0.045000"
seta hud_panel_score_size "0.090000 0.060000"
seta hud_panel_score_bg ""
seta hud_panel_score_bg_padding ""
seta hud_panel_score_rankings "1"
-seta hud_panel_racetimer "1"
seta hud_panel_racetimer_pos "0.360000 0.090000"
seta hud_panel_racetimer_size "0.280000 0.090000"
seta hud_panel_racetimer_bg "0"
seta hud_panel_racetimer_bg_border ""
seta hud_panel_racetimer_bg_padding ""
-seta hud_panel_vote "1"
seta hud_panel_vote_pos "0 0.890000"
seta hud_panel_vote_size "0.170000 0.110000"
seta hud_panel_vote_bg ""
seta hud_panel_vote_bg_alpha ""
seta hud_panel_vote_bg_border ""
seta hud_panel_vote_bg_padding ""
-seta hud_panel_vote_alreadyvoted_alpha "0.800000"
+seta hud_panel_vote_alreadyvoted_alpha "0.8"
-seta hud_panel_modicons "1"
seta hud_panel_modicons_pos "0.560000 0"
seta hud_panel_modicons_size "0.050000 0.100000"
seta hud_panel_modicons_bg ""
seta hud_panel_modicons_dom_layout "1"
seta hud_panel_modicons_freezetag_layout "1"
-seta hud_panel_pressedkeys "1"
seta hud_panel_pressedkeys_pos "0.450000 0.650000"
seta hud_panel_pressedkeys_size "0.100000 0.110000"
seta hud_panel_pressedkeys_bg "0"
seta hud_panel_pressedkeys_bg_alpha ""
seta hud_panel_pressedkeys_bg_border ""
seta hud_panel_pressedkeys_bg_padding ""
-seta hud_panel_pressedkeys_aspect "1.600000"
+seta hud_panel_pressedkeys_aspect "1.6"
seta hud_panel_pressedkeys_attack "0"
-seta hud_panel_chat "1"
seta hud_panel_chat_pos "0 0.775000"
seta hud_panel_chat_size "0.460000 0.110000"
seta hud_panel_chat_bg "0"
seta hud_panel_chat_bg_border ""
seta hud_panel_chat_bg_padding ""
-seta hud_panel_engineinfo "0"
seta hud_panel_engineinfo_pos "0.910000 0.970000"
seta hud_panel_engineinfo_size "0.090000 0.030000"
seta hud_panel_engineinfo_bg "0"
seta hud_panel_engineinfo_framecounter_time "0.1"
seta hud_panel_engineinfo_framecounter_decimals "0"
-seta hud_panel_infomessages "1"
seta hud_panel_infomessages_pos "0.710000 0"
seta hud_panel_infomessages_size "0.290000 0.100000"
seta hud_panel_infomessages_bg "0"
seta hud_panel_infomessages_bg_padding "0"
seta hud_panel_infomessages_flip "1"
-seta hud_panel_physics "3"
seta hud_panel_physics_pos "0.440000 0.590000"
seta hud_panel_physics_size "0.120000 0.050000"
seta hud_panel_physics_bg ""
seta hud_panel_physics_text "1"
seta hud_panel_physics_text_scale "0.7"
-seta hud_panel_centerprint "1"
seta hud_panel_centerprint_pos "0.175000 0.220000"
seta hud_panel_centerprint_size "0.650000 0.220000"
seta hud_panel_centerprint_bg "0"
seta hud_panel_centerprint_fade_subsequent_minfontsize "0.75"
seta hud_panel_centerprint_fade_minfontsize "0"
-seta hud_panel_minigameboard "1"
seta hud_panel_minigameboard_pos "0.22 0.15"
seta hud_panel_minigameboard_size "0.50 0.60"
seta hud_panel_minigameboard_bg "border_small"
seta hud_panel_minigameboard_bg_border ""
seta hud_panel_minigameboard_bg_padding ""
-seta hud_panel_minigamestatus "1"
seta hud_panel_minigamestatus_pos "0.74 0.15"
seta hud_panel_minigamestatus_size "0.2 0.60"
seta hud_panel_minigamestatus_bg "border_small"
seta hud_panel_minigamestatus_bg_border ""
seta hud_panel_minigamestatus_bg_padding ""
-seta hud_panel_minigamehelp "1"
seta hud_panel_minigamehelp_pos "0.22 0.78"
seta hud_panel_minigamehelp_size "0.50 0.20"
seta hud_panel_minigamehelp_bg ""
seta hud_panel_minigamehelp_bg_border ""
seta hud_panel_minigamehelp_bg_padding ""
-seta hud_panel_minigamemenu "0"
seta hud_panel_minigamemenu_pos "0 0.26"
seta hud_panel_minigamemenu_size "0.2 0.49"
seta hud_panel_minigamemenu_bg "border_small"
seta hud_panel_minigamemenu_bg_border ""
seta hud_panel_minigamemenu_bg_padding ""
-seta hud_panel_mapvote "1"
seta hud_panel_mapvote_pos "0 0"
seta hud_panel_mapvote_size "1 1"
seta hud_panel_mapvote_bg "0"
seta hud_panel_mapvote_bg_border ""
seta hud_panel_mapvote_bg_padding ""
-seta hud_panel_itemstime "2"
seta hud_panel_itemstime_pos "0.000000 0.310000"
seta hud_panel_itemstime_size "0.070000 0.180000"
seta hud_panel_itemstime_bg ""
seta hud_panel_itemstime_ratio "2"
seta hud_panel_itemstime_dynamicsize "1"
-seta hud_panel_quickmenu "1"
seta hud_panel_quickmenu_pos "0.600000 0.460000"
seta hud_panel_quickmenu_size "0.190000 0.190000"
seta hud_panel_quickmenu_bg ""
seta hud_dock "0"
seta hud_dock_color "0 0.449576 0.860796"
-seta hud_dock_color_team "0.700000"
+seta hud_dock_color_team "0.7"
seta hud_dock_alpha "1"
seta hud_progressbar_alpha "0.3"
seta hud_configure_grid_xsize "0.010000"
seta hud_configure_grid_ysize "0.010000"
-seta hud_panel_weapons "1"
seta hud_panel_weapons_pos "0.350000 0.940000"
seta hud_panel_weapons_size "0.300000 0.060000"
seta hud_panel_weapons_bg ""
seta hud_panel_weapons_noncurrent_alpha "1"
seta hud_panel_weapons_noncurrent_scale "1"
-seta hud_panel_ammo "1"
seta hud_panel_ammo_pos "0.450000 0.630000"
seta hud_panel_ammo_size "0.080000 0.040000"
seta hud_panel_ammo_bg ""
seta hud_panel_ammo_progressbar_xoffset "0.32"
seta hud_panel_ammo_text "1"
-seta hud_panel_powerups "1"
seta hud_panel_powerups_pos "0.270000 0.940000"
seta hud_panel_powerups_size "0.080000 0.060000"
seta hud_panel_powerups_bg "0"
seta hud_panel_powerups_progressbar "1"
seta hud_panel_powerups_text "1"
-seta hud_panel_healtharmor "1"
seta hud_panel_healtharmor_pos "0.350000 0.380000"
seta hud_panel_healtharmor_size "0.070000 0.240000"
seta hud_panel_healtharmor_bg "border_healtharmor"
seta hud_panel_healtharmor_bg_color "0.464391 0.464391 0.464391"
seta hud_panel_healtharmor_bg_color_team ""
-seta hud_panel_healtharmor_bg_alpha "0.600000"
+seta hud_panel_healtharmor_bg_alpha "0.6"
seta hud_panel_healtharmor_bg_border "-1"
seta hud_panel_healtharmor_bg_padding "0"
+seta hud_panel_healtharmor_combined "0"
seta hud_panel_healtharmor_flip "0"
seta hud_panel_healtharmor_iconalign "1"
seta hud_panel_healtharmor_baralign "1"
seta hud_panel_healtharmor_progressbar_gfx_smooth "2"
seta hud_panel_healtharmor_text "0"
-seta hud_panel_notify "1"
seta hud_panel_notify_pos "0 0"
seta hud_panel_notify_size "0.210000 0.260000"
seta hud_panel_notify_bg "0"
seta hud_panel_notify_fadetime "3"
seta hud_panel_notify_icon_aspect "2"
-seta hud_panel_timer "1"
seta hud_panel_timer_pos "0.435000 0"
seta hud_panel_timer_size "0.135000 0.060000"
seta hud_panel_timer_bg "0"
seta hud_panel_timer_bg_border ""
seta hud_panel_timer_bg_padding "0"
-seta hud_panel_radar "2"
seta hud_panel_radar_pos "0.810000 0"
seta hud_panel_radar_size "0.190000 0.250000"
-seta hud_panel_radar_bg "border_radar"
+seta hud_panel_radar_bg "border_default"
seta hud_panel_radar_bg_color ""
seta hud_panel_radar_bg_color_team ""
-seta hud_panel_radar_bg_alpha "0.500000"
+seta hud_panel_radar_bg_alpha "0.5"
seta hud_panel_radar_bg_border "0"
seta hud_panel_radar_bg_padding "0"
-seta hud_panel_radar_foreground_alpha "0.500000"
+seta hud_panel_radar_foreground_alpha "0.5"
seta hud_panel_radar_rotation "0"
seta hud_panel_radar_zoommode "0"
seta hud_panel_radar_scale "4096"
seta hud_panel_radar_maximized_rotation "1"
seta hud_panel_radar_maximized_zoommode "3"
-seta hud_panel_score "1"
seta hud_panel_score_pos "0.465000 0.045000"
seta hud_panel_score_size "0.090000 0.060000"
seta hud_panel_score_bg ""
seta hud_panel_score_bg_padding ""
seta hud_panel_score_rankings "1"
-seta hud_panel_racetimer "1"
seta hud_panel_racetimer_pos "0.360000 0.090000"
seta hud_panel_racetimer_size "0.280000 0.090000"
seta hud_panel_racetimer_bg "0"
seta hud_panel_racetimer_bg_border ""
seta hud_panel_racetimer_bg_padding ""
-seta hud_panel_vote "1"
seta hud_panel_vote_pos "0 0.890000"
seta hud_panel_vote_size "0.170000 0.110000"
seta hud_panel_vote_bg ""
seta hud_panel_vote_bg_alpha ""
seta hud_panel_vote_bg_border ""
seta hud_panel_vote_bg_padding ""
-seta hud_panel_vote_alreadyvoted_alpha "0.800000"
+seta hud_panel_vote_alreadyvoted_alpha "0.8"
-seta hud_panel_modicons "1"
seta hud_panel_modicons_pos "0.560000 0"
seta hud_panel_modicons_size "0.050000 0.100000"
seta hud_panel_modicons_bg ""
seta hud_panel_modicons_dom_layout "1"
seta hud_panel_modicons_freezetag_layout "1"
-seta hud_panel_pressedkeys "1"
seta hud_panel_pressedkeys_pos "0.450000 0.690000"
seta hud_panel_pressedkeys_size "0.100000 0.110000"
seta hud_panel_pressedkeys_bg "0"
seta hud_panel_pressedkeys_bg_alpha ""
seta hud_panel_pressedkeys_bg_border ""
seta hud_panel_pressedkeys_bg_padding ""
-seta hud_panel_pressedkeys_aspect "1.600000"
+seta hud_panel_pressedkeys_aspect "1.6"
seta hud_panel_pressedkeys_attack "0"
-seta hud_panel_chat "1"
seta hud_panel_chat_pos "0 0.775000"
seta hud_panel_chat_size "0.460000 0.110000"
seta hud_panel_chat_bg "0"
seta hud_panel_chat_bg_border ""
seta hud_panel_chat_bg_padding ""
-seta hud_panel_engineinfo "0"
seta hud_panel_engineinfo_pos "0.910000 0.970000"
seta hud_panel_engineinfo_size "0.090000 0.030000"
seta hud_panel_engineinfo_bg "0"
seta hud_panel_engineinfo_framecounter_time "0.1"
seta hud_panel_engineinfo_framecounter_decimals "0"
-seta hud_panel_infomessages "1"
seta hud_panel_infomessages_pos "0.710000 0"
seta hud_panel_infomessages_size "0.290000 0.100000"
seta hud_panel_infomessages_bg "0"
seta hud_panel_infomessages_bg_padding "0"
seta hud_panel_infomessages_flip "1"
-seta hud_panel_physics "3"
seta hud_panel_physics_pos "0.270000 0.730000"
seta hud_panel_physics_size "0.170000 0.030000"
seta hud_panel_physics_bg ""
seta hud_panel_physics_text "1"
seta hud_panel_physics_text_scale "0.7"
-seta hud_panel_centerprint "1"
seta hud_panel_centerprint_pos "0.175000 0.220000"
seta hud_panel_centerprint_size "0.650000 0.220000"
seta hud_panel_centerprint_bg "0"
seta hud_panel_centerprint_fade_subsequent_minfontsize "0.75"
seta hud_panel_centerprint_fade_minfontsize "0"
-seta hud_panel_minigameboard "1"
seta hud_panel_minigameboard_pos "0.22 0.15"
seta hud_panel_minigameboard_size "0.50 0.60"
seta hud_panel_minigameboard_bg "border_small"
seta hud_panel_minigameboard_bg_border ""
seta hud_panel_minigameboard_bg_padding ""
-seta hud_panel_minigamestatus "1"
seta hud_panel_minigamestatus_pos "0.74 0.15"
seta hud_panel_minigamestatus_size "0.2 0.60"
seta hud_panel_minigamestatus_bg "border_small"
seta hud_panel_minigamestatus_bg_border ""
seta hud_panel_minigamestatus_bg_padding ""
-seta hud_panel_minigamehelp "1"
seta hud_panel_minigamehelp_pos "0.22 0.78"
seta hud_panel_minigamehelp_size "0.50 0.20"
seta hud_panel_minigamehelp_bg ""
seta hud_panel_minigamehelp_bg_border ""
seta hud_panel_minigamehelp_bg_padding ""
-seta hud_panel_minigamemenu "0"
seta hud_panel_minigamemenu_pos "0 0.26"
seta hud_panel_minigamemenu_size "0.2 0.49"
seta hud_panel_minigamemenu_bg "border_small"
seta hud_panel_minigamemenu_bg_border ""
seta hud_panel_minigamemenu_bg_padding ""
-seta hud_panel_mapvote "1"
seta hud_panel_mapvote_pos "0 0"
seta hud_panel_mapvote_size "1 1"
seta hud_panel_mapvote_bg "0"
seta hud_panel_mapvote_bg_border ""
seta hud_panel_mapvote_bg_padding ""
-seta hud_panel_itemstime "2"
seta hud_panel_itemstime_pos "0.000000 0.310000"
seta hud_panel_itemstime_size "0.070000 0.180000"
seta hud_panel_itemstime_bg ""
seta hud_panel_itemstime_ratio "2"
seta hud_panel_itemstime_dynamicsize "1"
-seta hud_panel_quickmenu "1"
seta hud_panel_quickmenu_pos "0.600000 0.460000"
seta hud_panel_quickmenu_size "0.190000 0.190000"
seta hud_panel_quickmenu_bg ""
seta hud_dock "dock"
seta hud_dock_color "0 0.1875 0.40625"
-seta hud_dock_color_team "0.700000"
+seta hud_dock_color_team "0.7"
seta hud_dock_alpha "1"
-seta hud_progressbar_alpha "0.500000"
+seta hud_progressbar_alpha "0.5"
seta hud_progressbar_strength_color "0 0 0.6"
seta hud_progressbar_superweapons_color "0.6 0.3 0"
seta hud_progressbar_shield_color "0.6 0 0.6"
seta hud_configure_grid_xsize "0.010000"
seta hud_configure_grid_ysize "0.010000"
-seta hud_panel_weapons "1"
seta hud_panel_weapons_pos "0.920000 0.090000"
seta hud_panel_weapons_size "0.060000 0.630000"
seta hud_panel_weapons_bg ""
seta hud_panel_weapons_noncurrent_alpha "1"
seta hud_panel_weapons_noncurrent_scale "1"
-seta hud_panel_ammo "1"
seta hud_panel_ammo_pos "0.190000 0.920000"
seta hud_panel_ammo_size "0.120000 0.070000"
seta hud_panel_ammo_bg ""
seta hud_panel_ammo_progressbar_xoffset "0"
seta hud_panel_ammo_text "1"
-seta hud_panel_powerups "1"
seta hud_panel_powerups_pos "0.660000 0.940000"
seta hud_panel_powerups_size "0.330000 0.060000"
seta hud_panel_powerups_bg "0"
seta hud_panel_powerups_progressbar "1"
seta hud_panel_powerups_text "1"
-seta hud_panel_healtharmor "1"
seta hud_panel_healtharmor_pos "0.330000 0.920000"
seta hud_panel_healtharmor_size "0.310000 0.070000"
seta hud_panel_healtharmor_bg ""
seta hud_panel_healtharmor_bg_alpha ""
seta hud_panel_healtharmor_bg_border ""
seta hud_panel_healtharmor_bg_padding ""
+seta hud_panel_healtharmor_combined "0"
seta hud_panel_healtharmor_flip "0"
seta hud_panel_healtharmor_iconalign "3"
seta hud_panel_healtharmor_baralign "3"
seta hud_panel_healtharmor_progressbar_gfx_smooth "2"
seta hud_panel_healtharmor_text "1"
-seta hud_panel_notify "1"
seta hud_panel_notify_pos "0.660000 0.730000"
seta hud_panel_notify_size "0.320000 0.190000"
seta hud_panel_notify_bg "0"
seta hud_panel_notify_fadetime "3"
seta hud_panel_notify_icon_aspect "2"
-seta hud_panel_timer "1"
seta hud_panel_timer_pos "0.870000 0"
seta hud_panel_timer_size "0.130000 0.060000"
seta hud_panel_timer_bg "0"
seta hud_panel_timer_bg_border ""
seta hud_panel_timer_bg_padding "0"
-seta hud_panel_radar "2"
seta hud_panel_radar_pos "0.030000 0.020000"
seta hud_panel_radar_size "0.170000 0.220000"
seta hud_panel_radar_bg ""
seta hud_panel_radar_bg_alpha ""
seta hud_panel_radar_bg_border ""
seta hud_panel_radar_bg_padding "-3"
-seta hud_panel_radar_foreground_alpha "0.800000"
+seta hud_panel_radar_foreground_alpha "0.8"
seta hud_panel_radar_rotation "0"
seta hud_panel_radar_zoommode "0"
seta hud_panel_radar_scale "4096"
seta hud_panel_radar_maximized_rotation "1"
seta hud_panel_radar_maximized_zoommode "3"
-seta hud_panel_score "1"
seta hud_panel_score_pos "0.020000 0.920000"
seta hud_panel_score_size "0.150000 0.070000"
seta hud_panel_score_bg ""
seta hud_panel_score_bg_padding ""
seta hud_panel_score_rankings "1"
-seta hud_panel_racetimer "1"
seta hud_panel_racetimer_pos "0.360000 0.090000"
seta hud_panel_racetimer_size "0.280000 0.090000"
seta hud_panel_racetimer_bg "0"
seta hud_panel_racetimer_bg_border ""
seta hud_panel_racetimer_bg_padding ""
-seta hud_panel_vote "1"
seta hud_panel_vote_pos "0.020000 0.650000"
seta hud_panel_vote_size "0.230000 0.110000"
seta hud_panel_vote_bg ""
seta hud_panel_vote_bg_alpha ""
seta hud_panel_vote_bg_border ""
seta hud_panel_vote_bg_padding ""
-seta hud_panel_vote_alreadyvoted_alpha "0.800000"
+seta hud_panel_vote_alreadyvoted_alpha "0.8"
-seta hud_panel_modicons "1"
seta hud_panel_modicons_pos "0.040000 0.270000"
seta hud_panel_modicons_size "0.080000 0.200000"
seta hud_panel_modicons_bg ""
seta hud_panel_modicons_dom_layout "1"
seta hud_panel_modicons_freezetag_layout "1"
-seta hud_panel_pressedkeys "1"
seta hud_panel_pressedkeys_pos "0.410000 0.710000"
seta hud_panel_pressedkeys_size "0.180000 0.130000"
seta hud_panel_pressedkeys_bg "0"
seta hud_panel_pressedkeys_bg_alpha ""
seta hud_panel_pressedkeys_bg_border ""
seta hud_panel_pressedkeys_bg_padding ""
-seta hud_panel_pressedkeys_aspect "1.600000"
+seta hud_panel_pressedkeys_aspect "1.6"
seta hud_panel_pressedkeys_attack "0"
-seta hud_panel_chat "1"
seta hud_panel_chat_pos "0.020000 0.780000"
seta hud_panel_chat_size "0.630000 0.110000"
seta hud_panel_chat_bg "0"
seta hud_panel_chat_bg_border ""
seta hud_panel_chat_bg_padding ""
-seta hud_panel_engineinfo "0"
seta hud_panel_engineinfo_pos "0.910000 0.970000"
seta hud_panel_engineinfo_size "0.090000 0.030000"
seta hud_panel_engineinfo_bg "0"
seta hud_panel_engineinfo_framecounter_time "0.1"
seta hud_panel_engineinfo_framecounter_decimals "0"
-seta hud_panel_infomessages "1"
seta hud_panel_infomessages_pos "0.510000 0"
seta hud_panel_infomessages_size "0.340000 0.090000"
seta hud_panel_infomessages_bg "0"
seta hud_panel_infomessages_bg_padding "0"
seta hud_panel_infomessages_flip "1"
-seta hud_panel_physics "3"
seta hud_panel_physics_pos "0.410000 0.590000"
seta hud_panel_physics_size "0.180000 0.100000"
seta hud_panel_physics_bg ""
seta hud_panel_physics_text "1"
seta hud_panel_physics_text_scale "0.7"
-seta hud_panel_centerprint "1"
seta hud_panel_centerprint_pos "0.175000 0.220000"
seta hud_panel_centerprint_size "0.650000 0.220000"
seta hud_panel_centerprint_bg "0"
seta hud_panel_centerprint_fade_subsequent_minfontsize "0.75"
seta hud_panel_centerprint_fade_minfontsize "0"
-seta hud_panel_minigameboard "1"
seta hud_panel_minigameboard_pos "0.22 0.15"
seta hud_panel_minigameboard_size "0.50 0.60"
seta hud_panel_minigameboard_bg "border_small"
seta hud_panel_minigameboard_bg_border ""
seta hud_panel_minigameboard_bg_padding ""
-seta hud_panel_minigamestatus "1"
seta hud_panel_minigamestatus_pos "0.74 0.15"
seta hud_panel_minigamestatus_size "0.2 0.60"
seta hud_panel_minigamestatus_bg "border_small"
seta hud_panel_minigamestatus_bg_border ""
seta hud_panel_minigamestatus_bg_padding ""
-seta hud_panel_minigamehelp "1"
seta hud_panel_minigamehelp_pos "0.22 0.78"
seta hud_panel_minigamehelp_size "0.50 0.20"
seta hud_panel_minigamehelp_bg ""
seta hud_panel_minigamehelp_bg_border ""
seta hud_panel_minigamehelp_bg_padding ""
-seta hud_panel_minigamemenu "0"
seta hud_panel_minigamemenu_pos "0 0.26"
seta hud_panel_minigamemenu_size "0.2 0.49"
seta hud_panel_minigamemenu_bg "border_small"
seta hud_panel_minigamemenu_bg_border ""
seta hud_panel_minigamemenu_bg_padding ""
-seta hud_panel_mapvote "1"
seta hud_panel_mapvote_pos "0 0"
seta hud_panel_mapvote_size "1 1"
seta hud_panel_mapvote_bg "0"
seta hud_panel_mapvote_bg_border ""
seta hud_panel_mapvote_bg_padding ""
-seta hud_panel_itemstime "2"
seta hud_panel_itemstime_pos "0.020000 0.490000"
seta hud_panel_itemstime_size "0.090000 0.140000"
seta hud_panel_itemstime_bg "0"
seta hud_panel_itemstime_progressbar_name "progressbar"
seta hud_panel_itemstime_progressbar_reduced "1"
seta hud_panel_itemstime_text "1"
-seta hud_panel_itemstime_ratio "3.500000"
+seta hud_panel_itemstime_ratio "3.5"
seta hud_panel_itemstime_dynamicsize "1"
-seta hud_panel_quickmenu "1"
seta hud_panel_quickmenu_pos "0.700000 0.460000"
seta hud_panel_quickmenu_size "0.210000 0.250000"
seta hud_panel_quickmenu_bg ""
seta hud_panel_bg "border_default"
seta hud_panel_bg_color "0.299327 1 0.81275"
seta hud_panel_bg_color_team "0"
-seta hud_panel_bg_alpha "0.700000"
+seta hud_panel_bg_alpha "0.7"
seta hud_panel_bg_border "8"
seta hud_panel_bg_padding "0"
seta hud_panel_fg_alpha "1"
seta hud_dock "dock"
seta hud_dock_color "0 0.697965 0.418232"
-seta hud_dock_color_team "0.700000"
-seta hud_dock_alpha "0.700000"
+seta hud_dock_color_team "0.7"
+seta hud_dock_alpha "0.7"
seta hud_progressbar_alpha "0.5"
seta hud_progressbar_strength_color "0 0 0.6"
seta hud_configure_grid_xsize "0.010000"
seta hud_configure_grid_ysize "0.010000"
-seta hud_panel_weapons "1"
seta hud_panel_weapons_pos "0.375000 0.870000"
seta hud_panel_weapons_size "0.300000 0.060000"
seta hud_panel_weapons_bg "0"
seta hud_panel_weapons_noncurrent_alpha "1"
seta hud_panel_weapons_noncurrent_scale "1"
-seta hud_panel_ammo "1"
seta hud_panel_ammo_pos "0.160000 0.910000"
seta hud_panel_ammo_size "0.190000 0.090000"
seta hud_panel_ammo_bg "0"
seta hud_panel_ammo_progressbar_xoffset "0"
seta hud_panel_ammo_text "1"
-seta hud_panel_powerups "1"
seta hud_panel_powerups_pos "0.660000 0.910000"
seta hud_panel_powerups_size "0.130000 0.090000"
seta hud_panel_powerups_bg "0"
seta hud_panel_powerups_progressbar "0"
seta hud_panel_powerups_text "1"
-seta hud_panel_healtharmor "1"
seta hud_panel_healtharmor_pos "0.370000 0.930000"
seta hud_panel_healtharmor_size "0.300000 0.070000"
seta hud_panel_healtharmor_bg "0"
seta hud_panel_healtharmor_bg_alpha ""
seta hud_panel_healtharmor_bg_border ""
seta hud_panel_healtharmor_bg_padding ""
+seta hud_panel_healtharmor_combined "0"
seta hud_panel_healtharmor_flip "0"
seta hud_panel_healtharmor_iconalign "0"
seta hud_panel_healtharmor_baralign "0"
seta hud_panel_healtharmor_progressbar_gfx_smooth "2"
seta hud_panel_healtharmor_text "1"
-seta hud_panel_notify "0"
seta hud_panel_notify_pos "0.010000 0.650000"
seta hud_panel_notify_size "0.300000 0.070000"
seta hud_panel_notify_bg "0"
seta hud_panel_notify_fadetime "3"
seta hud_panel_notify_icon_aspect "2"
-seta hud_panel_timer "1"
seta hud_panel_timer_pos "0.850000 0"
seta hud_panel_timer_size "0.150000 0.060000"
seta hud_panel_timer_bg ""
seta hud_panel_timer_bg_border ""
seta hud_panel_timer_bg_padding "0"
-seta hud_panel_radar "2"
seta hud_panel_radar_pos "0 0"
seta hud_panel_radar_size "0.200000 0.260000"
seta hud_panel_radar_bg "border_radar"
seta hud_panel_radar_bg_color ""
seta hud_panel_radar_bg_color_team ""
-seta hud_panel_radar_bg_alpha "0.500000"
+seta hud_panel_radar_bg_alpha "0.5"
seta hud_panel_radar_bg_border "0"
seta hud_panel_radar_bg_padding "0"
seta hud_panel_radar_foreground_alpha "1"
seta hud_panel_radar_maximized_rotation "1"
seta hud_panel_radar_maximized_zoommode "3"
-seta hud_panel_score "1"
seta hud_panel_score_pos "0.760000 0.910000"
seta hud_panel_score_size "0.200000 0.080000"
seta hud_panel_score_bg "0"
seta hud_panel_score_bg_padding ""
seta hud_panel_score_rankings "0"
-seta hud_panel_racetimer "1"
seta hud_panel_racetimer_pos "0.360000 0.140000"
seta hud_panel_racetimer_size "0.280000 0.090000"
seta hud_panel_racetimer_bg "0"
seta hud_panel_racetimer_bg_border ""
seta hud_panel_racetimer_bg_padding ""
-seta hud_panel_vote "1"
seta hud_panel_vote_pos "0.690000 0.750000"
seta hud_panel_vote_size "0.300000 0.100000"
seta hud_panel_vote_bg ""
seta hud_panel_vote_bg_alpha ""
seta hud_panel_vote_bg_border ""
seta hud_panel_vote_bg_padding "-3"
-seta hud_panel_vote_alreadyvoted_alpha "0.750000"
+seta hud_panel_vote_alreadyvoted_alpha "0.75"
-seta hud_panel_modicons "1"
seta hud_panel_modicons_pos "0.010000 0.910000"
seta hud_panel_modicons_size "0.135000 0.090000"
seta hud_panel_modicons_bg "0"
seta hud_panel_modicons_dom_layout "1"
seta hud_panel_modicons_freezetag_layout "1"
-seta hud_panel_pressedkeys "1"
seta hud_panel_pressedkeys_pos "0.440000 0.760000"
seta hud_panel_pressedkeys_size "0.120000 0.094368"
seta hud_panel_pressedkeys_bg "0"
seta hud_panel_pressedkeys_bg_alpha ""
seta hud_panel_pressedkeys_bg_border ""
seta hud_panel_pressedkeys_bg_padding ""
-seta hud_panel_pressedkeys_aspect "1.600000"
+seta hud_panel_pressedkeys_aspect "1.6"
seta hud_panel_pressedkeys_attack "0"
-seta hud_panel_chat "1"
seta hud_panel_chat_pos "0 0.760000"
seta hud_panel_chat_size "0.420000 0.130000"
seta hud_panel_chat_bg "0"
seta hud_panel_chat_bg_border ""
seta hud_panel_chat_bg_padding ""
-seta hud_panel_engineinfo "0"
seta hud_panel_engineinfo_pos "0.887500 0.870000"
seta hud_panel_engineinfo_size "0.112500 0.030000"
seta hud_panel_engineinfo_bg "0"
seta hud_panel_engineinfo_framecounter_time "0.1"
seta hud_panel_engineinfo_framecounter_decimals "0"
-seta hud_panel_infomessages "1"
seta hud_panel_infomessages_pos "0.690000 0.620000"
seta hud_panel_infomessages_size "0.300000 0.100000"
seta hud_panel_infomessages_bg "0"
seta hud_panel_infomessages_bg_padding ""
seta hud_panel_infomessages_flip "1"
-seta hud_panel_physics "3"
seta hud_panel_physics_pos "0.430000 0.640000"
seta hud_panel_physics_size "0.140000 0.100000"
seta hud_panel_physics_bg "0"
seta hud_panel_physics_text "2"
seta hud_panel_physics_text_scale "1"
-seta hud_panel_centerprint "1"
seta hud_panel_centerprint_pos "0.175000 0.260000"
seta hud_panel_centerprint_size "0.650000 0.200000"
seta hud_panel_centerprint_bg "0"
seta hud_panel_centerprint_fade_subsequent_minfontsize "0.75"
seta hud_panel_centerprint_fade_minfontsize "0"
-seta hud_panel_minigameboard "1"
seta hud_panel_minigameboard_pos "0.22 0.15"
seta hud_panel_minigameboard_size "0.50 0.60"
seta hud_panel_minigameboard_bg "border_small"
seta hud_panel_minigameboard_bg_border ""
seta hud_panel_minigameboard_bg_padding ""
-seta hud_panel_minigamestatus "1"
seta hud_panel_minigamestatus_pos "0.74 0.15"
seta hud_panel_minigamestatus_size "0.2 0.60"
seta hud_panel_minigamestatus_bg "border_small"
seta hud_panel_minigamestatus_bg_border ""
seta hud_panel_minigamestatus_bg_padding ""
-seta hud_panel_minigamehelp "1"
seta hud_panel_minigamehelp_pos "0.22 0.78"
seta hud_panel_minigamehelp_size "0.50 0.20"
seta hud_panel_minigamehelp_bg ""
seta hud_panel_minigamehelp_bg_border ""
seta hud_panel_minigamehelp_bg_padding ""
-seta hud_panel_minigamemenu "0"
seta hud_panel_minigamemenu_pos "0 0.26"
seta hud_panel_minigamemenu_size "0.2 0.49"
seta hud_panel_minigamemenu_bg "border_small"
seta hud_panel_minigamemenu_bg_border ""
seta hud_panel_minigamemenu_bg_padding ""
-seta hud_panel_mapvote "1"
seta hud_panel_mapvote_pos "0 0"
seta hud_panel_mapvote_size "1 1"
seta hud_panel_mapvote_bg "0"
seta hud_panel_mapvote_bg_border ""
seta hud_panel_mapvote_bg_padding ""
-seta hud_panel_itemstime "2"
seta hud_panel_itemstime_pos "0.000000 0.290000"
seta hud_panel_itemstime_size "0.150000 0.060000"
seta hud_panel_itemstime_bg "0"
seta hud_panel_itemstime_ratio "2"
seta hud_panel_itemstime_dynamicsize "1"
-seta hud_panel_quickmenu "1"
seta hud_panel_quickmenu_pos "0.010000 0.380000"
seta hud_panel_quickmenu_size "0.210000 0.250000"
seta hud_panel_quickmenu_bg ""
float autocvar_hud_panel_fg_alpha;
bool autocvar_hud_panel_healtharmor;
int autocvar_hud_panel_healtharmor_baralign;
+bool autocvar_hud_panel_healtharmor_combined;
bool autocvar_hud_panel_healtharmor_flip;
int autocvar_hud_panel_healtharmor_iconalign;
int autocvar_hud_panel_healtharmor_maxarmor;
return eX * best_columns + eY * best_rows;
}
-// return the string of the onscreen race timer
-string MakeRaceString(int cp, float mytime, float theirtime, float lapdelta, string theirname)
-{
- TC(int, cp);
- string col;
- string timestr;
- string cpname;
- string lapstr;
- lapstr = "";
-
- if(theirtime == 0) // goal hit
- {
- if(mytime > 0)
- {
- timestr = strcat("+", ftos_decimals(+mytime, TIME_DECIMALS));
- col = "^1";
- }
- else if(mytime == 0)
- {
- timestr = "+0.0";
- col = "^3";
- }
- else
- {
- timestr = strcat("-", ftos_decimals(-mytime, TIME_DECIMALS));
- col = "^2";
- }
-
- if(lapdelta > 0)
- {
- lapstr = sprintf(_(" (-%dL)"), lapdelta);
- col = "^2";
- }
- else if(lapdelta < 0)
- {
- lapstr = sprintf(_(" (+%dL)"), -lapdelta);
- col = "^1";
- }
- }
- else if(theirtime > 0) // anticipation
- {
- if(mytime >= theirtime)
- timestr = strcat("+", ftos_decimals(mytime - theirtime, TIME_DECIMALS));
- else
- timestr = TIME_ENCODED_TOSTRING(TIME_ENCODE(theirtime));
- col = "^3";
- }
- else
- {
- col = "^7";
- timestr = "";
- }
-
- if(cp == 254)
- cpname = _("Start line");
- else if(cp == 255)
- cpname = _("Finish line");
- else if(cp)
- cpname = sprintf(_("Intermediate %d"), cp);
- else
- cpname = _("Finish line");
-
- if(theirtime < 0)
- return strcat(col, cpname);
- else if(theirname == "")
- return strcat(col, sprintf("%s (%s)", cpname, timestr));
- else
- return strcat(col, sprintf("%s (%s %s)", cpname, timestr, strcat(theirname, col, lapstr)));
-}
-
-// Check if the given name already exist in race rankings? In that case, where? (otherwise return 0)
-int race_CheckName(string net_name)
-{
- int i;
- for (i=RANKINGS_CNT-1;i>=0;--i)
- if(grecordholder[i] == net_name)
- return i+1;
- return 0;
-}
-
/*
==================
HUD panels
drawsubpic(pos + eX * mySize.x - eX * min(mySize.x * 0.5, mySize.y), eX * min(mySize.x * 0.5, mySize.y) + eY * mySize.y, pic, '0.75 0 0', '0.25 1 0', color, theAlpha, drawflag);
}
-void DrawNumIcon_expanding(vector myPos, vector mySize, float x, string icon, bool vertical, bool icon_right_align, vector color, float theAlpha, float fadelerp)
+void DrawNumIcon_expanding(vector myPos, vector mySize, float x, string icon, bool vertical, int icon_right_align, vector color, float theAlpha, float fadelerp)
{
- TC(bool, vertical); TC(bool, icon_right_align);
+ TC(bool, vertical); TC(int, icon_right_align);
vector newPos = '0 0 0', newSize = '0 0 0';
vector picpos, numpos;
float HUD_GetRowCount(int item_count, vector size, float item_aspect);
vector HUD_Get_Num_Color (float x, float maxvalue);
void DrawNumIcon(vector myPos, vector mySize, float x, string icon, bool vertical, bool icon_right_align, vector color, float theAlpha);
-void DrawNumIcon_expanding(vector myPos, vector mySize, float x, string icon, bool vertical, bool icon_right_align, vector color, float theAlpha, float fadelerp);
+void DrawNumIcon_expanding(vector myPos, vector mySize, float x, string icon, bool vertical, int icon_right_align, vector color, float theAlpha, float fadelerp);
void HUD_Panel_DrawHighlight(vector pos, vector mySize, vector color, float theAlpha, int drawflag);
vector HUD_GetTableSize_BestItemAR(int item_count, vector psize, float item_aspect);
{
panel = hud_panels_from(i);
- HUD_Write_PanelCvar("");
HUD_Write_PanelCvar("_pos");
HUD_Write_PanelCvar("_size");
HUD_Write_PanelCvar("_bg");
HUD_Write_PanelCvar("_progressbar_armor");
HUD_Write_PanelCvar("_progressbar_gfx");
HUD_Write_PanelCvar("_progressbar_gfx_smooth");
+ HUD_Write_PanelCvar("_combined");
HUD_Write_PanelCvar("_text");
break;
case HUD_PANEL_NOTIFY:
int maxhealth = autocvar_hud_panel_healtharmor_maxhealth;
int maxarmor = autocvar_hud_panel_healtharmor_maxarmor;
- if(autocvar_hud_panel_healtharmor == 2) // combined health and armor display
+ if(autocvar_hud_panel_healtharmor_combined) // combined health and armor display
{
vector v;
v = healtharmor_maxdamage(health, armor, armorblockpercent, DEATH_WEAPON.m_id);
float race_status_time;
int race_status_prev;
string race_status_name_prev;
+
+// Check if the given name already exist in race rankings? In that case, where? (otherwise return 0)
+int race_CheckName(string net_name)
+{
+ int i;
+ for (i=RANKINGS_CNT-1;i>=0;--i)
+ if(grecordholder[i] == net_name)
+ return i+1;
+ return 0;
+}
+
+void race_showTime(string text, vector pos, vector timeText_ofs, float theTime, vector textSize, float f)
+{
+ drawstring_aspect(pos, text, textSize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
+ drawstring_aspect(pos + timeText_ofs, TIME_ENCODED_TOSTRING(theTime), textSize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
+ if (f < 1) {
+ drawstring_aspect_expanding(pos, text, textSize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL, f);
+ drawstring_aspect_expanding(pos + timeText_ofs, TIME_ENCODED_TOSTRING(theTime), textSize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL, f);
+ }
+}
+
void HUD_Mod_Race(vector pos, vector mySize)
{
mod_active = 1; // race should never hide the mod icons panel
entity me;
me = playerslots[player_localnum];
float score;
- float f; // yet another function has this
score = me.(scores[ps_primary]);
if(!(scores_flags[ps_primary] & SFL_TIME) || teamplay) // race/cts record display on HUD
db_put(ClientProgsDB, strcat(shortmapname, rr, "time"), ftos(score));
if(autocvar_cl_autodemo_delete_keeprecords)
{
- f = autocvar_cl_autodemo_delete;
+ float f = autocvar_cl_autodemo_delete;
f &= ~1;
cvar_set("cl_autodemo_delete", ftos(f)); // don't delete demo with new record!
}
textPos = pos + eY * 0.5 * max(0, mySize.y/2 - squareSize) + eX * 0.5 * (mySize.x - squareSize);
medalPos = pos + eY * 0.5 * max(0, mySize.y/2 - squareSize) + eY * 0.5 * mySize.y + eX * 0.5 * (mySize.x - squareSize);
}
+ vector textSize = eX * squareSize + eY * 0.25 * squareSize;
- f = time - crecordtime_change_time;
-
- if (f > 1) {
- drawstring_aspect(textPos, _("Personal best"), eX * squareSize + eY * 0.25 * squareSize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
- drawstring_aspect(textPos + eY * 0.25 * squareSize, TIME_ENCODED_TOSTRING(t), eX * squareSize + eY * 0.25 * squareSize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
- } else {
- drawstring_aspect(textPos, _("Personal best"), eX * squareSize + eY * 0.25 * squareSize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
- drawstring_aspect(textPos + eY * 0.25 * squareSize, TIME_ENCODED_TOSTRING(t), eX * squareSize + eY * 0.25 * squareSize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
- drawstring_aspect_expanding(pos, _("Personal best"), eX * squareSize + eY * 0.25 * squareSize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL, f);
- drawstring_aspect_expanding(pos + eY * 0.25 * squareSize, TIME_ENCODED_TOSTRING(t), eX * squareSize + eY * 0.25 * squareSize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL, f);
- }
+ race_showTime(_("Personal best"), textPos, eY * 0.25 * squareSize, t, textSize, time - crecordtime_change_time);
// server record
t = race_server_record;
srecordtime_prev = t;
srecordtime_change_time = time;
}
- f = time - srecordtime_change_time;
- if (f > 1) {
- drawstring_aspect(textPos + eY * 0.5 * squareSize, _("Server best"), eX * squareSize + eY * 0.25 * squareSize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
- drawstring_aspect(textPos + eY * 0.75 * squareSize, TIME_ENCODED_TOSTRING(t), eX * squareSize + eY * 0.25 * squareSize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
- } else {
- drawstring_aspect(textPos + eY * 0.5 * squareSize, _("Server best"), eX * squareSize + eY * 0.25 * squareSize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
- drawstring_aspect(textPos + eY * 0.75 * squareSize, TIME_ENCODED_TOSTRING(t), eX * squareSize + eY * 0.25 * squareSize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
- drawstring_aspect_expanding(textPos + eY * 0.5 * squareSize, _("Server best"), eX * squareSize + eY * 0.25 * squareSize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL, f);
- drawstring_aspect_expanding(textPos + eY * 0.75 * squareSize, TIME_ENCODED_TOSTRING(t), eX * squareSize + eY * 0.25 * squareSize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL, f);
- }
+ textPos += eY * 0.5 * squareSize;
+ race_showTime(_("Server best"), textPos, eY * 0.25 * squareSize, t, textSize, time - srecordtime_change_time);
if (race_status != race_status_prev || race_status_name != race_status_name_prev) {
race_status_time = time + 5;
#include <common/mapinfo.qh>
/** Race timer (#8) */
+
+// return the string of the onscreen race timer
+string MakeRaceString(int cp, float mytime, float theirtime, float lapdelta, string theirname)
+{
+ TC(int, cp);
+ string col;
+ string timestr;
+ string cpname;
+ string lapstr;
+ lapstr = "";
+
+ if(theirtime == 0) // goal hit
+ {
+ if(mytime > 0)
+ {
+ timestr = strcat("+", ftos_decimals(+mytime, TIME_DECIMALS));
+ col = "^1";
+ }
+ else if(mytime == 0)
+ {
+ timestr = "+0.0";
+ col = "^3";
+ }
+ else
+ {
+ timestr = strcat("-", ftos_decimals(-mytime, TIME_DECIMALS));
+ col = "^2";
+ }
+
+ if(lapdelta > 0)
+ {
+ lapstr = sprintf(_(" (-%dL)"), lapdelta);
+ col = "^2";
+ }
+ else if(lapdelta < 0)
+ {
+ lapstr = sprintf(_(" (+%dL)"), -lapdelta);
+ col = "^1";
+ }
+ }
+ else if(theirtime > 0) // anticipation
+ {
+ if(mytime >= theirtime)
+ timestr = strcat("+", ftos_decimals(mytime - theirtime, TIME_DECIMALS));
+ else
+ timestr = TIME_ENCODED_TOSTRING(TIME_ENCODE(theirtime));
+ col = "^3";
+ }
+ else
+ {
+ col = "^7";
+ timestr = "";
+ }
+
+ if(cp == 254)
+ cpname = _("Start line");
+ else if(cp == 255)
+ cpname = _("Finish line");
+ else if(cp)
+ cpname = sprintf(_("Intermediate %d"), cp);
+ else
+ cpname = _("Finish line");
+
+ if(theirtime < 0)
+ return strcat(col, cpname);
+ else if(theirname == "")
+ return strcat(col, sprintf("%s (%s)", cpname, timestr));
+ else
+ return strcat(col, sprintf("%s (%s %s)", cpname, timestr, strcat(theirname, col, lapstr)));
+}
+
void HUD_RaceTimer ()
{
if(!autocvar__hud_configure)
"other gamemodes except DM.\n"));
}
-#define HUD_DefaultColumnLayout() \
-"ping pl name | " \
-"-teams,cts,lms/kills +ft,tdm/kills -teams,lms/deaths +ft,tdm/deaths -teams,lms,rc,ka/suicides +ft,tdm/suicides -cts,dm,tdm,ka,ft/frags " /* tdm already has this in "score" */ \
-"-rc,cts,nb/dmg -rc,cts,nb/dmgtaken " \
-"+ctf/caps +ctf/pickups +ctf/fckills +ctf/returns +ons/caps +ons/takes " \
-"+lms/lives +lms/rank " \
-"+kh/caps +kh/pushes +kh/destroyed " \
-"?+rc/laps ?+rc/time ?+rc/fastest " \
-"+as/objectives +nb/faults +nb/goals +ka/pickups +ka/bckills +ka/bctime +ft/revivals " \
-"-lms,rc,nb/score"
+// NOTE: adding a gametype with ? to not warn for an optional field
+// make sure it's excluded in a previous exclusive rule, if any
+// otherwise the previous exclusive rule warns anyway
+// e.g. -teams,rc,cts,lms/kills ?+rc/kills
+#define SCOREBOARD_DEFAULT_COLUMNS \
+"ping pl name |" \
+" -teams,rc,cts,inv,lms/kills +ft,tdm/kills ?+rc,inv/kills" \
+" -teams,lms/deaths +ft,tdm/deaths" \
+" -teams,lms,rc,cts,inv,ka/suicides +ft,tdm/suicides ?+rc,inv/suicides" \
+" -cts,dm,tdm,ka,ft/frags" /* tdm already has this in "score" */ \
+" -rc,cts,nb/dmg -rc,cts,nb/dmgtaken" \
+" +ctf/caps +ctf/pickups +ctf/fckills +ctf/returns +ons/caps +ons/takes" \
+" +lms/lives +lms/rank" \
+" +kh/caps +kh/pushes +kh/destroyed" \
+" ?+rc/laps ?+rc/time +rc,cts/fastest" \
+" +as/objectives +nb/faults +nb/goals" \
+" +ka/pickups +ka/bckills +ka/bctime +ft/revivals" \
+" -lms,rc,cts,inv,nb/score"
void Cmd_HUD_SetFields(int argc)
{
argc = tokenizebyseparator(strcat("0 1 ", autocvar_scoreboard_columns), " ");
if(argc < 3)
- argc = tokenizebyseparator(strcat("0 1 ", HUD_DefaultColumnLayout()), " ");
+ argc = tokenizebyseparator(strcat("0 1 ", SCOREBOARD_DEFAULT_COLUMNS), " ");
if(argc == 3)
{
if(argv(2) == "default")
- argc = tokenizebyseparator(strcat("0 1 ", HUD_DefaultColumnLayout()), " ");
+ argc = tokenizebyseparator(strcat("0 1 ", SCOREBOARD_DEFAULT_COLUMNS), " ");
else if(argv(2) == "all")
{
string s;
{
case "ping": hud_field[hud_num_fields] = SP_PING; break;
case "pl": hud_field[hud_num_fields] = SP_PL; break;
- case "pl": hud_field[hud_num_fields] = SP_PL; break;
case "kd": case "kdr": case "kdratio": case "k/d": hud_field[hud_num_fields] = SP_KDRATIO; break;
case "sum": case "diff": case "k-d": hud_field[hud_num_fields] = SP_SUM; break;
case "name": case "nick": hud_field[hud_num_fields] = SP_NAME; have_name = true; break;
}
make_impure(it);
assert(entcs.think, eprint(entcs));
- WITH(entity, self, entcs, entcs.think());
+ WITHSELF(entcs, entcs.think());
if (!entcs.has_origin) continue;
if (entcs.m_entcs_private)
{
if(!gen)
ons_roundlost = false; // don't enforce the 3rd person camera if there is no dead generator to show
}
- if(WantEventchase(self) || (!autocvar_cl_orthoview && ons_roundlost))
+ if(WantEventchase(this) || (!autocvar_cl_orthoview && ons_roundlost))
{
eventchase_running = true;
entity local_player = ((csqcplayer) ? csqcplayer : CSQCModel_server2csqc(player_localentnum - 1));
if(!local_player)
- local_player = self; // fall back!
+ local_player = this; // fall back!
// 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(view_offset)
{
- WarpZone_TraceLine(current_view_origin, current_view_origin + view_offset + ('0 0 1' * autocvar_cl_eventchase_maxs.z), MOVE_WORLDONLY, self);
+ 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); }
}
makevectors(view_angles);
vector eventchase_target_origin = (current_view_origin - (v_forward * eventchase_current_distance));
- WarpZone_TraceBox(current_view_origin, autocvar_cl_eventchase_mins, autocvar_cl_eventchase_maxs, eventchase_target_origin, MOVE_WORLDONLY, self);
+ 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(!local_player.viewloc)
if(trace_startsolid)
{
eventchase_target_origin = (current_view_origin - (v_forward * eventchase_current_distance));
- WarpZone_TraceLine(current_view_origin, eventchase_target_origin, MOVE_WORLDONLY, self);
+ WarpZone_TraceLine(current_view_origin, eventchase_target_origin, MOVE_WORLDONLY, this);
setproperty(VF_ORIGIN, (trace_endpos - (v_forward * autocvar_cl_eventchase_mins.z)));
}
else { setproperty(VF_ORIGIN, trace_endpos); }
{SELFPARAM();
// if particle distribution is enabled, slow ticrate by total number of damages
if(autocvar_cl_damageeffect_distribute)
- self.nextthink = time + autocvar_cl_damageeffect_ticrate * self.owner.total_damages;
+ this.nextthink = time + autocvar_cl_damageeffect_ticrate * this.owner.total_damages;
else
- self.nextthink = time + autocvar_cl_damageeffect_ticrate;
+ this.nextthink = time + autocvar_cl_damageeffect_ticrate;
- if(time >= self.cnt || !self.owner || !self.owner.modelindex || !self.owner.drawmask)
+ if(time >= this.cnt || !this.owner || !this.owner.modelindex || !this.owner.drawmask)
{
// time is up or the player got gibbed / disconnected
- self.owner.total_damages = max(0, self.owner.total_damages - 1);
- remove(self);
+ this.owner.total_damages = max(0, this.owner.total_damages - 1);
+ remove(this);
return;
}
- if(self.state && !self.owner.csqcmodel_isdead)
+ if(this.state && !this.owner.csqcmodel_isdead)
{
// if the player was dead but is now alive, it means he respawned
// if so, clear his damage effects, or damages from his dead body will be copied back
- self.owner.total_damages = max(0, self.owner.total_damages - 1);
- remove(self);
+ this.owner.total_damages = max(0, this.owner.total_damages - 1);
+ remove(this);
return;
}
- self.state = self.owner.csqcmodel_isdead;
- if(self.owner.isplayermodel && (self.owner.entnum == player_localentnum) && !autocvar_chase_active)
+ this.state = this.owner.csqcmodel_isdead;
+ if(this.owner.isplayermodel && (this.owner.entnum == player_localentnum) && !autocvar_chase_active)
return; // if we aren't using a third person camera, hide our own effects
// now generate the particles
vector org;
- org = gettaginfo(self, 0); // origin at attached location
- __pointparticles(self.team, org, '0 0 0', 1);
+ org = gettaginfo(this, 0); // origin at attached location
+ __pointparticles(this.team, org, '0 0 0', 1);
}
string species_prefix(int specnum)
}
}
-void DamageEffect(vector hitorg, float thedamage, int type, int specnum)
-{SELFPARAM();
+void DamageEffect(entity this, vector hitorg, float thedamage, int type, int specnum)
+{
// particle effects for players and objects damaged by weapons (eg: flames coming out of victims shot with rockets)
int nearestbone = 0;
if(!autocvar_cl_damageeffect || autocvar_cl_gentle || autocvar_cl_gentle_damage)
return;
- if(!self || !self.modelindex || !self.drawmask)
+ if(!this || !this.modelindex || !this.drawmask)
return;
// if this is a rigged mesh, the effect will show on the bone where damage was dealt
// we do this by choosing the skeletal bone closest to the impact, and attaching our entity to it
// if there's no skeleton, object origin will automatically be selected
- FOR_EACH_TAG(self)
+ FOR_EACH_TAG(this)
{
if(!tagnum)
continue; // skip empty bones
continue; // player model bone blacklist
// now choose the bone closest to impact origin
- if(nearestbone == 0 || vlen2(hitorg - gettaginfo(self, tagnum)) <= vlen2(hitorg - gettaginfo(self, nearestbone)))
+ if(nearestbone == 0 || vlen2(hitorg - gettaginfo(this, tagnum)) <= vlen2(hitorg - gettaginfo(this, nearestbone)))
nearestbone = tagnum;
}
- gettaginfo(self, nearestbone); // set gettaginfo_name
+ gettaginfo(this, nearestbone); // set gettaginfo_name
// return if we reached our damage effect limit or damages are disabled
// TODO: When the limit is reached, it would be better if the oldest damage was removed instead of not adding a new one
if(nearestbone)
{
- if(self.total_damages >= autocvar_cl_damageeffect_bones)
+ if(this.total_damages >= autocvar_cl_damageeffect_bones)
return; // allow multiple damages on skeletal models
}
else
{
- if(autocvar_cl_damageeffect < 2 || self.total_damages)
+ if(autocvar_cl_damageeffect < 2 || this.total_damages)
return; // allow a single damage on non-skeletal models
}
if(substring(effectname, strlen(effectname) - 5, 5) == "BLOOD")
{
- if(self.isplayermodel)
+ if(this.isplayermodel)
{
specstr = species_prefix(specnum);
specstr = substring(specstr, 0, strlen(specstr) - 1);
e = new(damage);
setmodel(e, MDL_Null); // necessary to attach and read origin
- setattachment(e, self, gettaginfo_name); // attach to the given bone
- e.owner = self;
+ setattachment(e, this, gettaginfo_name); // attach to the given bone
+ e.owner = this;
e.cnt = time + life;
e.team = _particleeffectnum(effectname);
e.think = DamageEffect_Think;
e.nextthink = time;
- self.total_damages += 1;
+ this.total_damages += 1;
}
NET_HANDLE(ENT_CLIENT_DAMAGEINFO, bool isNew)
{
- make_pure(this);
+ const float ATTEN_LOW = 0.2;
float thedamage, rad, edge, thisdmg;
bool hitplayer = false;
int species, forcemul;
forcemul = 1;
FOREACH_ENTITY_RADIUS(w_org, rad + MAX_DAMAGEEXTRARADIUS, !it.tag_entity, {
- setself(it);
- vector nearest = NearestPointOnBox(self, w_org);
+ vector nearest = NearestPointOnBox(it, w_org);
if (rad)
{
- thisdmg = ((vlen (nearest - w_org) - bound(MIN_DAMAGEEXTRARADIUS, self.damageextraradius, MAX_DAMAGEEXTRARADIUS)) / rad);
+ thisdmg = ((vlen (nearest - w_org) - bound(MIN_DAMAGEEXTRARADIUS, it.damageextraradius, MAX_DAMAGEEXTRARADIUS)) / rad);
if(thisdmg >= 1)
continue;
if(thisdmg < 0)
if(thedamage)
{
thisdmg = thedamage + (edge - thedamage) * thisdmg;
- thisforce = forcemul * vlen(force) * (thisdmg / thedamage) * normalize(self.origin - w_org);
+ thisforce = forcemul * vlen(force) * (thisdmg / thedamage) * normalize(it.origin - w_org);
}
else
{
thisdmg = 0;
- thisforce = forcemul * vlen(force) * normalize(self.origin - w_org);
+ thisforce = forcemul * vlen(force) * normalize(it.origin - w_org);
}
}
else
{
- if(vdist((nearest - w_org), >, bound(MIN_DAMAGEEXTRARADIUS, self.damageextraradius, MAX_DAMAGEEXTRARADIUS)))
+ if(vdist((nearest - w_org), >, bound(MIN_DAMAGEEXTRARADIUS, it.damageextraradius, MAX_DAMAGEEXTRARADIUS)))
continue;
thisdmg = thedamage;
thisforce = forcemul * force;
}
- if(self.damageforcescale)
+ if(it.damageforcescale)
if(vdist(thisforce, !=, 0))
{
- self.move_velocity = self.move_velocity + damage_explosion_calcpush(self.damageforcescale * thisforce, self.move_velocity, autocvar_g_balance_damagepush_speedfactor);
- self.move_flags &= ~FL_ONGROUND;
+ it.move_velocity = it.move_velocity + damage_explosion_calcpush(it.damageforcescale * thisforce, it.move_velocity, autocvar_g_balance_damagepush_speedfactor);
+ it.move_flags &= ~FL_ONGROUND;
}
if(w_issilent)
- self.silent = 1;
+ it.silent = 1;
- if(self.event_damage)
- self.event_damage(self, thisdmg, w_deathtype, w_org, thisforce);
+ if(it.event_damage)
+ it.event_damage(it, thisdmg, w_deathtype, w_org, thisforce);
- DamageEffect(w_org, thisdmg, w_deathtype, species);
+ DamageEffect(it, w_org, thisdmg, w_deathtype, species);
- if(self.isplayermodel)
+ if(it.isplayermodel)
hitplayer = true; // this impact damaged a player
});
- setself(this);
if(DEATH_ISVEHICLE(w_deathtype))
{
else
w_backoff = -1 * normalize(w_org - (w_org + normalize(force) * 16));
- setorigin(self, w_org + w_backoff * 2); // for sound() calls
+ setorigin(this, w_org + w_backoff * 2); // for sound() calls
switch(DEATH_ENT(w_deathtype))
{
// spiderbot
case DEATH_VH_SPID_MINIGUN:
- sound(self, CH_SHOTS, SND_RIC_RANDOM(), VOL_BASE, ATTEN_NORM);
- pointparticles(EFFECT_SPIDERBOT_MINIGUN_IMPACT, self.origin, w_backoff * 1000, 1);
+ sound(this, CH_SHOTS, SND_RIC_RANDOM(), VOL_BASE, ATTEN_NORM);
+ pointparticles(EFFECT_SPIDERBOT_MINIGUN_IMPACT, this.origin, w_backoff * 1000, 1);
break;
case DEATH_VH_SPID_ROCKET:
- sound(self, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
- pointparticles(EFFECT_SPIDERBOT_ROCKET_EXPLODE, self.origin, w_backoff * 1000, 1);
+ sound(this, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
+ pointparticles(EFFECT_SPIDERBOT_ROCKET_EXPLODE, this.origin, w_backoff * 1000, 1);
break;
case DEATH_VH_SPID_DEATH:
- sound(self, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_MIN);
- pointparticles(EFFECT_EXPLOSION_BIG, self.origin, w_backoff * 1000, 1);
+ sound(this, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_LOW);
+ pointparticles(EFFECT_EXPLOSION_BIG, this.origin, w_backoff * 1000, 1);
break;
case DEATH_VH_WAKI_GUN:
- sound(self, CH_SHOTS, SND_LASERIMPACT, VOL_BASE, ATTEN_NORM);
- pointparticles(EFFECT_RACER_IMPACT, self.origin, w_backoff * 1000, 1);
+ sound(this, CH_SHOTS, SND_LASERIMPACT, VOL_BASE, ATTEN_NORM);
+ pointparticles(EFFECT_RACER_IMPACT, this.origin, w_backoff * 1000, 1);
break;
case DEATH_VH_WAKI_ROCKET:
- sound(self, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
- pointparticles(EFFECT_RACER_ROCKET_EXPLODE, self.origin, w_backoff * 1000, 1);
+ sound(this, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
+ pointparticles(EFFECT_RACER_ROCKET_EXPLODE, this.origin, w_backoff * 1000, 1);
break;
case DEATH_VH_WAKI_DEATH:
- sound(self, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_MIN);
- pointparticles(EFFECT_EXPLOSION_BIG, self.origin, w_backoff * 1000, 1);
+ sound(this, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_LOW);
+ pointparticles(EFFECT_EXPLOSION_BIG, this.origin, w_backoff * 1000, 1);
break;
case DEATH_VH_RAPT_CANNON:
- sound(self, CH_SHOTS, SND_LASERIMPACT, VOL_BASE, ATTEN_NORM);
- pointparticles(EFFECT_RAPTOR_CANNON_IMPACT, self.origin, w_backoff * 1000, 1);
+ sound(this, CH_SHOTS, SND_LASERIMPACT, VOL_BASE, ATTEN_NORM);
+ pointparticles(EFFECT_RAPTOR_CANNON_IMPACT, this.origin, w_backoff * 1000, 1);
break;
case DEATH_VH_RAPT_FRAGMENT:
float i;
ang = vectoangles(vel);
RaptorCBShellfragToss(w_org, vel, ang + '0 0 1' * (120 * i));
}
- sound(self, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
- pointparticles(EFFECT_RAPTOR_BOMB_SPREAD, self.origin, w_backoff * 1000, 1);
+ sound(this, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
+ pointparticles(EFFECT_RAPTOR_BOMB_SPREAD, this.origin, w_backoff * 1000, 1);
break;
case DEATH_VH_RAPT_BOMB:
- sound(self, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
- pointparticles(EFFECT_RAPTOR_BOMB_IMPACT, self.origin, w_backoff * 1000, 1);
+ sound(this, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
+ pointparticles(EFFECT_RAPTOR_BOMB_IMPACT, this.origin, w_backoff * 1000, 1);
break;
case DEATH_VH_RAPT_DEATH:
- sound(self, CH_SHOTS, SND_LASERIMPACT, VOL_BASE, ATTEN_MIN);
- pointparticles(EFFECT_EXPLOSION_BIG, self.origin, w_backoff * 1000, 1);
+ sound(this, CH_SHOTS, SND_LASERIMPACT, VOL_BASE, ATTEN_LOW);
+ pointparticles(EFFECT_EXPLOSION_BIG, this.origin, w_backoff * 1000, 1);
break;
case DEATH_VH_BUMB_GUN:
- sound(self, CH_SHOTS, SND_FIREBALL_IMPACT2, VOL_BASE, ATTEN_NORM);
- pointparticles(EFFECT_BIGPLASMA_IMPACT, self.origin, w_backoff * 1000, 1);
+ sound(this, CH_SHOTS, SND_FIREBALL_IMPACT2, VOL_BASE, ATTEN_NORM);
+ pointparticles(EFFECT_BIGPLASMA_IMPACT, this.origin, w_backoff * 1000, 1);
break;
}
}
else
w_backoff = -1 * normalize(w_org - (w_org + normalize(force) * 16));
- setorigin(self, w_org + w_backoff * 2); // for sound() calls
+ setorigin(this, w_org + w_backoff * 2); // for sound() calls
switch(DEATH_ENT(w_deathtype))
{
case DEATH_TURRET_EWHEEL:
- sound(self, CH_SHOTS, SND_LASERIMPACT, VOL_BASE, ATTEN_MIN);
- pointparticles(EFFECT_BLASTER_IMPACT, self.origin, w_backoff * 1000, 1);
+ sound(this, CH_SHOTS, SND_LASERIMPACT, VOL_BASE, ATTEN_LOW);
+ pointparticles(EFFECT_BLASTER_IMPACT, this.origin, w_backoff * 1000, 1);
break;
case DEATH_TURRET_FLAC:
pointparticles(EFFECT_HAGAR_EXPLODE, w_org, '0 0 0', 1);
- sound(self, CH_SHOTS, SND_HAGEXP_RANDOM(), VOL_BASE, ATTEN_NORM);
+ sound(this, CH_SHOTS, SND_HAGEXP_RANDOM(), VOL_BASE, ATTEN_NORM);
break;
case DEATH_TURRET_MLRS:
case DEATH_TURRET_HK:
case DEATH_TURRET_WALK_ROCKET:
case DEATH_TURRET_HELLION:
- sound(self, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_MIN);
- pointparticles(EFFECT_ROCKET_EXPLODE, self.origin, w_backoff * 1000, 1);
+ sound(this, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_LOW);
+ pointparticles(EFFECT_ROCKET_EXPLODE, this.origin, w_backoff * 1000, 1);
break;
case DEATH_TURRET_MACHINEGUN:
case DEATH_TURRET_WALK_GUN:
- sound(self, CH_SHOTS, SND_RIC_RANDOM(), VOL_BASE, ATTEN_NORM);
- pointparticles(EFFECT_MACHINEGUN_IMPACT, self.origin, w_backoff * 1000, 1);
+ sound(this, CH_SHOTS, SND_RIC_RANDOM(), VOL_BASE, ATTEN_NORM);
+ pointparticles(EFFECT_MACHINEGUN_IMPACT, this.origin, w_backoff * 1000, 1);
break;
case DEATH_TURRET_PLASMA:
- sound(self, CH_SHOTS, SND_ELECTRO_IMPACT, VOL_BASE, ATTEN_MIN);
- pointparticles(EFFECT_ELECTRO_IMPACT, self.origin, w_backoff * 1000, 1);
+ sound(this, CH_SHOTS, SND_ELECTRO_IMPACT, VOL_BASE, ATTEN_LOW);
+ pointparticles(EFFECT_ELECTRO_IMPACT, this.origin, w_backoff * 1000, 1);
break;
case DEATH_TURRET_WALK_MELEE:
- sound(self, CH_SHOTS, SND_RIC_RANDOM(), VOL_BASE, ATTEN_MIN);
- pointparticles(EFFECT_TE_SPARK, self.origin, w_backoff * 1000, 1);
+ sound(this, CH_SHOTS, SND_RIC_RANDOM(), VOL_BASE, ATTEN_LOW);
+ pointparticles(EFFECT_TE_SPARK, this.origin, w_backoff * 1000, 1);
break;
case DEATH_TURRET_PHASER:
break;
case DEATH_TURRET_TESLA:
- te_smallflash(self.origin);
+ te_smallflash(this.origin);
break;
}
w_backoff = trace_plane_normal;
else
w_backoff = -1 * normalize(force);
- setorigin(self, w_org + w_backoff * 2); // for sound() calls
+ setorigin(this, w_org + w_backoff * 2); // for sound() calls
if(!(trace_dphitq3surfaceflags & Q3SURFACEFLAG_SKY))
{
#undef X
this.iflags |= IFLAG_ORIGIN;
InterpolateOrigin_Note(this);
- WITH(entity, self, this, this.think());
+ WITHSELF(this, this.think());
return true;
}
}
}
-void nb_delayedinit()
+void nb_delayedinit(entity this)
{
if(find(world, classname, "nexball_team") == world)
nb_spawnteams();
WEP_NEXBALL.spawnflags &= ~WEP_FLAG_MUTATORBLOCKED;
ActivateTeamplay();
- SetLimits(autocvar_g_nexball_goallimit, autocvar_g_nexball_goalleadlimit, -1, -1);
+ SetLimits(autocvar_g_nexball_goallimit, autocvar_g_nexball_goalleadlimit, autocvar_timelimit_override, -1);
have_team_spawns = -1; // request team spawns
}
ons_Initialize();
ActivateTeamplay();
- SetLimits(autocvar_g_onslaught_point_limit, -1, -1, -1);
+ SetLimits(autocvar_g_onslaught_point_limit, autocvar_leadlimit_override, autocvar_timelimit_override, -1);
have_team_spawns = -1; // request team spawns
}
self.nextthink = time;
}
-void ons_DelayedLinkSetup()
-{SELFPARAM();
+void ons_DelayedLinkSetup(entity this)
+{
self.goalentity = find(world, targetname, self.target);
self.enemy = find(world, targetname, self.target2);
if(!self.goalentity) { objerror("can not find target\n"); }
// Use targets now (somebody make sure this is in the right place..)
setself(this.owner);
activator = this;
- WITH(entity, self, this, SUB_UseTargets());
+ WITHSELF(this, SUB_UseTargets());
setself(this);
this.owner.waslinked = this.owner.islinked;
CSQCMODEL_AUTOUPDATE(this);
}
-void ons_DelayedControlPoint_Setup()
-{SELFPARAM();
+void ons_DelayedControlPoint_Setup(entity this)
+{
onslaught_updatelinks();
// captureshield setup
onslaught_updatelinks();
}
-void ons_DelayedGeneratorSetup()
-{SELFPARAM();
+void ons_DelayedGeneratorSetup(entity this)
+{
// bot waypoints
waypoint_spawnforitem_force(self, self.origin);
self.nearestwaypointtimeout = 0; // activate waypointing again
FOREACH_CLIENT(IS_PLAYER(it), {
it.ons_roundlost = false;
it.ons_deathloc = '0 0 0';
- WITH(entity, self, it, PutClientInServer());
+ WITHSELF(it, PutClientInServer());
});
return false;
}
return false;
}
-void ons_MonsterSpawn_Delayed()
-{SELFPARAM();
+void ons_MonsterSpawn_Delayed(entity this)
+{
entity e, own = self.owner;
if(!own) { remove(self); return; }
return false;
}
-void ons_TurretSpawn_Delayed()
-{SELFPARAM();
+void ons_TurretSpawn_Delayed(entity this)
+{
entity e, own = self.owner;
if(!own) { remove(self); return; }
ScoreRules_basics_end();
}
-void ons_DelayedInit() // Do this check with a delay so we can wait for teams to be set up
+void ons_DelayedInit(entity this) // Do this check with a delay so we can wait for teams to be set up
{
ons_ScoreRules();
#include "all.qh"
#include "item/pickup.qh"
-entityclass(Inventory);
-/** Stores counts of items, the id being the index */
-class(Inventory) .int inv_items[Items_MAX];
+CLASS(Inventory, Object)
+ /** Stores counts of items, the id being the index */
+ ATTRIBARRAY(Inventory, inv_items, int, Items_MAX)
+ /** Previous state */
+ ATTRIB(Inventory, inventory, Inventory, NULL)
+ENDCLASS(Inventory)
-/** Player inventory; Inventories also have one inventory for storing the previous state */
+/** Player inventory */
.Inventory inventory;
REGISTER_NET_LINKED(ENT_CLIENT_INVENTORY)
#ifdef SVQC
void Inventory_Write(Inventory data)
{
+ if (!data) {
+ WriteInt24_t(MSG_ENTITY, 0);
+ return;
+ }
+ TC(Inventory, data);
int bits = 0;
FOREACH(Items, true, {
.int fld = inv_items[it.m_id];
#endif
#ifdef SVQC
-bool Inventory_Send(entity this, entity to, int sf)
+bool Inventory_Send(Inventory this, Client to, int sf)
{
+ TC(Inventory, this);
WriteHeader(MSG_ENTITY, ENT_CLIENT_INVENTORY);
- entity e = self.owner;
+ entity e = this.owner;
if (IS_SPEC(e)) e = e.enemy;
+ TC(Player, e);
Inventory data = e.inventory;
Inventory_Write(data);
return true;
void Inventory_new(entity e)
{
- Inventory inv = new_pure(Inventory), bak = new_pure(Inventory);
+ Inventory inv = NEW(Inventory), bak = NEW(Inventory);
inv.inventory = bak;
inv.drawonlytoclient = e;
Net_LinkEntity((inv.owner = e).inventory = inv, false, 0, Inventory_Send);
{SELFPARAM();
if ( menuitem )
{
- WITH(entity, self, menuitem, menuitem.use());
+ WITHSELF(menuitem, menuitem.use());
}
}
if ( !IS_OBSERVER(player) && autocvar_sv_minigames_observer )
{
- WITH(entity, self, player, PutObserverInServer());
+ WITHSELF(player, PutObserverInServer());
}
if ( autocvar_sv_minigames_observer == 2 )
player.team_forced = -1;
this.health = this.health - damage;
if (this.health <= 0)
- WITH(entity, self, this, W_PrepareExplosionByDamage(attacker, this.use));
+ WITHSELF(this, W_PrepareExplosionByDamage(attacker, this.use));
}
void M_Shambler_Attack_Lightning_Touch()
MUTATOR_HOOKFUNCTION(spiderweb, PlayerPhysics)
{
SELFPARAM();
- if (time >= self.spider_slowness)
+ if (time >= this.spider_slowness)
return false;
- PHYS_MAXSPEED(self) *= 0.5; // half speed while slow from spider
- PHYS_MAXAIRSPEED(self) *= 0.5;
- PHYS_AIRSPEEDLIMIT_NONQW(self) *= 0.5;
- PHYS_AIRSTRAFEACCELERATE(self) *= 0.5;
+ PHYS_MAXSPEED(this) *= 0.5; // half speed while slow from spider
+ PHYS_MAXAIRSPEED(this) *= 0.5;
+ PHYS_AIRSPEEDLIMIT_NONQW(this) *= 0.5;
+ PHYS_AIRSTRAFEACCELERATE(this) *= 0.5;
return false;
}
if(e && e.monster_loot)
{
e.noalign = true;
- WITH(entity, self, e, e.monster_loot(e));
+ WITHSELF(e, e.monster_loot(e));
e.gravity = 1;
e.movetype = MOVETYPE_TOSS;
e.reset = SUB_Remove;
void Monster_Remove(entity this)
{
+ if(IS_CLIENT(this))
+ return; // don't remove it?
+
.entity weaponentity = weaponentities[0];
if(!this) { return; }
// TODO: fix this?
activator = attacker;
other = this.enemy;
- WITH(entity, self, this, SUB_UseTargets());
+ WITHSELF(this, SUB_UseTargets());
this.target2 = this.oldtarget2; // reset to original target on death, incase we respawn
Monster_Dead(this, attacker, (this.health <= -100 || deathtype == DEATH_KILL.m_id));
#include <common/gamemodes/all.qh>
.float buff_time = _STAT(BUFF_TIME);
-void buffs_DelayedInit();
+void buffs_DelayedInit(entity this);
REGISTER_MUTATOR(buffs, cvar("g_buffs"))
{
{
entity oldother = other;
other = self;
- WITH(entity, self, it, it.touch());
+ WITHSELF(it, it.touch());
other = oldother;
}
return false;
}
-void buffs_DelayedInit()
+void buffs_DelayedInit(entity this)
{
if(autocvar_g_buffs_spawn_count > 0)
if(find(world, classname, "item_buff") == world)
{
if(frag_deathtype & HITTYPE_SECONDARY)
{
- if(!autocvar_g_instagib_blaster_keepdamage)
+ if(!autocvar_g_instagib_blaster_keepdamage || frag_attacker == frag_target)
frag_damage = frag_mirrordamage = 0;
if(frag_target != frag_attacker)
e.cnt = self.cnt;
e.team = self.team;
e.spawnfunc_checked = true;
- WITH(entity, self, e, spawnfunc_item_minst_cells(e));
+ WITHSELF(e, spawnfunc_item_minst_cells(e));
return true;
}
{
SELFPARAM();
#ifdef CSQC
- self.multijump_count = PHYS_MULTIJUMP_COUNT(self);
+ this.multijump_count = PHYS_MULTIJUMP_COUNT(this);
#endif
if(!PHYS_MULTIJUMP) { return; }
- if(IS_ONGROUND(self))
- self.multijump_count = 0;
+ if(IS_ONGROUND(this))
+ this.multijump_count = 0;
return false;
}
MUTATOR_HOOKFUNCTION(multijump, PlayerJump)
{
SELFPARAM();
- return PM_multijump_checkjump(self);
+ return PM_multijump_checkjump(this);
}
#ifdef SVQC
if(ITEM_DAMAGE_NEEDKILL(deathtype))
{
this.takedamage = DAMAGE_NO;
- WITH(entity, self, this, nade_boom());
+ WITHSELF(this, nade_boom());
return;
}
this.realowner = attacker;
if(this.health <= 0)
- WITH(entity, self, this, W_PrepareExplosionByDamage(attacker, nade_boom));
+ WITHSELF(this, W_PrepareExplosionByDamage(attacker, nade_boom));
else
nade_burn_spawn(this);
}
}
float hmg_spread = bound(WEP_CVAR(hmg, spread_min), WEP_CVAR(hmg, spread_min) + (WEP_CVAR(hmg, spread_add) * actor.misc_bulletcounter), WEP_CVAR(hmg, spread_max));
- fireBullet(w_shotorg, w_shotdir, hmg_spread, WEP_CVAR(hmg, solidpenetration), WEP_CVAR(hmg, damage), WEP_CVAR(hmg, force), WEP_HMG.m_id, 0);
+ fireBullet(actor, w_shotorg, w_shotdir, hmg_spread, WEP_CVAR(hmg, solidpenetration), WEP_CVAR(hmg, damage), WEP_CVAR(hmg, force), WEP_HMG.m_id, 0);
actor.misc_bulletcounter = actor.misc_bulletcounter + 1;
this.health = this.health - damage;
if (this.health <= 0)
- WITH(entity, self, this, W_PrepareExplosionByDamage(attacker, W_RocketPropelledChainsaw_Explode));
+ WITHSELF(this, W_PrepareExplosionByDamage(attacker, W_RocketPropelledChainsaw_Explode));
}
void W_RocketPropelledChainsaw_Think()
setorigin(wep, wep.origin + '0 0 1');
entity oldself;
oldself = self;
- WITH(entity, self, wep, builtin_droptofloor());
+ WITHSELF(wep, builtin_droptofloor());
}
wep.spawn_origin = wep.origin;
REGISTER_NET_TEMP(TE_CSQC_SVNOTICE)
#ifdef SVQC
-void sv_notice_join_think()
+void sv_notice_join_think(entity this)
{
- SELFPARAM();
int argc = tokenizebyseparator(autocvar_sv_join_notices, "|");
if (argc <= 0) return;
for (int i = 0; i < argc; ++i)
**/
#endif
-void movelib_groundalign4point(float spring_length, float spring_up, float blendrate, float _max)
-{SELFPARAM();
+void movelib_groundalign4point(entity this, float spring_length, float spring_up, float blendrate, float _max)
+{
vector a, b, c, d, e, r, push_angle, ahead, side;
push_angle.y = 0;
- r = (self.absmax + self.absmin) * 0.5 + (v_up * spring_up);
+ r = (this.absmax + this.absmin) * 0.5 + (v_up * spring_up);
e = v_up * spring_length;
// Put springs slightly inside bbox
- ahead = v_forward * (self.maxs.x * 0.8);
- side = v_right * (self.maxs.y * 0.8);
+ ahead = v_forward * (this.maxs.x * 0.8);
+ side = v_right * (this.maxs.y * 0.8);
a = r + ahead + side;
b = r + ahead - side;
c = r - ahead + side;
d = r - ahead - side;
- traceline(a, a - e,MOVE_NORMAL,self);
+ traceline(a, a - e,MOVE_NORMAL,this);
a.z = (1 - trace_fraction);
r = trace_endpos;
- traceline(b, b - e,MOVE_NORMAL,self);
+ traceline(b, b - e,MOVE_NORMAL,this);
b.z = (1 - trace_fraction);
r += trace_endpos;
- traceline(c, c - e,MOVE_NORMAL,self);
+ traceline(c, c - e,MOVE_NORMAL,this);
c.z = (1 - trace_fraction);
r += trace_endpos;
- traceline(d, d - e,MOVE_NORMAL,self);
+ traceline(d, d - e,MOVE_NORMAL,this);
d.z = (1 - trace_fraction);
r += trace_endpos;
a.x = r.z;
- r = self.origin;
+ r = this.origin;
r.z = r.z;
push_angle.x = (a.z - c.z) * _max;
push_angle.z = (b.z - a.z) * _max;
push_angle.z += (d.z - c.z) * _max;
- //self.angles_x += push_angle_x * 0.95;
- //self.angles_z += push_angle_z * 0.95;
+ //this.angles_x += push_angle_x * 0.95;
+ //this.angles_z += push_angle_z * 0.95;
- self.angles_x = ((1-blendrate) * self.angles.x) + (push_angle.x * blendrate);
- self.angles_z = ((1-blendrate) * self.angles.z) + (push_angle.z * blendrate);
+ this.angles_x = ((1-blendrate) * this.angles.x) + (push_angle.x * blendrate);
+ this.angles_z = ((1-blendrate) * this.angles.z) + (push_angle.z * blendrate);
- //a = self.origin;
- setorigin(self,r);
+ //a = this.origin;
+ setorigin(this,r);
}
**/
#endif
-void movelib_groundalign4point(float spring_length, float spring_up, float blendrate, float _max);
+void movelib_groundalign4point(entity this, float spring_length, float spring_up, float blendrate, float _max);
#endif
{
other = oth;
- WITH(entity, self, this, this.move_touch());
+ WITHSELF(this, this.move_touch());
other = oldother;
}
{
other = this;
- WITH(entity, self, oth, oth.move_touch());
+ WITHSELF(oth, oth.move_touch());
other = oldother;
}
trace_plane_dist = 0;
trace_ent = this;
- WITH(entity, self, it, it.move_touch());
+ WITHSELF(it, it.move_touch());
}
});
this.move_nextthink = 0;
this.move_time = time;
other = world;
- WITH(entity, self, this, this.move_think());
+ WITHSELF(this, this.move_think());
}
}
#ifdef SVQC
- WarpZone_PlayerPhysics_FixVAngle();
+ WarpZone_PlayerPhysics_FixVAngle(this);
#endif
float maxspeed_mod = 1;
maxspeed_mod *= PHYS_HIGHSPEED(this);
PS_B_IN_DB = db_create();
// now request the information
- uri = strcat(uri, "/player/", uri_escape(uri_escape(joiningplayer.crypto_idfp)), "/elo.txt");
+ uri = strcat(uri, "/player/", uri_escape(uri_escape(uri_escape(joiningplayer.crypto_idfp))), "/elo.txt");
LOG_TRACE("Retrieving playerstats from URL: ", uri, "\n");
url_single_fopen(
uri,
void PlayerState_detach(entity this)
{
- if (!PS(this)) return; // initial connect
- FOREACH_CLIENT(PS(it) == PS(this), { PS(it) = NULL; });
- remove(PS(this));
- this._ps = NULL;
-
- Inventory_delete(self);
+ PlayerState ps = PS(this);
+ if (!ps) return; // initial connect
+ PS(this) = NULL;
+ if (ps.m_client != this) return; // don't own state, spectator
+ FOREACH_CLIENT(PS(it) == ps, { PS(it) = NULL; });
+ remove(ps);
+
+ Inventory_delete(this);
}
void GetCvars(entity this, int);
GetCvars(this, 0); // get other cvars from player
- // TODO: xonstat elo.txt support, until then just 404s
- if (false && IS_REAL_CLIENT(this)) { PlayerStats_PlayerBasic_CheckUpdate(this); }
+ if (IS_REAL_CLIENT(this)) { PlayerStats_PlayerBasic_CheckUpdate(this); }
// TODO: fold all of these into ClientState
other.last_pickup = time;
Send_Effect(EFFECT_ITEM_PICKUP, CENTER_OR_VIEWOFS(this), '0 0 0', 1);
- _sound (other, CH_TRIGGER, (this.item_pickupsound ? this.item_pickupsound : Sound_fixpath(this.item_pickupsound_ent)), VOL_BASE, ATTEN_NORM);
+ _sound (other, (this.itemdef.instanceOfPowerup ? CH_TRIGGER_SINGLE : CH_TRIGGER), (this.item_pickupsound ? this.item_pickupsound : Sound_fixpath(this.item_pickupsound_ent)), VOL_BASE, ATTEN_NORM);
if (this.classname == "droppedweapon")
remove (this);
}
void Item_Reset_self() { SELFPARAM(); Item_Reset(this); }
-void Item_FindTeam()
-{SELFPARAM();
+void Item_FindTeam(entity this)
+{
entity e;
if(self.effects & EF_NODRAW)
void Item_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
{
if(ITEM_DAMAGE_NEEDKILL(deathtype))
- WITH(entity, self, this, RemoveItem());
+ WITHSELF(this, RemoveItem());
}
void _StartItem(entity this, entity def, float defaultrespawntime, float defaultrespawntimejitter)
this.SendFlags |= ISF_SIZE;
// note droptofloor returns false if stuck/or would fall too far
if (!this.noalign)
- WITH(entity, self, this, droptofloor());
+ WITHSELF(this, droptofloor());
waypoint_spawnforitem(this);
}
void Item_Reset(entity this);
-void Item_FindTeam();
+void Item_FindTeam(entity this);
// Savage: used for item garbage-collection
bool ItemSend(entity this, entity to, int sf);
WaypointSprite_Ping(this.sprite);
WaypointSprite_UpdateHealth(this.sprite, this.health);
}
- WITH(entity, self, this, func_breakable_colormod());
+ WITHSELF(this, func_breakable_colormod());
if(this.health <= 0)
{
if (this.health <= 0)
{
this.enemy = damage_attacker;
- WITH(entity, self, this, button_fire());
+ WITHSELF(this, button_fire());
}
}
#elif defined(CSQC)
-void conveyor_draw(entity this) { WITH(entity, self, this, conveyor_think()); }
+void conveyor_draw(entity this) { WITHSELF(this, conveyor_think()); }
void conveyor_init()
{SELFPARAM();
if (self.owner)
{
- WITH(entity, self, self.owner, door_fire());
+ WITHSELF(self.owner, door_fire());
}
}
{
this.owner.health = this.owner.max_health;
this.owner.takedamage = DAMAGE_NO; // wil be reset upon return
- WITH(entity, self, this.owner, door_use());
+ WITHSELF(this.owner, door_use());
}
}
#ifdef SVQC
void door_link();
#endif
-void LinkDoors()
-{SELFPARAM();
+void LinkDoors(entity this)
+{
entity t;
vector cmins, cmaxs;
}
#endif
-void door_init_startopen()
-{SELFPARAM();
+void door_init_startopen(entity this)
+{
SUB_SETORIGIN(self, self.pos2);
self.pos2 = self.pos1;
self.pos1 = self.origin;
this.drawmask = MASK_NORMAL;
this.use = door_use;
- LinkDoors();
+ LinkDoors(this);
if(this.spawnflags & DOOR_START_OPEN)
- door_init_startopen();
+ door_init_startopen(this);
this.move_time = time;
this.move_origin = this.origin;
this.nextthink = 0;
}
-void door_rotating_init_startopen()
-{SELFPARAM();
+void door_rotating_init_startopen(entity this)
+{
self.angles = self.movedir;
self.pos2 = '0 0 0';
self.pos1 = self.movedir;
void fd_secret_damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
{
- WITH(entity, self, this, fd_secret_use());
+ WITHSELF(this, fd_secret_use());
}
// Wait after first movement...
#ifdef SVQC
void plat_link();
-void plat_delayedinit()
+void plat_delayedinit(entity this)
{
plat_link();
plat_spawn_inside_trigger(); // the "start moving" trigger
#endif
void train_wait()
{SELFPARAM();
- WITH(entity, self, self.enemy, SUB_UseTargets());
+ WITHSELF(self.enemy, SUB_UseTargets());
self.enemy = world;
// if turning is enabled, the train will turn toward the next point while waiting
self.use = func_null; // not again
}
-void func_train_find()
-{SELFPARAM();
+void func_train_find(entity this)
+{
entity targ;
targ = find(world, targetname, self.target);
self.target = targ.target;
self.owner.velocity = (self.owner.destvec + func_vectormamamam_origin(self.owner, 0.1) - self.owner.origin) * 10;
}
-void func_vectormamamam_findtarget()
-{SELFPARAM();
+void func_vectormamamam_findtarget(entity this)
+{
if(self.target != "")
self.wp00 = find(world, targetname, self.target);
// the way this entity works makes it no use to CSQC, as it removes itself instantly
#ifdef SVQC
-void follow_init()
-{SELFPARAM();
+void follow_init(entity this)
+{
entity src, dst;
src = world;
dst = world;
}
}
-void misc_laser_init()
-{SELFPARAM();
+void misc_laser_init(entity this)
+{
if(self.target != "")
self.enemy = find(world, targetname, self.target);
}
self.count = 1;
activator = self.enemy.pusher;
- WITH(entity, self, self.enemy, SUB_UseTargets());
+ WITHSELF(self.enemy, SUB_UseTargets());
}
}
else
self.count = 0;
activator = self.enemy.pusher;
- WITH(entity, self, self.enemy, SUB_UseTargets());
+ WITHSELF(self.enemy, SUB_UseTargets());
}
}
}
void SUB_SetFade_Think ()
{SELFPARAM();
- if(self.alpha == 0)
- self.alpha = 1;
- self.SUB_THINK = SUB_SetFade_Think;
- self.SUB_NEXTTHINK = time;
- self.alpha -= frametime * self.fade_rate;
- if (self.alpha < 0.01)
- SUB_VanishOrRemove(self);
+ if(this.alpha == 0)
+ this.alpha = 1;
+ this.SUB_THINK = SUB_SetFade_Think;
+ this.SUB_NEXTTHINK = time;
+ this.alpha -= frametime * this.fade_rate;
+ if (this.alpha < 0.01)
+ SUB_VanishOrRemove(this);
else
- self.SUB_NEXTTHINK = time;
+ this.SUB_NEXTTHINK = time;
}
/*
void SUB_CalcMoveEnt (entity ent, vector tdest, float tspeedtype, float tspeed, void() func)
{SELFPARAM();
- WITH(entity, self, ent, SUB_CalcMove(tdest, tspeedtype, tspeed, func));
+ WITHSELF(ent, SUB_CalcMove(tdest, tspeedtype, tspeed, func));
}
/*
void SUB_CalcAngleMoveEnt (entity ent, vector destangle, float tspeedtype, float tspeed, void() func)
{SELFPARAM();
- WITH(entity, self, ent, SUB_CalcAngleMove (destangle, tspeedtype, tspeed, func));
+ WITHSELF(ent, SUB_CalcAngleMove (destangle, tspeedtype, tspeed, func));
}
}
void target_music_kill()
{
- SELFPARAM();
- for(self = world; (self = find(self, classname, "target_music")); )
- {
- self.volume = 0;
- if(self.targetname == "")
- target_music_sendto(MSG_ALL, 1);
- else
- target_music_sendto(MSG_ALL, 0);
- }
+ FOREACH_ENTITY_CLASS("target_music", true, {
+ it.volume = 0;
+ if (it.targetname == "")
+ WITHSELF(it, target_music_sendto(MSG_ALL, 1));
+ else
+ WITHSELF(it, target_music_sendto(MSG_ALL, 0));
+ });
}
void target_music_use()
{
oldactivator = activator;
activator = act;
- WITH(entity, self, e, e.target_spawn_spawnfunc(e));
+ WITHSELF(e, e.target_spawn_spawnfunc(e));
activator = oldactivator;
// We called an external function, so we have to re-tokenize msg.
}
}
-void target_spawn_spawnfirst()
-{SELFPARAM();
+void target_spawn_spawnfirst(entity this)
+{
activator = self.target_spawn_activator;
if(self.spawnflags & 2)
target_spawn_use();
return e;
}
-void teleport_findtarget()
+void teleport_findtarget(entity this)
{
- SELFPARAM();
int n = 0;
entity e;
for(e = world; (e = find(e, targetname, self.target)); )
void Teleport_Touch ();
-void teleport_findtarget();
+void teleport_findtarget(entity this);
entity Teleport_Find(vector mi, vector ma);
#ifdef SVQC
-void gamestart_use()
-{SELFPARAM();
+void gamestart_use(entity this)
+{
activator = self;
SUB_UseTargets();
remove(self);
void self_spawnfunc_trigger_gamestart();
spawnfunc(trigger_gamestart)
{
- this.use = gamestart_use;
+ setuse(this, gamestart_use);
this.reset2 = self_spawnfunc_trigger_gamestart;
if(this.wait)
#elif defined(CSQC)
NET_HANDLE(ENT_CLIENT_TRIGGER_IMPULSE, bool isnew)
{
- self.spawnflags = ReadInt24_t();
- self.radius = ReadCoord();
- self.strength = ReadCoord();
- self.falloff = ReadByte();
- self.active = ReadByte();
+ this.spawnflags = ReadInt24_t();
+ this.radius = ReadCoord();
+ this.strength = ReadCoord();
+ this.falloff = ReadByte();
+ this.active = ReadByte();
trigger_common_read(true);
return = true;
- self.classname = "trigger_impulse";
- self.solid = SOLID_TRIGGER;
- self.entremove = trigger_remove_generic;
- //self.draw = trigger_draw_generic;
- self.drawmask = MASK_NORMAL;
- self.move_time = time;
+ this.classname = "trigger_impulse";
+ this.solid = SOLID_TRIGGER;
+ this.entremove = trigger_remove_generic;
+ //this.draw = trigger_draw_generic;
+ this.drawmask = MASK_NORMAL;
+ this.move_time = time;
- if(self.radius) { self.move_touch = trigger_impulse_touch3; }
- else if(self.target) { self.move_touch = trigger_impulse_touch1; }
- else { self.move_touch = trigger_impulse_touch2; }
+ if(this.radius) { this.move_touch = trigger_impulse_touch3; }
+ else if(this.target) { this.move_touch = trigger_impulse_touch1; }
+ else { this.move_touch = trigger_impulse_touch2; }
}
#endif
if(this.enemy.target)
{
activator = other;
- WITH(entity, self, this.enemy, SUB_UseTargets());
+ WITHSELF(this.enemy, SUB_UseTargets());
}
if (other.flags & FL_PROJECTILE)
#ifdef SVQC
void trigger_push_link();
-void trigger_push_updatelink();
+void trigger_push_updatelink(entity this);
#endif
-void trigger_push_findtarget()
-{SELFPARAM();
+void trigger_push_findtarget(entity this)
+{
entity t;
vector org;
// first calculate a typical start point for the jump
- org = (self.absmin + self.absmax) * 0.5;
- org_z = self.absmax.z - STAT(PL_MIN, NULL).z;
+ org = (this.absmin + this.absmax) * 0.5;
+ org_z = this.absmax.z - STAT(PL_MIN, NULL).z;
- if (self.target)
+ if (this.target)
{
float n = 0;
- for(t = world; (t = find(t, targetname, self.target)); )
+ for(t = world; (t = find(t, targetname, this.target)); )
{
++n;
#ifdef SVQC
entity e = spawn();
setorigin(e, org);
setsize(e, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL));
- e.velocity = trigger_push_calculatevelocity(org, t, self.height);
+ e.velocity = trigger_push_calculatevelocity(org, t, this.height);
tracetoss(e, e);
if(e.movetype == MOVETYPE_NONE)
- waypoint_spawnforteleporter(self, trace_endpos, vlen(trace_endpos - org) / vlen(e.velocity));
+ waypoint_spawnforteleporter(this, trace_endpos, vlen(trace_endpos - org) / vlen(e.velocity));
remove(e);
#endif
}
else if(n == 1)
{
// exactly one dest - bots love that
- self.enemy = find(world, targetname, self.target);
+ this.enemy = find(world, targetname, this.target);
}
else
{
// have to use random selection every single time
- self.enemy = world;
+ this.enemy = world;
}
}
#ifdef SVQC
entity e = spawn();
setorigin(e, org);
setsize(e, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL));
- e.velocity = self.movedir;
+ e.velocity = this.movedir;
tracetoss(e, e);
- waypoint_spawnforteleporter(self, trace_endpos, vlen(trace_endpos - org) / vlen(e.velocity));
+ waypoint_spawnforteleporter(this, trace_endpos, vlen(trace_endpos - org) / vlen(e.velocity));
remove(e);
}
trigger_push_link();
- defer(self, 0.1, trigger_push_updatelink);
+ defer(this, 0.1, trigger_push_updatelink);
#endif
}
{
WriteHeader(MSG_ENTITY, ENT_CLIENT_TRIGGER_PUSH);
- WriteByte(MSG_ENTITY, self.team);
- WriteInt24_t(MSG_ENTITY, self.spawnflags);
- WriteByte(MSG_ENTITY, self.active);
- WriteCoord(MSG_ENTITY, self.height);
+ WriteByte(MSG_ENTITY, this.team);
+ WriteInt24_t(MSG_ENTITY, this.spawnflags);
+ WriteByte(MSG_ENTITY, this.active);
+ WriteCoord(MSG_ENTITY, this.height);
- trigger_common_write(self, true);
+ trigger_common_write(this, true);
return true;
}
-void trigger_push_updatelink()
-{SELFPARAM();
- self.SendFlags |= 1;
+void trigger_push_updatelink(entity this)
+{
+ this.SendFlags |= 1;
}
void trigger_push_link()
{
SELFPARAM();
- trigger_link(self, trigger_push_send);
+ trigger_link(this, trigger_push_send);
}
/*
*/
spawnfunc(trigger_push)
{
- SetMovedir(self);
+ SetMovedir(this);
- trigger_init(self);
+ trigger_init(this);
- self.active = ACTIVE_ACTIVE;
- self.use = trigger_push_use;
- self.touch = trigger_push_touch;
+ this.active = ACTIVE_ACTIVE;
+ this.use = trigger_push_use;
+ this.touch = trigger_push_touch;
// normal push setup
- if (!self.speed)
- self.speed = 1000;
- self.movedir = self.movedir * self.speed * 10;
+ if (!this.speed)
+ this.speed = 1000;
+ this.movedir = this.movedir * this.speed * 10;
- if (!self.noise)
- self.noise = "misc/jumppad.wav";
- precache_sound (self.noise);
+ if (!this.noise)
+ this.noise = "misc/jumppad.wav";
+ precache_sound (this.noise);
// this must be called to spawn the teleport waypoints for bots
- InitializeEntity(self, trigger_push_findtarget, INITPRIO_FINDTARGET);
+ InitializeEntity(this, trigger_push_findtarget, INITPRIO_FINDTARGET);
}
{
WriteHeader(MSG_ENTITY, ENT_CLIENT_TARGET_PUSH);
- WriteByte(MSG_ENTITY, self.cnt);
- WriteString(MSG_ENTITY, self.targetname);
- WriteCoord(MSG_ENTITY, self.origin_x);
- WriteCoord(MSG_ENTITY, self.origin_y);
- WriteCoord(MSG_ENTITY, self.origin_z);
+ WriteByte(MSG_ENTITY, this.cnt);
+ WriteString(MSG_ENTITY, this.targetname);
+ WriteCoord(MSG_ENTITY, this.origin_x);
+ WriteCoord(MSG_ENTITY, this.origin_y);
+ WriteCoord(MSG_ENTITY, this.origin_z);
- WriteAngle(MSG_ENTITY, self.angles_x);
- WriteAngle(MSG_ENTITY, self.angles_y);
- WriteAngle(MSG_ENTITY, self.angles_z);
+ WriteAngle(MSG_ENTITY, this.angles_x);
+ WriteAngle(MSG_ENTITY, this.angles_y);
+ WriteAngle(MSG_ENTITY, this.angles_z);
return true;
}
{
make_pure(this);
- self.classname = "jumppad";
- int mytm = ReadByte(); if(mytm) { self.team = mytm - 1; }
- self.spawnflags = ReadInt24_t();
- self.active = ReadByte();
- self.height = ReadCoord();
+ this.classname = "jumppad";
+ int mytm = ReadByte(); if(mytm) { this.team = mytm - 1; }
+ this.spawnflags = ReadInt24_t();
+ this.active = ReadByte();
+ this.height = ReadCoord();
trigger_common_read(true);
- self.entremove = trigger_remove_generic;
- self.solid = SOLID_TRIGGER;
- //self.draw = trigger_draw_generic;
- self.move_touch = trigger_push_touch;
- self.drawmask = MASK_NORMAL;
- self.move_time = time;
- defer(self, 0.25, trigger_push_findtarget);
+ this.entremove = trigger_remove_generic;
+ this.solid = SOLID_TRIGGER;
+ //this.draw = trigger_draw_generic;
+ this.move_touch = trigger_push_touch;
+ this.drawmask = MASK_NORMAL;
+ this.move_time = time;
+ defer(this, 0.25, trigger_push_findtarget);
return true;
}
NET_HANDLE(ENT_CLIENT_TARGET_PUSH, bool isnew)
{
- self.classname = "push_target";
- self.cnt = ReadByte();
- self.targetname = strzone(ReadString());
- self.origin_x = ReadCoord();
- self.origin_y = ReadCoord();
- self.origin_z = ReadCoord();
+ this.classname = "push_target";
+ this.cnt = ReadByte();
+ this.targetname = strzone(ReadString());
+ this.origin_x = ReadCoord();
+ this.origin_y = ReadCoord();
+ this.origin_z = ReadCoord();
- self.angles_x = ReadAngle();
- self.angles_y = ReadAngle();
- self.angles_z = ReadAngle();
+ this.angles_x = ReadAngle();
+ this.angles_y = ReadAngle();
+ this.angles_z = ReadAngle();
return = true;
- setorigin(self, self.origin);
+ setorigin(this, this.origin);
- self.drawmask = MASK_NORMAL;
- self.entremove = target_push_remove;
+ this.drawmask = MASK_NORMAL;
+ this.entremove = target_push_remove;
}
#endif
void trigger_push_touch();
.vector dest;
-void trigger_push_findtarget();
+void trigger_push_findtarget(entity this);
/*
* ENTITY PARAMETERS:
{
this.enemy = attacker;
this.goalentity = inflictor;
- WITH(entity, self, this, multi_trigger());
+ WITHSELF(this, multi_trigger());
}
}
void secrets_setstatus()
{SELFPARAM();
- self.stat_secrets_total = secrets_total;
- self.stat_secrets_found = secrets_found;
+ this.stat_secrets_total = secrets_total;
+ this.stat_secrets_found = secrets_found;
}
/**
SUB_UseTargets();
if (!self.target) self.target = s;
- WITH(entity, self, e, SUB_UseTargets());
+ WITHSELF(e, SUB_UseTargets());
#endif
}
return true;
}
-void viewloc_init()
-{SELFPARAM();
+void viewloc_init(entity this)
+{
entity e;
for(e = world; (e = find(e, targetname, self.target)); )
if(e.classname == "target_viewlocation_start")
void DelayThink()
{SELFPARAM();
- activator = self.enemy;
+ activator = this.enemy;
SUB_UseTargets ();
- remove(self);
+ remove(this);
}
void FixSize(entity e)
void trigger_init(entity this)
{
string m = this.model;
- WITH(entity, self, this, WarpZoneLib_ExactTrigger_Init());
+ WITHSELF(this, WarpZoneLib_ExactTrigger_Init());
if(m != "")
{
precache_model(m);
void trigger_common_read(bool withtarget)
{SELFPARAM();
int f = ReadByte();
- self.warpzone_isboxy = (f & 1);
+ this.warpzone_isboxy = (f & 1);
if(withtarget)
{
- if(self.target) { strunzone(self.target); }
- self.target = strzone(ReadString());
- if(self.target2) { strunzone(self.target2); }
- self.target2 = strzone(ReadString());
- if(self.target3) { strunzone(self.target3); }
- self.target3 = strzone(ReadString());
- if(self.target4) { strunzone(self.target4); }
- self.target4 = strzone(ReadString());
- if(self.targetname) { strunzone(self.targetname); }
- self.targetname = strzone(ReadString());
- if(self.killtarget) { strunzone(self.killtarget); }
- self.killtarget = strzone(ReadString());
+ if(this.target) { strunzone(this.target); }
+ this.target = strzone(ReadString());
+ if(this.target2) { strunzone(this.target2); }
+ this.target2 = strzone(ReadString());
+ if(this.target3) { strunzone(this.target3); }
+ this.target3 = strzone(ReadString());
+ if(this.target4) { strunzone(this.target4); }
+ this.target4 = strzone(ReadString());
+ if(this.targetname) { strunzone(this.targetname); }
+ this.targetname = strzone(ReadString());
+ if(this.killtarget) { strunzone(this.killtarget); }
+ this.killtarget = strzone(ReadString());
}
if(f & 4)
{
- self.origin_x = ReadCoord();
- self.origin_y = ReadCoord();
- self.origin_z = ReadCoord();
+ this.origin_x = ReadCoord();
+ this.origin_y = ReadCoord();
+ this.origin_z = ReadCoord();
}
else
- self.origin = '0 0 0';
- setorigin(self, self.origin);
-
- self.modelindex = ReadShort();
- self.mins_x = ReadCoord();
- self.mins_y = ReadCoord();
- self.mins_z = ReadCoord();
- self.maxs_x = ReadCoord();
- self.maxs_y = ReadCoord();
- self.maxs_z = ReadCoord();
- self.scale = ReadByte() / 16;
- setsize(self, self.mins, self.maxs);
-
- self.movedir_x = ReadCoord();
- self.movedir_y = ReadCoord();
- self.movedir_z = ReadCoord();
-
- self.angles_x = ReadCoord();
- self.angles_y = ReadCoord();
- self.angles_z = ReadCoord();
+ this.origin = '0 0 0';
+ setorigin(this, this.origin);
+
+ this.modelindex = ReadShort();
+ this.mins_x = ReadCoord();
+ this.mins_y = ReadCoord();
+ this.mins_z = ReadCoord();
+ this.maxs_x = ReadCoord();
+ this.maxs_y = ReadCoord();
+ this.maxs_z = ReadCoord();
+ this.scale = ReadByte() / 16;
+ setsize(this, this.mins, this.maxs);
+
+ this.movedir_x = ReadCoord();
+ this.movedir_y = ReadCoord();
+ this.movedir_z = ReadCoord();
+
+ this.angles_x = ReadCoord();
+ this.angles_y = ReadCoord();
+ this.angles_z = ReadCoord();
}
void trigger_remove_generic(entity this)
//
// check for a delay
//
- if (self.delay)
+ if (this.delay)
{
// create a temp object to fire at a later time
t = new(DelayedUse);
- t.nextthink = time + self.delay;
+ t.nextthink = time + this.delay;
t.think = DelayThink;
t.enemy = activator;
- t.message = self.message;
- t.killtarget = self.killtarget;
- t.target = self.target;
- t.target2 = self.target2;
- t.target3 = self.target3;
- t.target4 = self.target4;
+ t.message = this.message;
+ t.killtarget = this.killtarget;
+ t.target = this.target;
+ t.target2 = this.target2;
+ t.target3 = this.target3;
+ t.target4 = this.target4;
return;
}
// print the message
//
#ifdef SVQC
- if(self)
- if(IS_PLAYER(activator) && self.message != "")
+ if(this)
+ if(IS_PLAYER(activator) && this.message != "")
if(IS_REAL_CLIENT(activator))
{
- centerprint(activator, self.message);
- if (self.noise == "")
+ centerprint(activator, this.message);
+ if (this.noise == "")
play2(activator, SND(TALK));
}
//
// kill the killtagets
//
- s = self.killtarget;
+ s = this.killtarget;
if (s != "")
{
for(t = world; (t = find(t, targetname, s)); )
{
// Flag to set func_clientwall state
// 1 == deactivate, 2 == activate, 0 == do nothing
- float aw_flag = self.antiwall_flag;
+ float aw_flag = this.antiwall_flag;
for(t = world; (t = find(t, targetname, s)); )
if(t.use)
{
if(WarpZoneLib_BoxTouchesBrush(emin, emax, this, e)) // accurate
{
other = e;
- WITH(entity, self, this, touchfunc());
+ WITHSELF(this, touchfunc());
}
}
}
this.health -= damage;
//this.realowner = attacker; // Dont change realowner, it does not make much sense for turrets
if(this.health <= 0)
- WITH(entity, self, this, W_PrepareExplosionByDamage(this.owner, turret_projectile_explode));
+ WITHSELF(this, W_PrepareExplosionByDamage(this.owner, turret_projectile_explode));
}
entity turret_projectile(Sound _snd, float _size, float _health, float _death, float _proj_type, float _cull, float _cli_anim)
actor.tur_head = actor;
weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, 0, w_ready);
}
- fireBullet (actor.tur_shotorg, actor.tur_shotdir_updated, actor.shot_spread, 0, actor.shot_dmg, actor.shot_force, DEATH_TURRET_MACHINEGUN.m_id, 0);
+ fireBullet (actor, actor.tur_shotorg, actor.tur_shotdir_updated, actor.shot_spread, 0, actor.shot_dmg, actor.shot_force, DEATH_TURRET_MACHINEGUN.m_id, 0);
W_MachineGun_MuzzleFlash();
setattachment(actor.muzzle_flash, actor.tur_head, "tag_fire");
}
return turret_firecheck();
}
-void walker_melee_do_dmg()
-{SELFPARAM();
+void walker_melee_do_dmg(entity this)
+{
vector where;
entity e;
}
}
-void walker_setnoanim()
-{SELFPARAM();
+void walker_setnoanim(entity this)
+{
turrets_setframe(ANIM_NO, false);
self.animflag = self.frame;
}
this.velocity = this.velocity + vforce;
if (this.health <= 0)
- WITH(entity, self, this, W_PrepareExplosionByDamage(this.owner, walker_rocket_explode));
+ WITHSELF(this, W_PrepareExplosionByDamage(this.owner, walker_rocket_explode));
}
#define WALKER_ROCKET_MOVE movelib_move_simple(self, newdir, (autocvar_g_turrets_unit_walker_rocket_speed), (autocvar_g_turrets_unit_walker_rocket_turnrate)); UpdateCSQCProjectile(self)
return;
fixedmakevectors(this.angles);
- movelib_groundalign4point(300, 100, 0.25, 45);
+ movelib_groundalign4point(this, 300, 100, 0.25, 45);
setorigin(this, this.origin + this.velocity * dt);
this.tur_head.angles += dt * this.tur_head.move_avelocity;
this.angles_y = this.move_angles_y;
weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(electro, animtime), w_ready);
}
sound (actor, CH_WEAPON_A, SND_UZI_FIRE, VOL_BASE, ATTEN_NORM);
- fireBullet (actor.tur_shotorg, actor.tur_shotdir_updated, actor.shot_spread, 0, actor.shot_dmg, actor.shot_force, DEATH_TURRET_WALK_GUN.m_id, 0);
+ fireBullet (actor, actor.tur_shotorg, actor.tur_shotdir_updated, actor.shot_spread, 0, actor.shot_dmg, actor.shot_force, DEATH_TURRET_WALK_GUN.m_id, 0);
Send_Effect(EFFECT_BLASTER_MUZZLEFLASH, actor.tur_shotorg, actor.tur_shotdir_updated * 1000, 1);
}
}
}
#endif
-#ifdef SVQC
-void dedicated_print(string input) // print(), but only print if the server is not local
-{
- if(server_is_dedicated) { LOG_INFO(input); }
-}
-#endif
-
#ifndef MENUQC
Notification Announcer_PickNumber(int type, int num)
{
float median(float a, float b, float c);
// converts a number to a string with the indicated number of decimals
-// works for up to 10 decimals!
string ftos_decimals(float number, float decimals);
+string ftos_mindecimals(float number);
bool fexists(string f);
vector animfixfps(entity e, vector a, vector b);
#endif
-#ifdef SVQC
-void dedicated_print(string input);
-#endif
-
#ifndef MENUQC
const float CNT_NORMAL = 1;
const float CNT_GAMESTART = 2;
self.nextthink = time + 0.1;
}
-entity vehicle_tossgib(entity _template, vector _vel, string _tag, bool _burn, bool _explode, float _maxtime, vector _rot)
-{SELFPARAM();
+entity vehicle_tossgib(entity this, entity _template, vector _vel, string _tag, bool _burn, bool _explode, float _maxtime, vector _rot)
+{
entity _gib = spawn();
_setmodel(_gib, _template.model);
- vector org = gettaginfo(self, gettagindex(self, _tag));
+ vector org = gettaginfo(this, gettagindex(this, _tag));
setorigin(_gib, org);
_gib.velocity = _vel;
_gib.movetype = MOVETYPE_TOSS;
bool vehicle_addplayerslot( entity _owner,
entity _slot,
int _hud,
- string _hud_model,
+ Model _hud_model,
bool(entity) _framefunc,
- void(bool) _exitfunc, float() _enterfunc)
+ void(bool) _exitfunc, float(entity, entity) _enterfunc)
{
if(!(_owner.vehicle_flags & VHF_MULTISLOT))
_owner.vehicle_flags |= VHF_MULTISLOT;
_slot.vehicle_hudmodel.viewmodelforclient = _slot;
_slot.vehicle_viewport.effects = (EF_ADDITIVE | EF_DOUBLESIDED | EF_FULLBRIGHT | EF_NODEPTHTEST | EF_NOGUNBOB | EF_NOSHADOW | EF_LOWPRECISION | EF_SELECTABLE | EF_TELEPORT_BIT);
- _setmodel(_slot.vehicle_hudmodel, _hud_model);
+ setmodel(_slot.vehicle_hudmodel, _hud_model);
setmodel(_slot.vehicle_viewport, MDL_Null);
setattachment(_slot.vehicle_hudmodel, _slot, "");
return vtag;
}
-void vehicles_reset_colors()
-{SELFPARAM();
- entity e;
- float _effects = 0, _colormap;
- vector _glowmod, _colormod;
-
+void vehicles_reset_colors(entity this)
+{
+ int eff = 0, cmap;
+ const vector cmod = '0 0 0';
+ if(this.team && teamplay)
+ cmap = 1024 + (this.team - 1) * 17;
+ else
+ cmap = 1024;
if(autocvar_g_nodepthtestplayers)
- _effects |= EF_NODEPTHTEST;
-
+ eff |= EF_NODEPTHTEST;
if(autocvar_g_fullbrightplayers)
- _effects |= EF_FULLBRIGHT;
-
- if(self.team)
- _colormap = 1024 + (self.team - 1) * 17;
- else
- _colormap = 1024;
-
- _glowmod = '0 0 0';
- _colormod = '0 0 0';
+ eff |= EF_FULLBRIGHT;
// Find all ents attacked to main model and setup effects, colormod etc.
- e = findchainentity(tag_entity, self);
- while(e)
+ FOREACH_ENTITY_ENT(tag_entity, this,
{
- if(e != self.vehicle_shieldent)
+ if(it != this.vehicle_shieldent)
{
- e.effects = _effects; // | EF_LOWPRECISION;
- e.colormod = _colormod;
- e.colormap = _colormap;
- e.alpha = 1;
+ it.effects = eff;
+ it.colormod = cmod;
+ it.colormap = cmap;
+ it.alpha = 1;
}
- e = e.chain;
- }
+ });
+
// Also check head tags
- e = findchainentity(tag_entity, self.tur_head);
- while(e)
+ FOREACH_ENTITY_ENT(tag_entity, this.tur_head,
{
- if(e != self.vehicle_shieldent)
+ if(it != this.vehicle_shieldent)
{
- e.effects = _effects; // | EF_LOWPRECISION;
- e.colormod = _colormod;
- e.colormap = _colormap;
- e.alpha = 1;
+ it.effects = eff;
+ it.colormod = cmod;
+ it.colormap = cmap;
+ it.alpha = 1;
}
- e = e.chain;
- }
+ });
- self.vehicle_hudmodel.effects = self.effects = _effects; // | EF_LOWPRECISION;
- self.vehicle_hudmodel.colormod = self.colormod = _colormod;
- self.vehicle_hudmodel.colormap = self.colormap = _colormap;
- self.vehicle_viewport.effects = (EF_ADDITIVE | EF_DOUBLESIDED | EF_FULLBRIGHT | EF_NODEPTHTEST | EF_NOGUNBOB | EF_NOSHADOW | EF_LOWPRECISION | EF_SELECTABLE | EF_TELEPORT_BIT);
+ this.vehicle_hudmodel.effects = this.effects = eff; // | EF_LOWPRECISION;
+ this.vehicle_hudmodel.colormod = this.colormod = cmod;
+ this.vehicle_hudmodel.colormap = this.colormap = cmap;
+ this.vehicle_viewport.effects = (EF_ADDITIVE | EF_DOUBLESIDED | EF_FULLBRIGHT | EF_NODEPTHTEST | EF_NOGUNBOB | EF_NOSHADOW | EF_LOWPRECISION | EF_SELECTABLE | EF_TELEPORT_BIT);
- self.alpha = 1;
- self.avelocity = '0 0 0';
- self.velocity = '0 0 0';
- self.effects = _effects;
+ this.alpha = 1;
+ this.avelocity = '0 0 0';
+ this.velocity = '0 0 0';
+ this.effects = eff;
}
void vehicles_clearreturn(entity veh)
else
{
vehicles_setreturn(self);
- vehicles_reset_colors();
+ vehicles_reset_colors(self);
}
}
}
{
if(this.owner)
if(this.vehicle_flags & VHF_DEATHEJECT)
- WITH(entity, self, this, vehicles_exit(VHEF_EJECT));
+ WITHSELF(this, vehicles_exit(VHEF_EJECT));
else
- WITH(entity, self, this, vehicles_exit(VHEF_RELEASE));
+ WITHSELF(this, vehicles_exit(VHEF_RELEASE));
antilag_clear(this, this);
return false;
}
-void vehicles_impact(float _minspeed, float _speedfac, float _maxpain)
-{SELFPARAM();
+void vehicles_impact(entity this, float _minspeed, float _speedfac, float _maxpain)
+{
if (trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT)
return;
- if(self.play_time < time)
+ if(this.play_time < time)
{
- float wc = vlen(self.velocity - self.oldvelocity);
- //dprint("oldvel: ", vtos(self.oldvelocity), "\n");
- //dprint("vel: ", vtos(self.velocity), "\n");
+ float wc = vlen(this.velocity - this.oldvelocity);
+ //dprint("oldvel: ", vtos(this.oldvelocity), "\n");
+ //dprint("vel: ", vtos(this.velocity), "\n");
if(_minspeed < wc)
{
float take = min(_speedfac * wc, _maxpain);
- Damage (self, world, world, take, DEATH_FALL.m_id, self.origin, '0 0 0');
- self.play_time = time + 0.25;
+ Damage (this, world, world, take, DEATH_FALL.m_id, this.origin, '0 0 0');
+ this.play_time = time + 0.25;
//dprint("wc: ", ftos(wc), "\n");
//dprint("take: ", ftos(take), "\n");
_vehicle.vehicle_exit(eject);
vehicles_setreturn(_vehicle);
- vehicles_reset_colors();
+ vehicles_reset_colors(_vehicle);
_vehicle.owner = world;
CSQCMODEL_AUTOINIT(self);
}
void vehicles_enter(entity pl, entity veh)
-{SELFPARAM();
+{
+ SELFPARAM();
+ entity oldself = self;
+
// Remove this when bots know how to use vehicles
if((IS_BOT_CLIENT(pl) && !autocvar_g_vehicles_allow_bots))
return;
if(veh.vehicle_flags & VHF_MULTISLOT)
if(veh.owner)
{
- setself(veh);
- other = pl; // TODO: fix
-
if(!veh.gunner1)
if(time >= veh.gun1.phase)
if(veh.gun1.vehicle_enter)
- if(veh.gun1.vehicle_enter())
- {
- setself(this);
+ if(veh.gun1.vehicle_enter(veh, pl))
return;
- }
if(!veh.gunner2)
if(time >= veh.gun2.phase)
if(veh.gun2.vehicle_enter)
- if(veh.gun2.vehicle_enter())
- {
- setself(this);
+ if(veh.gun2.vehicle_enter(veh, pl))
return;
- }
-
- setself(this);
}
if(teamplay)
CSQCModel_UnlinkEntity(veh);
Vehicle info = Vehicles_from(veh.vehicleid);
info.vr_enter(info, veh);
- setself(this);
+ setself(oldself);
antilag_clear(pl, CS(pl));
}
FOREACH_CLIENT(IS_PLAYER(it) && it.hook.aiment == self, RemoveGrapplingHook(it));
- vehicles_reset_colors();
+ vehicles_reset_colors(self);
Vehicle info = Vehicles_from(self.vehicleid);
info.vr_spawn(info, self);
CSQCMODEL_AUTOINIT(self);
}
-bool vehicle_initialize(entity veh, bool nodrop)
-{SELFPARAM();
+bool vehicle_initialize(entity this, Vehicle info, bool nodrop)
+{
if(!autocvar_g_vehicles)
return false;
- if(!veh.vehicleid)
+ if(!info.vehicleid)
return false;
- if(!veh.tur_head) {
- Vehicle info = Vehicles_from(veh.vehicleid);
+ if(!this.tur_head)
info.vr_precache(info);
- }
- if(self.targetname && self.targetname != "")
+ if(this.targetname && this.targetname != "")
{
- self.vehicle_controller = find(world, target, self.targetname);
- if(!self.vehicle_controller)
+ this.vehicle_controller = find(world, target, this.targetname);
+ if(!this.vehicle_controller)
{
bprint("^1WARNING: ^7Vehicle with invalid .targetname\n");
- self.active = ACTIVE_ACTIVE;
+ this.active = ACTIVE_ACTIVE;
}
else
{
- self.team = self.vehicle_controller.team;
- self.use = vehicle_use;
+ this.team = this.vehicle_controller.team;
+ this.use = vehicle_use;
if(teamplay)
{
- if(self.vehicle_controller.team == 0)
- self.active = ACTIVE_NOT;
+ if(this.vehicle_controller.team == 0)
+ this.active = ACTIVE_NOT;
else
- self.active = ACTIVE_ACTIVE;
+ this.active = ACTIVE_ACTIVE;
}
}
}
- else { self.active = ACTIVE_ACTIVE; }
+ else { this.active = ACTIVE_ACTIVE; }
- if(self.team && (!teamplay || !autocvar_g_vehicles_teams))
- self.team = 0;
+ if(this.team && (!teamplay || !autocvar_g_vehicles_teams))
+ this.team = 0;
- if(self.mdl == "" || !self.mdl)
- _setmodel(self, veh.model);
+ if(this.mdl == "" || !this.mdl)
+ _setmodel(this, info.model);
else
- _setmodel(self, self.mdl);
-
- self.vehicle_flags |= VHF_ISVEHICLE;
-
- self.vehicle_viewport = new(vehicle_viewport);
- self.vehicle_hudmodel = new(vehicle_hudmodel);
- self.tur_head = new(tur_head);
- self.tur_head.owner = self;
- self.takedamage = DAMAGE_NO;
- self.bot_attack = true;
- self.iscreature = true;
- self.teleportable = false; // no teleporting for vehicles, too buggy
- self.damagedbycontents = true;
- self.vehicleid = veh.vehicleid;
- self.PlayerPhysplug = veh.PlayerPhysplug;
- self.event_damage = func_null;
- self.touch = vehicles_touch;
- self.think = vehicles_spawn;
- self.nextthink = time;
- self.effects = EF_NODRAW;
- self.dphitcontentsmask = DPCONTENTS_BODY | DPCONTENTS_SOLID;
+ _setmodel(this, this.mdl);
+
+ this.vehicle_flags |= VHF_ISVEHICLE;
+
+ this.vehicle_viewport = new(vehicle_viewport);
+ this.vehicle_hudmodel = new(vehicle_hudmodel);
+ this.tur_head = new(tur_head);
+ this.tur_head.owner = this;
+ this.takedamage = DAMAGE_NO;
+ this.bot_attack = true;
+ this.iscreature = true;
+ this.teleportable = false; // no teleporting for vehicles, too buggy
+ this.damagedbycontents = true;
+ this.vehicleid = info.vehicleid;
+ this.PlayerPhysplug = info.PlayerPhysplug;
+ this.event_damage = func_null;
+ this.touch = vehicles_touch;
+ this.think = vehicles_spawn;
+ this.nextthink = time;
+ this.effects = EF_NODRAW;
+ this.dphitcontentsmask = DPCONTENTS_BODY | DPCONTENTS_SOLID;
if(autocvar_g_playerclip_collisions)
- self.dphitcontentsmask |= DPCONTENTS_PLAYERCLIP;
+ this.dphitcontentsmask |= DPCONTENTS_PLAYERCLIP;
if(autocvar_g_nodepthtestplayers)
- self.effects |= EF_NODEPTHTEST;
+ this.effects |= EF_NODEPTHTEST;
if(autocvar_g_fullbrightplayers)
- self.effects |= EF_FULLBRIGHT;
+ this.effects |= EF_FULLBRIGHT;
- _setmodel(self.vehicle_hudmodel, veh.hud_model);
- setmodel(self.vehicle_viewport, MDL_Null);
+ _setmodel(this.vehicle_hudmodel, info.hud_model);
+ setmodel(this.vehicle_viewport, MDL_Null);
- if(veh.head_model != "")
+ if(info.head_model != "")
{
- _setmodel(self.tur_head, veh.head_model);
- setattachment(self.tur_head, self, veh.tag_head);
- setattachment(self.vehicle_hudmodel, self.tur_head, veh.tag_hud);
- setattachment(self.vehicle_viewport, self.vehicle_hudmodel, veh.tag_view);
+ _setmodel(this.tur_head, info.head_model);
+ setattachment(this.tur_head, this, info.tag_head);
+ setattachment(this.vehicle_hudmodel, this.tur_head, info.tag_hud);
+ setattachment(this.vehicle_viewport, this.vehicle_hudmodel, info.tag_view);
}
else
{
- setattachment(self.tur_head, self, "");
- setattachment(self.vehicle_hudmodel, self, veh.tag_hud);
- setattachment(self.vehicle_viewport, self.vehicle_hudmodel, veh.tag_view);
+ setattachment(this.tur_head, this, "");
+ setattachment(this.vehicle_hudmodel, this, info.tag_hud);
+ setattachment(this.vehicle_viewport, this.vehicle_hudmodel, info.tag_view);
}
- setsize(self, veh.mins, veh.maxs);
+ setsize(this, info.mins, info.maxs);
if(!nodrop)
{
- setorigin(self, self.origin);
- tracebox(self.origin + '0 0 100', veh.mins, veh.maxs, self.origin - '0 0 10000', MOVE_WORLDONLY, self);
- setorigin(self, trace_endpos);
+ setorigin(this, this.origin);
+ tracebox(this.origin + '0 0 100', info.mins, info.maxs, this.origin - '0 0 10000', MOVE_WORLDONLY, this);
+ setorigin(this, trace_endpos);
}
- self.pos1 = self.origin;
- self.pos2 = self.angles;
- self.tur_head.team = self.team;
+ this.pos1 = this.origin;
+ this.pos2 = this.angles;
+ this.tur_head.team = this.team;
- Vehicle info = Vehicles_from(veh.vehicleid);
- info.vr_setup(info, veh);
+ info.vr_setup(info, this);
- if(self.active == ACTIVE_NOT)
- self.nextthink = 0; // wait until activated
+ if(this.active == ACTIVE_NOT)
+ this.nextthink = 0; // wait until activated
else if(autocvar_g_vehicles_delayspawn)
- self.nextthink = time + self.respawntime + (random() * autocvar_g_vehicles_delayspawn_jitter);
+ this.nextthink = time + this.respawntime + (random() * autocvar_g_vehicles_delayspawn_jitter);
else
- self.nextthink = time + game_starttime;
+ this.nextthink = time + game_starttime;
- if(MUTATOR_CALLHOOK(VehicleSpawn))
+ if(MUTATOR_CALLHOOK(VehicleSpawn, this))
return false;
return true;
#ifdef SVQC
#include <common/turrets/sv_turrets.qh>
+#include "vehicle.qh"
// vehicle cvars
bool autocvar_g_vehicles = true;
float autocvar_g_vehicles_tag_damagerate = 5;
float autocvar_g_vehicles_weapon_damagerate = 1;
+.float vehicle_last_trace;
+
// flags:
.int vehicle_flags;
.bool(int _imp) vehicles_impulse;
.int vehicle_weapon2mode = _STAT(VEHICLESTAT_W2MODE);
.void(int exit_flags) vehicle_exit;
-.bool() vehicle_enter;
+.bool(entity this, entity player) vehicle_enter;
const int VHEF_NORMAL = 0; /// User pressed exit key
const int VHEF_EJECT = 1; /// User pressed exit key 3 times fast (not implemented) or vehile is dying
const int VHEF_RELEASE = 2; /// Release ownership, client possibly allready dissconnected / went spec / changed team / used "kill" (not implemented)
.float vehicle_enter_delay; // prevent players jumping to and from vehicles instantly
void vehicles_exit(float eject);
-float vehicle_initialize(entity vehicle, float nodrop);
+bool vehicle_initialize(entity this, Vehicle info, float nodrop);
bool vehicle_impulse(entity this, int imp);
bool vehicles_crushable(entity e);
ENDCLASS(Bumblebee)
REGISTER_VEHICLE(BUMBLEBEE, NEW(Bumblebee));
+#ifndef MENUQC
+ MODEL(VEH_BUMBLEBEE_GUNCOCKPIT, "models/vehicles/wakizashi_cockpit.dpm");
+#endif
+
#endif
#ifdef IMPLEMENTATION
player.vehicle = world;
}
-bool bumblebee_gunner_enter()
-{SELFPARAM();
- entity vehic = self;
- entity player = other;
+bool bumblebee_gunner_enter(entity this, entity player)
+{
+ entity vehic = this;
entity gunner = world;
if(!vehic.gunner1 && !vehic.gunner2 && ((time >= vehic.gun1.phase) + (time >= vehic.gun2.phase)) == 2)
float phase_time = (time >= self.gun1.phase) + (time >= self.gun2.phase);
if(time >= other.vehicle_enter_delay && phase_time)
- if(bumblebee_gunner_enter())
+ if(bumblebee_gunner_enter(self, other))
return;
}
spawnfunc(vehicle_bumblebee)
{
- if(!autocvar_g_vehicle_bumblebee) { remove(self); return; }
- if(!vehicle_initialize(VEH_BUMBLEBEE, false)) { remove(self); return; }
+ if(!autocvar_g_vehicle_bumblebee) { remove(this); return; }
+ if(!vehicle_initialize(this, VEH_BUMBLEBEE, false)) { remove(this); return; }
}
METHOD(Bumblebee, vr_impact, void(Bumblebee thisveh, entity instance))
{
if(autocvar_g_vehicle_bumblebee_bouncepain)
- vehicles_impact(autocvar_g_vehicle_bumblebee_bouncepain_x, autocvar_g_vehicle_bumblebee_bouncepain_y, autocvar_g_vehicle_bumblebee_bouncepain_z);
+ vehicles_impact(instance, autocvar_g_vehicle_bumblebee_bouncepain_x, autocvar_g_vehicle_bumblebee_bouncepain_y, autocvar_g_vehicle_bumblebee_bouncepain_z);
}
METHOD(Bumblebee, vr_enter, void(Bumblebee thisveh, entity instance))
{
self.vehicle_exit(VHEF_EJECT);
fixedmakevectors(self.angles);
- vehicle_tossgib(self.gun1, self.velocity + v_right * 300 + v_up * 100 + randomvec() * 200, "cannon_right", rint(random()), rint(random()), 6, randomvec() * 200);
- vehicle_tossgib(self.gun2, self.velocity + v_right * -300 + v_up * 100 + randomvec() * 200, "cannon_left", rint(random()), rint(random()), 6, randomvec() * 200);
- vehicle_tossgib(self.gun3, self.velocity + v_forward * 300 + v_up * -100 + randomvec() * 200, "raygun", rint(random()), rint(random()), 6, randomvec() * 300);
+ vehicle_tossgib(instance, self.gun1, self.velocity + v_right * 300 + v_up * 100 + randomvec() * 200, "cannon_right", rint(random()), rint(random()), 6, randomvec() * 200);
+ vehicle_tossgib(instance, self.gun2, self.velocity + v_right * -300 + v_up * 100 + randomvec() * 200, "cannon_left", rint(random()), rint(random()), 6, randomvec() * 200);
+ vehicle_tossgib(instance, self.gun3, self.velocity + v_forward * 300 + v_up * -100 + randomvec() * 200, "raygun", rint(random()), rint(random()), 6, randomvec() * 300);
- entity _body = vehicle_tossgib(self, self.velocity + randomvec() * 200, "", rint(random()), rint(random()), 6, randomvec() * 100);
+ entity _body = vehicle_tossgib(instance, self, self.velocity + randomvec() * 200, "", rint(random()), rint(random()), 6, randomvec() * 100);
if(random() > 0.5)
_body.touch = bumblebee_blowup;
setorigin(self.gun3, ofs);
self.angles = self.gun3.pos1;
- vehicle_addplayerslot(self, self.gun1, HUD_BUMBLEBEE_GUN, "models/vehicles/wakizashi_cockpit.dpm", bumblebee_gunner_frame, bumblebee_gunner_exit, bumblebee_gunner_enter);
- vehicle_addplayerslot(self, self.gun2, HUD_BUMBLEBEE_GUN, "models/vehicles/wakizashi_cockpit.dpm", bumblebee_gunner_frame, bumblebee_gunner_exit, bumblebee_gunner_enter);
+ vehicle_addplayerslot(self, self.gun1, HUD_BUMBLEBEE_GUN, MDL_VEH_BUMBLEBEE_GUNCOCKPIT, bumblebee_gunner_frame, bumblebee_gunner_exit, bumblebee_gunner_enter);
+ vehicle_addplayerslot(self, self.gun2, HUD_BUMBLEBEE_GUN, MDL_VEH_BUMBLEBEE_GUNCOCKPIT, bumblebee_gunner_frame, bumblebee_gunner_exit, bumblebee_gunner_enter);
setorigin(self.vehicle_hudmodel, '50 0 -5'); // Move cockpit forward - down.
setorigin(self.vehicle_viewport, '5 0 2'); // Move camera forward up
}
METHOD(Bumblebee, vr_setup, void(Bumblebee thisveh, entity instance))
{
- SELFPARAM();
if(autocvar_g_vehicle_bumblebee_energy)
if(autocvar_g_vehicle_bumblebee_energy_regen)
- self.vehicle_flags |= VHF_ENERGYREGEN;
+ instance.vehicle_flags |= VHF_ENERGYREGEN;
if(autocvar_g_vehicle_bumblebee_shield)
- self.vehicle_flags |= VHF_HASSHIELD;
+ instance.vehicle_flags |= VHF_HASSHIELD;
if(autocvar_g_vehicle_bumblebee_shield_regen)
- self.vehicle_flags |= VHF_SHIELDREGEN;
+ instance.vehicle_flags |= VHF_SHIELDREGEN;
if(autocvar_g_vehicle_bumblebee_health_regen)
- self.vehicle_flags |= VHF_HEALTHREGEN;
+ instance.vehicle_flags |= VHF_HEALTHREGEN;
- self.vehicle_exit = bumblebee_exit;
- self.respawntime = autocvar_g_vehicle_bumblebee_respawntime;
- self.vehicle_health = autocvar_g_vehicle_bumblebee_health;
- self.max_health = self.vehicle_health;
- self.vehicle_shield = autocvar_g_vehicle_bumblebee_shield;
+ instance.vehicle_exit = bumblebee_exit;
+ instance.respawntime = autocvar_g_vehicle_bumblebee_respawntime;
+ instance.vehicle_health = autocvar_g_vehicle_bumblebee_health;
+ instance.max_health = instance.vehicle_health;
+ instance.vehicle_shield = autocvar_g_vehicle_bumblebee_shield;
}
#endif // SVQC
bool autocvar_g_vehicle_racer = true;
+float autocvar_g_vehicle_racer_thinkrate = 0.05; // TODO: any higher causes it to sink in liquids
+
float autocvar_g_vehicle_racer_speed_afterburn = 3000;
// energy consumed per second
float autocvar_g_vehicle_racer_afterburn_cost = 100;
vehicles_frame(vehic, this);
- if(pointcontents(vehic.origin) != CONTENT_WATER)
+ traceline(vehic.origin, vehic.origin + '0 0 1', MOVE_NOMONSTERS, this);
+ int cont = trace_dpstartcontents;
+ if(cont & DPCONTENTS_WATER)
vehic.air_finished = time + autocvar_g_vehicle_racer_water_time;
if(IS_DEAD(vehic))
PHYS_INPUT_BUTTON_ZOOM(this) = PHYS_INPUT_BUTTON_CROUCH(this) = false;
- crosshair_trace(this);
+ if(time >= vehic.vehicle_last_trace)
+ {
+ crosshair_trace(this);
+ vehic.vehicle_last_trace = time + autocvar_g_vehicle_racer_thinkrate;
+ }
vehic.angles_x *= -1;
vector df = vehic.velocity * -autocvar_g_vehicle_racer_friction;
//vehic.velocity_z = ftmp;
- int cont = pointcontents(vehic.origin);
if(this.movement)
{
- if(cont == CONTENT_WATER || cont == CONTENT_LAVA || cont == CONTENT_SLIME)
+ if(cont & DPCONTENTS_LIQUIDSMASK)
{
if(this.movement_x) { df += v_forward * ((this.movement_x > 0) ? autocvar_g_vehicle_racer_water_speed_forward : -autocvar_g_vehicle_racer_water_speed_forward); }
if(this.movement_y) { df += v_right * ((this.movement_y > 0) ? autocvar_g_vehicle_racer_water_speed_strafe : -autocvar_g_vehicle_racer_water_speed_strafe); }
vehic.wait = time;
- if(cont == CONTENT_WATER || cont == CONTENT_LAVA || cont == CONTENT_SLIME)
+ if(cont & DPCONTENTS_LIQUIDSMASK)
{
vehic.vehicle_energy -= autocvar_g_vehicle_racer_waterburn_cost * PHYS_INPUT_TIMELENGTH;
df += (v_forward * autocvar_g_vehicle_racer_waterburn_speed);
sound (vehic.tur_head, CH_TRIGGER_SINGLE, SND_Null, VOL_VEHICLEENGINE, ATTEN_NORM);
}
- if(cont == CONTENT_WATER || cont == CONTENT_LAVA || cont == CONTENT_SLIME)
+ if(cont & DPCONTENTS_LIQUIDSMASK)
vehic.racer_watertime = time;
float dforce = autocvar_g_vehicle_racer_downforce;
this.movement = vehic.velocity += df * PHYS_INPUT_TIMELENGTH;
#ifdef SVQC
+ setself(vehic);
+
Weapon wep1 = WEP_RACER;
if (!forbidWeaponUse(this))
if (PHYS_INPUT_BUTTON_ATCK(this))
wep1.wr_think(wep1, vehic, weaponentity, 1);
}
+ setself(this);
+
if(autocvar_g_vehicle_racer_rocket_locktarget)
{
+ if(vehic.vehicle_last_trace == time + autocvar_g_vehicle_racer_thinkrate)
vehicles_locktarget(vehic, (1 / autocvar_g_vehicle_racer_rocket_locking_time) * frametime,
(1 / autocvar_g_vehicle_racer_rocket_locking_releasetime) * frametime,
autocvar_g_vehicle_racer_rocket_locked_time);
void racer_think()
{SELFPARAM();
- self.nextthink = time;
+ this.nextthink = time + autocvar_g_vehicle_racer_thinkrate;
- float pushdeltatime = time - self.lastpushtime;
- if (pushdeltatime > 0.15) pushdeltatime = 0;
- self.lastpushtime = time;
- if(!pushdeltatime) return;
-
- tracebox(self.origin, self.mins, self.maxs, self.origin - ('0 0 1' * autocvar_g_vehicle_racer_springlength), MOVE_NOMONSTERS, self);
+ tracebox(this.origin, this.mins, this.maxs, this.origin - ('0 0 1' * autocvar_g_vehicle_racer_springlength), MOVE_NOMONSTERS, this);
- vector df = self.velocity * -autocvar_g_vehicle_racer_friction;
+ vector df = this.velocity * -autocvar_g_vehicle_racer_friction;
df_z += (1 - trace_fraction) * autocvar_g_vehicle_racer_hoverpower + sin(time * 2) * (autocvar_g_vehicle_racer_springlength * 2);
float forced = autocvar_g_vehicle_racer_upforcedamper;
- int cont = pointcontents(self.origin - '0 0 64');
- if(cont == CONTENT_WATER || cont == CONTENT_LAVA || cont == CONTENT_SLIME)
+ //int cont = pointcontents(self.origin - '0 0 64');
+ traceline(this.origin - '0 0 64', this.origin - '0 0 64', MOVE_NOMONSTERS, this);
+ //if(cont == CONTENT_WATER || cont == CONTENT_LAVA || cont == CONTENT_SLIME)
+ if(trace_dpstartcontents & DPCONTENTS_LIQUIDSMASK)
{
forced = autocvar_g_vehicle_racer_water_upforcedamper;
- self.velocity_z += 200;
+ this.velocity_z += 200;
}
- self.velocity += df * pushdeltatime;
- if(self.velocity_z > 0)
- self.velocity_z *= 1 - forced * pushdeltatime;
+ this.velocity += df * autocvar_g_vehicle_racer_thinkrate;
+ if(this.velocity_z > 0)
+ this.velocity_z *= 1 - forced * autocvar_g_vehicle_racer_thinkrate;
- self.angles_x *= 1 - (autocvar_g_vehicle_racer_anglestabilizer * pushdeltatime);
- self.angles_z *= 1 - (autocvar_g_vehicle_racer_anglestabilizer * pushdeltatime);
+ this.angles_x *= 1 - (autocvar_g_vehicle_racer_anglestabilizer * autocvar_g_vehicle_racer_thinkrate);
+ this.angles_z *= 1 - (autocvar_g_vehicle_racer_anglestabilizer * autocvar_g_vehicle_racer_thinkrate);
- CSQCMODEL_AUTOUPDATE(self);
+ CSQCMODEL_AUTOUPDATE(this);
}
void racer_exit(float eject)
spawnfunc(vehicle_racer)
{
- if(!autocvar_g_vehicle_racer) { remove(self); return; }
- if(!vehicle_initialize(VEH_RACER, false)) { remove(self); return; }
+ if(!autocvar_g_vehicle_racer) { remove(this); return; }
+ if(!vehicle_initialize(this, VEH_RACER, false)) { remove(this); return; }
}
#endif // SVQC
{
#ifdef SVQC
if(autocvar_g_vehicle_racer_bouncepain)
- vehicles_impact(autocvar_g_vehicle_racer_bouncepain_x, autocvar_g_vehicle_racer_bouncepain_y, autocvar_g_vehicle_racer_bouncepain_z);
+ vehicles_impact(instance, autocvar_g_vehicle_racer_bouncepain_x, autocvar_g_vehicle_racer_bouncepain_y, autocvar_g_vehicle_racer_bouncepain_z);
#endif
}
METHOD(Racer, vr_setup, void(Racer thisveh, entity instance))
{
#ifdef SVQC
- SELFPARAM();
- self.vehicle_exit = racer_exit;
-#endif
+ instance.vehicle_exit = racer_exit;
-#ifdef SVQC
// we have no need to network energy
if(autocvar_g_vehicle_racer_energy)
if(autocvar_g_vehicle_racer_energy_regen)
- self.vehicle_flags |= VHF_ENERGYREGEN;
+ instance.vehicle_flags |= VHF_ENERGYREGEN;
if(autocvar_g_vehicle_racer_shield)
- self.vehicle_flags |= VHF_HASSHIELD;
+ instance.vehicle_flags |= VHF_HASSHIELD;
if(autocvar_g_vehicle_racer_shield_regen)
- self.vehicle_flags |= VHF_SHIELDREGEN;
+ instance.vehicle_flags |= VHF_SHIELDREGEN;
if(autocvar_g_vehicle_racer_health_regen)
- self.vehicle_flags |= VHF_HEALTHREGEN;
+ instance.vehicle_flags |= VHF_HEALTHREGEN;
- self.respawntime = autocvar_g_vehicle_racer_respawntime;
- self.vehicle_health = autocvar_g_vehicle_racer_health;
- self.vehicle_shield = autocvar_g_vehicle_racer_shield;
- self.max_health = self.vehicle_health;
+ instance.respawntime = autocvar_g_vehicle_racer_respawntime;
+ instance.vehicle_health = autocvar_g_vehicle_racer_health;
+ instance.vehicle_shield = autocvar_g_vehicle_racer_shield;
+ instance.max_health = instance.vehicle_health;
#endif
#ifdef CSQC
if(IS_DEAD(vehic))
{
PHYS_INPUT_BUTTON_ATCK(this) = PHYS_INPUT_BUTTON_ATCK2(this) = false;
- return 1;
+ return;
}
crosshair_trace(this);
UpdateAuxiliaryXhair(this, trace_endpos, '0 1 0', 0);
*/
+ // TODO: fix wr_checkammo and its use of self!
+ setself(vehic);
+
Weapon wep1 = WEP_RAPTOR;
if(!forbidWeaponUse(this))
if(PHYS_INPUT_BUTTON_ATCK(this))
}
}
+ setself(this);
+
vehic.bomb1.alpha = vehic.bomb2.alpha = (time - vehic.lip) / (vehic.delay - vehic.lip);
this.vehicle_reload2 = bound(0, vehic.bomb1.alpha * 100, 100);
this.vehicle_ammo2 = (this.vehicle_reload2 == 100) ? 100 : 0;
if(vehic.bomb1.cnt < time)
{
- entity _missile = findchainentity(enemy, vehic);
- float _incomming = 0;
- while(_missile)
+ bool incoming = false;
+ FOREACH_ENTITY_ENT(enemy, vehic,
{
- if(_missile.flags & FL_PROJECTILE)
- if(MISSILE_IS_TRACKING(_missile))
- if(vdist(vehic.origin - _missile.origin, <, 2 * autocvar_g_vehicle_raptor_flare_range))
- ++_incomming;
+ if(it.flags & FL_PROJECTILE)
+ if(MISSILE_IS_TRACKING(it))
+ if(vdist(vehic.origin - it.origin, <, 2 * autocvar_g_vehicle_raptor_flare_range))
+ {
+ incoming = true;
+ break;
+ }
+ });
- _missile = _missile.chain;
+ if(incoming)
+ {
+ msg_entity = this;
+ soundto(MSG_ONE, vehic, CH_PAIN_SINGLE, SND(VEH_MISSILE_ALARM), VOL_BASE, ATTEN_NONE);
}
- if(_incomming)
- sound(vehic, CH_PAIN_SINGLE, SND_VEH_MISSILE_ALARM, VOL_BASE, ATTEN_NONE);
-
vehic.bomb1.cnt = time + 1;
}
spawnfunc(vehicle_raptor)
{
- if(!autocvar_g_vehicle_raptor) { remove(self); return; }
- if(!vehicle_initialize(VEH_RAPTOR, false)) { remove(self); return; }
+ if(!autocvar_g_vehicle_raptor) { remove(this); return; }
+ if(!vehicle_initialize(this, VEH_RAPTOR, false)) { remove(this); return; }
}
METHOD(Raptor, vr_impact, void(Raptor thisveh, entity instance))
{
if(autocvar_g_vehicle_raptor_bouncepain)
- vehicles_impact(autocvar_g_vehicle_raptor_bouncepain_x, autocvar_g_vehicle_raptor_bouncepain_y, autocvar_g_vehicle_raptor_bouncepain_z);
+ vehicles_impact(instance, autocvar_g_vehicle_raptor_bouncepain_x, autocvar_g_vehicle_raptor_bouncepain_y, autocvar_g_vehicle_raptor_bouncepain_z);
}
METHOD(Raptor, vr_enter, void(Raptor thisveh, entity instance))
{
}
METHOD(Raptor, vr_setup, void(Raptor thisveh, entity instance))
{
- SELFPARAM();
if(autocvar_g_vehicle_raptor_shield)
- self.vehicle_flags |= VHF_HASSHIELD;
+ instance.vehicle_flags |= VHF_HASSHIELD;
if(autocvar_g_vehicle_raptor_shield_regen)
- self.vehicle_flags |= VHF_SHIELDREGEN;
+ instance.vehicle_flags |= VHF_SHIELDREGEN;
if(autocvar_g_vehicle_raptor_health_regen)
- self.vehicle_flags |= VHF_HEALTHREGEN;
+ instance.vehicle_flags |= VHF_HEALTHREGEN;
if(autocvar_g_vehicle_raptor_energy_regen)
- self.vehicle_flags |= VHF_ENERGYREGEN;
+ instance.vehicle_flags |= VHF_ENERGYREGEN;
- self.vehicle_exit = raptor_exit;
- self.respawntime = autocvar_g_vehicle_raptor_respawntime;
- self.vehicle_health = autocvar_g_vehicle_raptor_health;
- self.vehicle_shield = autocvar_g_vehicle_raptor_shield;
- self.max_health = self.vehicle_health;
+ instance.vehicle_exit = raptor_exit;
+ instance.respawntime = autocvar_g_vehicle_raptor_respawntime;
+ instance.vehicle_health = autocvar_g_vehicle_raptor_health;
+ instance.vehicle_shield = autocvar_g_vehicle_raptor_shield;
+ instance.max_health = instance.vehicle_health;
}
#endif
if(intermission_running)
{
- self.vehicle.velocity = '0 0 0';
- self.vehicle.avelocity = '0 0 0';
+ vehic.velocity = '0 0 0';
+ vehic.avelocity = '0 0 0';
return;
}
//fixedmakevectors(vehic.angles);
makevectors(vehic.angles + '-2 0 0' * vehic.angles_x);
- WITH(entity, self, vehic, movelib_groundalign4point(autocvar_g_vehicle_spiderbot_springlength, autocvar_g_vehicle_spiderbot_springup, autocvar_g_vehicle_spiderbot_springblend, autocvar_g_vehicle_spiderbot_tiltlimit));
+ movelib_groundalign4point(vehic, autocvar_g_vehicle_spiderbot_springlength, autocvar_g_vehicle_spiderbot_springup, autocvar_g_vehicle_spiderbot_springblend, autocvar_g_vehicle_spiderbot_tiltlimit);
if(IS_ONGROUND(vehic))
vehic.jump_delay = time; // reset now so movement can begin
v_forward = normalize(v_forward);
v += v_forward * 50;
- WITH(entity, self, this, fireBullet(v, v_forward, autocvar_g_vehicle_spiderbot_minigun_spread, autocvar_g_vehicle_spiderbot_minigun_solidpenetration,
- autocvar_g_vehicle_spiderbot_minigun_damage, autocvar_g_vehicle_spiderbot_minigun_force, DEATH_VH_SPID_MINIGUN.m_id, 0));
+ fireBullet(this, v, v_forward, autocvar_g_vehicle_spiderbot_minigun_spread, autocvar_g_vehicle_spiderbot_minigun_solidpenetration,
+ autocvar_g_vehicle_spiderbot_minigun_damage, autocvar_g_vehicle_spiderbot_minigun_force, DEATH_VH_SPID_MINIGUN.m_id, 0);
sound (gun, CH_WEAPON_A, SND_UZI_FIRE, VOL_BASE, ATTEN_NORM);
//trailparticles(self, _particleeffectnum("spiderbot_minigun_trail"), v, trace_endpos);
autocvar_g_vehicle_spiderbot_minigun_ammo_regen, frametime, false);
- WITH(entity, self, vehic, spiderbot_rocket_do());
+ spiderbot_rocket_do(vehic);
if(vehic.vehicle_flags & VHF_SHIELDREGEN)
vehicles_regen(vehic, vehic.dmg_time, vehicle_shield, autocvar_g_vehicle_spiderbot_shield, autocvar_g_vehicle_spiderbot_shield_regen_pause, autocvar_g_vehicle_spiderbot_shield_regen, frametime, true);
spawnfunc(vehicle_spiderbot)
{
- if(!autocvar_g_vehicle_spiderbot) { remove(self); return; }
- if(!vehicle_initialize(VEH_SPIDERBOT, false)) { remove(self); return; }
+ if(!autocvar_g_vehicle_spiderbot) { remove(this); return; }
+ if(!vehicle_initialize(this, VEH_SPIDERBOT, false)) { remove(this); return; }
}
METHOD(Spiderbot, vr_impact, void(Spiderbot thisveh, entity instance))
{
if(autocvar_g_vehicle_spiderbot_bouncepain)
- vehicles_impact(autocvar_g_vehicle_spiderbot_bouncepain_x, autocvar_g_vehicle_spiderbot_bouncepain_y, autocvar_g_vehicle_spiderbot_bouncepain_z);
+ vehicles_impact(instance, autocvar_g_vehicle_spiderbot_bouncepain_x, autocvar_g_vehicle_spiderbot_bouncepain_y, autocvar_g_vehicle_spiderbot_bouncepain_z);
}
METHOD(Spiderbot, vr_enter, void(Spiderbot thisveh, entity instance))
{
}
METHOD(Spiderbot, vr_setup, void(Spiderbot thisveh, entity instance))
{
- SELFPARAM();
if(autocvar_g_vehicle_spiderbot_shield)
- self.vehicle_flags |= VHF_HASSHIELD;
+ instance.vehicle_flags |= VHF_HASSHIELD;
if(autocvar_g_vehicle_spiderbot_shield_regen)
- self.vehicle_flags |= VHF_SHIELDREGEN;
+ instance.vehicle_flags |= VHF_SHIELDREGEN;
if(autocvar_g_vehicle_spiderbot_health_regen)
- self.vehicle_flags |= VHF_HEALTHREGEN;
+ instance.vehicle_flags |= VHF_HEALTHREGEN;
- self.respawntime = autocvar_g_vehicle_spiderbot_respawntime;
- self.vehicle_health = autocvar_g_vehicle_spiderbot_health;
- self.vehicle_shield = autocvar_g_vehicle_spiderbot_shield;
- self.max_health = self.vehicle_health;
- self.pushable = true; // spiderbot can use jumppads
+ instance.respawntime = autocvar_g_vehicle_spiderbot_respawntime;
+ instance.vehicle_health = autocvar_g_vehicle_spiderbot_health;
+ instance.vehicle_shield = autocvar_g_vehicle_spiderbot_shield;
+ instance.max_health = instance.vehicle_health;
+ instance.pushable = true; // spiderbot can use jumppads
}
#endif // SVQC
self.use();
}
-void spiderbot_guide_release()
-{SELFPARAM();
+void spiderbot_guide_release(entity this)
+{
entity rkt;
- rkt = findchainentity(realowner, self.owner);
+ rkt = findchainentity(realowner, this.owner);
if(!rkt)
return;
- crosshair_trace(self.owner);
+ crosshair_trace(this.owner);
while(rkt)
{
if(rkt.think == spiderbot_rocket_guided)
return sdir * vs + '0 0 1' * vz;
}
-void spiderbot_rocket_do()
-{SELFPARAM();
+void spiderbot_rocket_do(entity this)
+{;
vector v;
entity rocket = world;
- if (self.wait != -10)
+ if (this.wait != -10)
{
- if (PHYS_INPUT_BUTTON_ATCK2(self.owner) && self.vehicle_weapon2mode == SBRM_GUIDE)
+ if (PHYS_INPUT_BUTTON_ATCK2(this.owner) && this.vehicle_weapon2mode == SBRM_GUIDE)
{
- if (self.wait == 1)
- if (self.tur_head.frame == 9 || self.tur_head.frame == 1)
+ if (this.wait == 1)
+ if (this.tur_head.frame == 9 || this.tur_head.frame == 1)
{
- if(self.gun2.cnt < time && self.tur_head.frame == 9)
- self.tur_head.frame = 1;
+ if(this.gun2.cnt < time && this.tur_head.frame == 9)
+ this.tur_head.frame = 1;
return;
}
- self.wait = 1;
+ this.wait = 1;
}
else
{
- if(self.wait)
- spiderbot_guide_release();
+ if(this.wait)
+ spiderbot_guide_release(this);
- self.wait = 0;
+ this.wait = 0;
}
}
- if(self.gun2.cnt > time)
+ if(this.gun2.cnt > time)
return;
- if (self.tur_head.frame >= 9)
+ if (this.tur_head.frame >= 9)
{
- self.tur_head.frame = 1;
- self.wait = 0;
+ this.tur_head.frame = 1;
+ this.wait = 0;
}
- if(self.wait != -10)
- if(!PHYS_INPUT_BUTTON_ATCK2(self.owner))
+ if(this.wait != -10)
+ if(!PHYS_INPUT_BUTTON_ATCK2(this.owner))
return;
- if(forbidWeaponUse(self.owner))
+ if(forbidWeaponUse(this.owner))
return;
- v = gettaginfo(self.tur_head,gettagindex(self.tur_head,"tag_fire"));
+ v = gettaginfo(this.tur_head,gettagindex(this.tur_head,"tag_fire"));
- switch(self.vehicle_weapon2mode)
+ switch(this.vehicle_weapon2mode)
{
case SBRM_VOLLY:
- rocket = vehicles_projectile(self, EFFECT_SPIDERBOT_ROCKETLAUNCH.eent_eff_name, SND_ROCKET_FIRE,
+ rocket = vehicles_projectile(this, EFFECT_SPIDERBOT_ROCKETLAUNCH.eent_eff_name, 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, self.owner);
- crosshair_trace(self.owner);
+ DEATH_VH_SPID_ROCKET.m_id, PROJECTILE_SPIDERROCKET, autocvar_g_vehicle_spiderbot_rocket_health, false, true, this.owner);
+ crosshair_trace(this.owner);
float _dist = (random() * autocvar_g_vehicle_spiderbot_rocket_radius) + vlen(v - trace_endpos);
_dist -= (random() * autocvar_g_vehicle_spiderbot_rocket_radius) ;
rocket.nextthink = time + (_dist / autocvar_g_vehicle_spiderbot_rocket_speed);
rocket.think = vehicles_projectile_explode;
- if(PHYS_INPUT_BUTTON_ATCK2(self.owner) && self.tur_head.frame == 1)
- self.wait = -10;
+ if(PHYS_INPUT_BUTTON_ATCK2(this.owner) && this.tur_head.frame == 1)
+ this.wait = -10;
break;
case SBRM_GUIDE:
- rocket = vehicles_projectile(self, EFFECT_SPIDERBOT_ROCKETLAUNCH.eent_eff_name, SND_ROCKET_FIRE,
+ rocket = vehicles_projectile(this, EFFECT_SPIDERBOT_ROCKETLAUNCH.eent_eff_name, 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, self.owner);
- crosshair_trace(self.owner);
+ DEATH_VH_SPID_ROCKET.m_id, PROJECTILE_SPIDERROCKET, autocvar_g_vehicle_spiderbot_rocket_health, false, false, this.owner);
+ crosshair_trace(this.owner);
rocket.pos1 = trace_endpos;
rocket.nextthink = time;
rocket.think = spiderbot_rocket_guided;
break;
case SBRM_ARTILLERY:
- rocket = vehicles_projectile(self, EFFECT_SPIDERBOT_ROCKETLAUNCH.eent_eff_name, SND_ROCKET_FIRE,
+ rocket = vehicles_projectile(this, EFFECT_SPIDERBOT_ROCKETLAUNCH.eent_eff_name, 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, self.owner);
+ DEATH_VH_SPID_ROCKET.m_id, PROJECTILE_SPIDERROCKET, autocvar_g_vehicle_spiderbot_rocket_health, false, true, this.owner);
- crosshair_trace(self.owner);
+ crosshair_trace(this.owner);
rocket.pos1 = trace_endpos + randomvec() * (0.75 * autocvar_g_vehicle_spiderbot_rocket_radius);
rocket.pos1_z = trace_endpos_z;
- traceline(v, v + '0 0 1' * MAX_SHOT_DISTANCE, MOVE_WORLDONLY, self);
+ traceline(v, v + '0 0 1' * MAX_SHOT_DISTANCE, MOVE_WORLDONLY, this);
float h1 = 0.75 * vlen(v - trace_endpos);
//v = trace_endpos;
- traceline(v , rocket.pos1 + '0 0 1' * MAX_SHOT_DISTANCE, MOVE_WORLDONLY, self);
+ traceline(v , rocket.pos1 + '0 0 1' * MAX_SHOT_DISTANCE, MOVE_WORLDONLY, this);
float h2 = 0.75 * vlen(rocket.pos1 - v);
rocket.velocity = spiberbot_calcartillery(v, rocket.pos1, ((h1 < h2) ? h1 : h2));
rocket.cnt = time + autocvar_g_vehicle_spiderbot_rocket_lifetime;
- self.tur_head.frame += 1;
- if (self.tur_head.frame == 9)
- self.attack_finished_single[0] = autocvar_g_vehicle_spiderbot_rocket_reload;
+ this.tur_head.frame += 1;
+ if (this.tur_head.frame == 9)
+ this.attack_finished_single[0] = autocvar_g_vehicle_spiderbot_rocket_reload;
else
- self.attack_finished_single[0] = ((self.vehicle_weapon2mode == SBRM_VOLLY) ? autocvar_g_vehicle_spiderbot_rocket_refire2 : autocvar_g_vehicle_spiderbot_rocket_refire);
+ this.attack_finished_single[0] = ((this.vehicle_weapon2mode == SBRM_VOLLY) ? autocvar_g_vehicle_spiderbot_rocket_refire2 : autocvar_g_vehicle_spiderbot_rocket_refire);
- self.gun2.cnt = time + self.attack_finished_single[0];
+ this.gun2.cnt = time + this.attack_finished_single[0];
}
#endif
#include <common/weapons/all.qh>
#ifdef SVQC
-void spiderbot_rocket_do();
+void spiderbot_rocket_do(entity this);
#endif
// 400 (x2) DPS
{
SELFPARAM();
entity e = W_PROP_reloader = new_pure(W_PROP_reloader);
- WITH(entity, self, e, (e.think = W_PROP_think)());
+ WITHSELF(e, (e.think = W_PROP_think)());
}
#endif
this.angles = vectoangles(this.velocity);
if(this.health <= 0)
- WITH(entity, self, this, W_PrepareExplosionByDamage(attacker, this.think));
+ WITHSELF(this, W_PrepareExplosionByDamage(attacker, this.think));
}
void W_Arc_Bolt_Touch()
beam.beam_bursting = burst;
Net_LinkEntity(beam, false, 0, W_Arc_Beam_Send);
- WITH(entity, self, beam, beam.think());
+ WITHSELF(beam, beam.think());
}
void Arc_Smoke()
if (time >= missile.nextthink)
{
- WITH(entity, self, missile, missile.think());
+ WITHSELF(missile, missile.think());
}
}
this.angles = vectoangles(this.velocity);
if(this.health <= 0)
- WITH(entity, self, this, W_PrepareExplosionByDamage(attacker, W_Devastator_Explode));
+ WITHSELF(this, W_PrepareExplosionByDamage(attacker, W_Devastator_Explode));
}
void W_Devastator_Attack(Weapon thiswep)
if(this.health <= 0)
{
this.cnt = 1;
- WITH(entity, self, this, W_PrepareExplosionByDamage(attacker, W_Fireball_Explode));
+ WITHSELF(this, W_PrepareExplosionByDamage(attacker, W_Fireball_Explode));
}
}
this.angles = vectoangles(this.velocity);
if(this.health <= 0)
- WITH(entity, self, this, W_PrepareExplosionByDamage(attacker, this.think));
+ WITHSELF(this, W_PrepareExplosionByDamage(attacker, this.think));
}
void W_Hagar_Touch()
this.health = this.health - damage;
if(this.health <= 0)
- WITH(entity, self, this, W_PrepareExplosionByDamage(this.realowner, W_Hook_Explode2));
+ WITHSELF(this, W_PrepareExplosionByDamage(this.realowner, W_Hook_Explode2));
}
void W_Hook_Touch2()
{
if (actor.hook)
RemoveGrapplingHook(actor);
- WITH(entity, self, actor, FireGrapplingHook());
+ WITHSELF(actor, FireGrapplingHook());
actor.hook_state &= ~HOOK_FIRING;
actor.hook_refire = max(actor.hook_refire, time + autocvar_g_balance_grapplehook_refire * W_WeaponRateFactor());
}
ATTACK_FINISHED(self, slot) = time + WEP_CVAR(machinegun, first_refire) * W_WeaponRateFactor();
if(self.misc_bulletcounter == 1)
- fireBullet(w_shotorg, w_shotdir, WEP_CVAR(machinegun, first_spread), WEP_CVAR(machinegun, solidpenetration), WEP_CVAR(machinegun, first_damage), WEP_CVAR(machinegun, first_force), deathtype, 0);
+ fireBullet(self, w_shotorg, w_shotdir, WEP_CVAR(machinegun, first_spread), WEP_CVAR(machinegun, solidpenetration), WEP_CVAR(machinegun, first_damage), WEP_CVAR(machinegun, first_force), deathtype, 0);
else
- fireBullet(w_shotorg, w_shotdir, WEP_CVAR(machinegun, sustained_spread), WEP_CVAR(machinegun, solidpenetration), WEP_CVAR(machinegun, sustained_damage), WEP_CVAR(machinegun, sustained_force), deathtype, 0);
+ fireBullet(self, w_shotorg, w_shotdir, WEP_CVAR(machinegun, sustained_spread), WEP_CVAR(machinegun, solidpenetration), WEP_CVAR(machinegun, sustained_damage), WEP_CVAR(machinegun, sustained_force), deathtype, 0);
Send_Effect(EFFECT_MACHINEGUN_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
}
machinegun_spread = bound(WEP_CVAR(machinegun, spread_min), WEP_CVAR(machinegun, spread_min) + (WEP_CVAR(machinegun, spread_add) * actor.misc_bulletcounter), WEP_CVAR(machinegun, spread_max));
- fireBullet(w_shotorg, w_shotdir, machinegun_spread, WEP_CVAR(machinegun, solidpenetration), WEP_CVAR(machinegun, sustained_damage), WEP_CVAR(machinegun, sustained_force), WEP_MACHINEGUN.m_id, 0);
+ fireBullet(actor, w_shotorg, w_shotdir, machinegun_spread, WEP_CVAR(machinegun, solidpenetration), WEP_CVAR(machinegun, sustained_damage), WEP_CVAR(machinegun, sustained_force), WEP_MACHINEGUN.m_id, 0);
actor.misc_bulletcounter = actor.misc_bulletcounter + 1;
actor.punchangle_y = random() - 0.5;
}
- fireBullet(w_shotorg, w_shotdir, WEP_CVAR(machinegun, burst_speed), WEP_CVAR(machinegun, solidpenetration), WEP_CVAR(machinegun, sustained_damage), WEP_CVAR(machinegun, sustained_force), WEP_MACHINEGUN.m_id, 0);
+ fireBullet(actor, w_shotorg, w_shotdir, WEP_CVAR(machinegun, burst_speed), WEP_CVAR(machinegun, solidpenetration), WEP_CVAR(machinegun, sustained_damage), WEP_CVAR(machinegun, sustained_force), WEP_MACHINEGUN.m_id, 0);
Send_Effect(EFFECT_MACHINEGUN_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
this.angles = vectoangles(this.velocity);
if(this.health <= 0)
- WITH(entity, self, this, W_PrepareExplosionByDamage(attacker, W_MineLayer_Explode));
+ WITHSELF(this, W_PrepareExplosionByDamage(attacker, W_MineLayer_Explode));
}
void W_MineLayer_Attack(Weapon thiswep)
this.health = this.health - damage;
if(this.health <= 0)
- WITH(entity, self, this, W_PrepareExplosionByDamage(attacker, this.use));
+ WITHSELF(this, W_PrepareExplosionByDamage(attacker, this.use));
}
void W_Mortar_Grenade_Think1()
{SELFPARAM();
if(p.porto_current.realowner == p && p.porto_current.classname == "porto")
{
- WITH(entity, self, p.porto_current, W_Porto_Fail(1));
+ WITHSELF(p.porto_current, W_Porto_Fail(1));
}
}
}
for(i = 0; i < pShots; ++i)
- fireBullet(w_shotorg, w_shotdir, pSpread, pSolidPenetration, pDamage, pForce, deathtype, (pTracer ? EF_RED : EF_BLUE));
+ fireBullet(self, w_shotorg, w_shotdir, pSpread, pSolidPenetration, pDamage, pForce, deathtype, (pTracer ? EF_RED : EF_BLUE));
if(autocvar_g_casings >= 2)
SpawnCasing(((random() * 50 + 50) * v_right) - (v_forward * (random() * 25 + 25)) - ((random() * 5 - 70) * v_up), 2, vectoangles(v_forward),'0 250 0', 100, 3, self);
this.health = this.health - damage;
if(this.health <= 0)
- WITH(entity, self, this, W_PrepareExplosionByDamage(attacker, W_Seeker_Missile_Explode));
+ WITHSELF(this, W_PrepareExplosionByDamage(attacker, W_Seeker_Missile_Explode));
}
/*
W_SetupShot(self, true, 5, SND_SHOTGUN_FIRE, ((isprimary) ? CH_WEAPON_A : CH_WEAPON_SINGLE), WEP_CVAR_PRI(shotgun, damage) * WEP_CVAR_PRI(shotgun, bullets));
for(sc = 0;sc < WEP_CVAR_PRI(shotgun, bullets);sc = sc + 1)
- fireBullet(w_shotorg, w_shotdir, WEP_CVAR_PRI(shotgun, spread), WEP_CVAR_PRI(shotgun, solidpenetration), WEP_CVAR_PRI(shotgun, damage), WEP_CVAR_PRI(shotgun, force), WEP_SHOTGUN.m_id, 0);
+ fireBullet(self, w_shotorg, w_shotdir, WEP_CVAR_PRI(shotgun, spread), WEP_CVAR_PRI(shotgun, solidpenetration), WEP_CVAR_PRI(shotgun, damage), WEP_CVAR_PRI(shotgun, force), WEP_SHOTGUN.m_id, 0);
Send_Effect(EFFECT_SHOTGUN_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, WEP_CVAR_PRI(shotgun, ammo));
MUTATOR_HOOKFUNCTION(vortex_charge, GetPressedKeys)
{SELFPARAM();
// WEAPONTODO
- float xyspeed = vlen(vec2(self.velocity));
- if (PS(self).m_weapon == WEP_VORTEX && WEP_CVAR(vortex, charge) && WEP_CVAR(vortex, charge_velocity_rate) && xyspeed > WEP_CVAR(vortex, charge_minspeed))
+ float xyspeed = vlen(vec2(this.velocity));
+ if (PS(this).m_weapon == WEP_VORTEX && WEP_CVAR(vortex, charge) && WEP_CVAR(vortex, charge_velocity_rate) && xyspeed > WEP_CVAR(vortex, charge_minspeed))
{
// add a maximum of charge_velocity_rate when going fast (f = 1), gradually increasing from minspeed (f = 0) to maxspeed
xyspeed = min(xyspeed, WEP_CVAR(vortex, charge_maxspeed));
float f = (xyspeed - WEP_CVAR(vortex, charge_minspeed)) / (WEP_CVAR(vortex, charge_maxspeed) - WEP_CVAR(vortex, charge_minspeed));
// add the extra charge
- self.vortex_charge = min(1, self.vortex_charge + WEP_CVAR(vortex, charge_velocity_rate) * f * PHYS_INPUT_TIMELENGTH);
+ this.vortex_charge = min(1, this.vortex_charge + WEP_CVAR(vortex, charge_velocity_rate) * f * PHYS_INPUT_TIMELENGTH);
}
}
vector org2 = w_org + w_backoff * 6;
pointparticles(EFFECT_VORTEX_IMPACT, org2, '0 0 0', 1);
if(!w_issilent)
- sound(self, CH_SHOTS, SND_NEXIMPACT, VOL_BASE, ATTN_NORM);
+ sound(this, CH_SHOTS, SND_NEXIMPACT, VOL_BASE, ATTN_NORM);
}
METHOD(Vortex, wr_init, void(entity thiswep))
{
#define TC(T, sym) MACRO_BEGIN MACRO_END
#else
#define TC(T, sym) MACRO_BEGIN \
- if (!is_##T(sym)) LOG_WARNINGF("Type check failed: " #sym " :: " #T); \
+ if (!is_##T(sym)) { \
+ LOG_WARNINGF("Type check failed: " #sym " :: " #T); \
+ isnt_##T(sym); \
+ } \
MACRO_END
#endif
-bool is_float (float this) { return true; }
-bool is_vector(vector this) { return true; }
-bool is_string(string this) { return true; }
-bool is_entity(entity this) { return true; }
-bool is_int (float this) { return this == floor(this); }
-bool is_bool (float this) { return this == true || this == false; }
+#define is_float( this) (true || ftoe(this))
+#define isnt_float( this)
+#define is_vector( this) (true || vtos(this))
+#define isnt_vector( this)
+#define is_string( this) (true || stof(this))
+#define isnt_string( this)
+#define is_entity( this) (true || etof(this))
+#define isnt_entity( this)
+bool is_int( float this) { return this == floor(this); }
+void isnt_int( float this) { print(ftos(this)); }
+bool is_bool( float this) { return this == true || this == false; }
+void isnt_bool( float this) { print(ftos(this)); }
#include "warpzone/mathlib.qc"
#include "functional.qh"
#include "i18n.qh"
#include "iter.qh"
+#include "json.qc"
#include "lazy.qh"
#include "linkedlist.qh"
#include "log.qh"
#include "urllib.qc"
#include "vector.qh"
#include "yenc.qh"
+
+#include "matrix/_mod.inc"
// generated file; do not modify
#include "angle.qc"
+#include "json.qc"
#include "p2mathlib.qc"
#include "random.qc"
#include "sortlist.qc"
SELFPARAM();
this.think = SUB_Remove_self;
this.nextthink = time;
- WITH(entity, self, this.owner, this.use());
+ WITHSELF(this.owner, this.selfthink(this));
}
-/*
- Execute func() after time + fdelay.
- self when func is executed = self when defer is called
-*/
- void defer(entity this, float fdelay, void() func)
+ /**
+ * Execute func() after time + fdelay.
+ * self when func is executed = self when defer is called
+ */
+ void defer(entity this, float fdelay, void(entity this) func)
{
entity e = new_pure(deferred);
e.owner = this;
- e.use = func;
+ setthink(e, func);
e.think = defer_think;
e.nextthink = time + fdelay;
}
} MACRO_END
#define STRING_ITERATOR_GET(this) str2chr(this##_s, this##_i++)
+#define STRING_ITERATOR_PEEK(this) str2chr(this##_s, this##_i)
+#define STRING_ITERATOR_NEXT(this) MACRO_BEGIN ++this##_i; MACRO_END
+#define STRING_ITERATOR_UNGET(this) MACRO_BEGIN --this##_i; MACRO_END
+#define STRING_ITERATOR_SAVE(this) this##_i
+#define STRING_ITERATOR_LOAD(this, n) MACRO_BEGIN this##_i = n; MACRO_END
#define FOREACH_CHAR(s, cond, body) \
MACRO_BEGIN \
} MACRO_END
#if defined(CSQC)
+ entity(entity start, .string fld, string match) _findstring = #18;
entity(.string fld, string match, .entity tofield) _findchainstring_tofield = #402;
+
+ entity(entity start, .entity fld, entity match) _findentity = #98;
entity(.entity fld, entity match, .entity tofield) _findchainentity_tofield = #403;
+
+ entity(entity start, .float fld, float match) _findfloat = #98;
entity(.float fld, float match, .entity tofield) _findchainfloat_tofield = #403;
+
+ entity(entity start, .float fld, float match) _findflags = #449;
entity(.float fld, float match, .entity tofield) _findchainflags_tofield = #450;
#elif defined(SVQC)
+ entity(entity start, .string fld, string match) _findstring = #18;
entity(.string fld, string match, .entity tofield) _findchainstring_tofield = #402;
+
+ entity(entity start, .entity fld, entity match) _findentity = #98;
entity(.entity fld, entity match, .entity tofield) _findchainentity_tofield = #403;
+
+ entity(entity start, .float fld, float match) _findfloat = #98;
entity(.float fld, float match, .entity tofield) _findchainfloat_tofield = #403;
+
+ entity(entity start, .float fld, float match) _findflags = #449;
entity(.float fld, float match, .entity tofield) _findchainflags_tofield = #450;
#elif defined(MENUQC)
+ entity(entity start, .string fld, string match) _findstring = #24;
entity(.string fld, string match, .entity tofield) _findchainstring_tofield = #26;
+
+ entity(entity start, .entity fld, entity match) _findentity = #25;
entity(.entity fld, entity match, .entity tofield) _findchainentity_tofield = #27;
+
+ entity(entity start, .float fld, float match) _findfloat = #25;
entity(.float fld, float match, .entity tofield) _findchainfloat_tofield = #27;
+
+ entity(entity start, .float fld, float match) _findflags = #87;
entity(.float fld, float match, .entity tofield) _findchainflags_tofield = #88;
#endif
#define ORDERED(F) F##_UNORDERED
+#define _FOREACH_ENTITY_FIND_ORDERED(T, fld, match, cond, body) \
+ MACRO_BEGIN { \
+ int _i = 0; \
+ for (entity _it = NULL; (_it = _find##T(_it, fld, match)); ++_i) \
+ { \
+ const noref int i = _i; \
+ ITER_CONST noref entity it = _it; \
+ if (cond) LAMBDA(body) \
+ } \
+ } MACRO_END
+#define _FOREACH_ENTITY_FIND_UNORDERED(id, T, fld, match, cond, body) \
+ MACRO_BEGIN { \
+ if (_FOREACH_ENTITY_FIND_##T##_##id##mutex) LOG_SEVEREF("Loop mutex held by %s", _FOREACH_ENTITY_FIND_##T##_##id##mutex); \
+ _FOREACH_ENTITY_FIND_##T##_##id##mutex = __FUNC__; \
+ entity _foundchain_first = _findchain##T##_tofield(fld, match, _FOREACH_ENTITY_FIND_##T##_next##id); \
+ FOREACH_LIST(_foundchain, _FOREACH_ENTITY_FIND_##T##_next##id, cond, body); \
+ _FOREACH_ENTITY_FIND_##T##_##id##mutex = string_null; \
+ } MACRO_END
#define FOREACH_ENTITY(cond, body) ORDERED(FOREACH_ENTITY)(cond, body)
#define FOREACH_ENTITY_ORDERED(cond, body) \
{ \
const noref int i = _i; \
ITER_CONST noref entity it = _it; \
- if (cond) { LAMBDA(body) } \
+ if (cond) LAMBDA(body) \
} \
} MACRO_END
/** marker field, always NULL */
.entity _FOREACH_ENTITY_fld;
+.entity _FOREACH_ENTITY_FIND_entity_nextall; noref string _FOREACH_ENTITY_FIND_entity_allmutex;
+#define FOREACH_ENTITY_UNORDERED(cond, body) _FOREACH_ENTITY_FIND_UNORDERED(all, entity, _FOREACH_ENTITY_fld, NULL, cond, body)
-.entity _FOREACH_ENTITY_next;
-noref string _FOREACH_ENTITY_mutex;
-#define FOREACH_ENTITY_UNORDERED(cond, body) \
- MACRO_BEGIN { \
- if (_FOREACH_ENTITY_mutex) LOG_SEVEREF("Loop mutex held by %s", _FOREACH_ENTITY_mutex); \
- _FOREACH_ENTITY_mutex = __FUNC__; \
- entity _foundchain_first = _findchainentity_tofield(_FOREACH_ENTITY_fld, NULL, _FOREACH_ENTITY_next); \
- FOREACH_LIST(_foundchain, _FOREACH_ENTITY_next, cond, body); \
- _FOREACH_ENTITY_mutex = string_null; \
- } MACRO_END
-
+#define FOREACH_ENTITY_FLAGS(fld, match, body) ORDERED(FOREACH_ENTITY_FLAGS)(fld, match, body)
+#define FOREACH_ENTITY_FLAGS_ORDERED(fld, match, body) _FOREACH_ENTITY_FIND_ORDERED(flags, fld, match, true, body)
+.entity _FOREACH_ENTITY_FIND_flags_next; noref string _FOREACH_ENTITY_FIND_flags_mutex;
+#define FOREACH_ENTITY_FLAGS_UNORDERED(fld, match, body) _FOREACH_ENTITY_FIND_UNORDERED(, flags, fld, match, true, body)
#ifndef MENUQC
-entity(vector org, float rad, .entity tofield) _findradius_tofield = #22;
+entity(vector org, float rad, .entity tofield) _findchainradius_tofield = #22;
#define FOREACH_ENTITY_RADIUS(org, dist, cond, body) FOREACH_ENTITY_RADIUS_UNORDERED(org, dist, cond, body)
-.entity _FOREACH_ENTITY_RADIUS_next;
-noref string _FOREACH_ENTITY_RADIUS_mutex;
-#define FOREACH_ENTITY_RADIUS_UNORDERED(org, dist, cond, body) \
- MACRO_BEGIN { \
- if (_FOREACH_ENTITY_RADIUS_mutex) LOG_SEVEREF("Loop mutex held by %s", _FOREACH_ENTITY_RADIUS_mutex); \
- _FOREACH_ENTITY_RADIUS_mutex = __FUNC__; \
- entity _foundchain_first = _findradius_tofield(org, dist, _FOREACH_ENTITY_RADIUS_next); \
- FOREACH_LIST(_foundchain, _FOREACH_ENTITY_RADIUS_next, cond, body); \
- _FOREACH_ENTITY_RADIUS_mutex = string_null; \
- } MACRO_END
+.entity _FOREACH_ENTITY_FIND_radius_next; noref string _FOREACH_ENTITY_FIND_radius_mutex;
+#define FOREACH_ENTITY_RADIUS_UNORDERED(org, dist, cond, body) _FOREACH_ENTITY_FIND_UNORDERED(, radius, org, dist, cond, body)
#endif
-
-#define FOREACH_ENTITY_CLASS(class, cond, body) ORDERED(FOREACH_ENTITY_CLASS)(class, cond, body)
-#define FOREACH_ENTITY_CLASS_ORDERED(class, cond, body) FOREACH_ENTITY_ORDERED(it.classname == class && (cond), body)
-.entity _FOREACH_ENTITY_CLASS_next;
-noref string _FOREACH_ENTITY_CLASS_mutex;
-#define FOREACH_ENTITY_CLASS_UNORDERED(class, cond, body) \
- MACRO_BEGIN { \
- if (_FOREACH_ENTITY_CLASS_mutex) LOG_SEVEREF("Loop mutex held by %s", _FOREACH_ENTITY_CLASS_mutex); \
- _FOREACH_ENTITY_CLASS_mutex = __FUNC__; \
- entity _foundchain_first = _findchainstring_tofield(classname, class, _FOREACH_ENTITY_CLASS_next); \
- FOREACH_LIST(_foundchain, _FOREACH_ENTITY_CLASS_next, cond, body); \
- _FOREACH_ENTITY_CLASS_mutex = string_null; \
- } MACRO_END
-
-
-
#define FOREACH_ENTITY_FLOAT(fld, match, body) ORDERED(FOREACH_ENTITY_FLOAT)(fld, match, body)
-#define FOREACH_ENTITY_FLOAT_ORDERED(fld, match, body) FOREACH_ENTITY_ORDERED(it.fld == match, body)
-.entity _FOREACH_ENTITY_FLOAT_next;
-noref string _FOREACH_ENTITY_FLOAT_mutex;
-#define FOREACH_ENTITY_FLOAT_UNORDERED(fld, match, body) \
- MACRO_BEGIN { \
- if (_FOREACH_ENTITY_FLOAT_mutex) LOG_SEVEREF("Loop mutex held by %s", _FOREACH_ENTITY_FLOAT_mutex); \
- _FOREACH_ENTITY_FLOAT_mutex = __FUNC__; \
- entity _foundchain_first = _findchainfloat_tofield(fld, match, _FOREACH_ENTITY_FLOAT_next); \
- FOREACH_LIST(_foundchain, _FOREACH_ENTITY_FLOAT_next, true, body); \
- _FOREACH_ENTITY_FLOAT_mutex = string_null; \
- } MACRO_END
-
-
-
-#define FOREACH_ENTITY_FLAGS(fld, match, body) ORDERED(FOREACH_ENTITY_FLAGS)(fld, match, body)
-#define FOREACH_ENTITY_FLAGS_ORDERED(fld, match, body) FOREACH_ENTITY_ORDERED(it.fld & match, body)
-.entity _FOREACH_ENTITY_FLAGS_next;
-noref string _FOREACH_ENTITY_FLAGS_mutex;
-#define FOREACH_ENTITY_FLAGS_UNORDERED(fld, match, body) \
- MACRO_BEGIN { \
- if (_FOREACH_ENTITY_FLAGS_mutex) LOG_SEVEREF("Loop mutex held by %s", _FOREACH_ENTITY_FLAGS_mutex); \
- _FOREACH_ENTITY_FLAGS_mutex = __FUNC__; \
- entity _foundchain_first = _findchainflags_tofield(fld, match, _FOREACH_ENTITY_FLAGS_next); \
- FOREACH_LIST(_foundchain, _FOREACH_ENTITY_FLAGS_next, true, body); \
- _FOREACH_ENTITY_FLAGS_mutex = string_null; \
- } MACRO_END
-
-
+#define FOREACH_ENTITY_FLOAT_ORDERED(fld, match, body) _FOREACH_ENTITY_FIND_ORDERED(float, fld, match, true, body)
+.entity _FOREACH_ENTITY_FIND_float_next; noref string _FOREACH_ENTITY_FIND_float_mutex;
+#define FOREACH_ENTITY_FLOAT_UNORDERED(fld, match, body) _FOREACH_ENTITY_FIND_UNORDERED(, float, fld, match, true, body)
#define FOREACH_ENTITY_ENT(fld, match, body) ORDERED(FOREACH_ENTITY_ENT)(fld, match, body)
-#define FOREACH_ENTITY_ENT_ORDERED(fld, match, body) FOREACH_ENTITY_ORDERED(it.fld == match, body)
-.entity _FOREACH_ENTITY_ENT_next;
-noref string _FOREACH_ENTITY_ENT_mutex;
-#define FOREACH_ENTITY_ENT_UNORDERED(fld, match, body) \
- MACRO_BEGIN { \
- if (_FOREACH_ENTITY_ENT_mutex) LOG_SEVEREF("Loop mutex held by %s", _FOREACH_ENTITY_ENT_mutex); \
- _FOREACH_ENTITY_ENT_mutex = __FUNC__; \
- entity _foundchain_first = _findchainentity_tofield(fld, match, _FOREACH_ENTITY_ENT_next); \
- FOREACH_LIST(_foundchain, _FOREACH_ENTITY_ENT_next, true, body); \
- _FOREACH_ENTITY_ENT_mutex = string_null; \
- } MACRO_END
-
-
+#define FOREACH_ENTITY_ENT_ORDERED(fld, match, body) _FOREACH_ENTITY_FIND_ORDERED(entity, fld, match, true, body)
+.entity _FOREACH_ENTITY_FIND_entity_next; noref string _FOREACH_ENTITY_FIND_entity_mutex;
+#define FOREACH_ENTITY_ENT_UNORDERED(fld, match, body) _FOREACH_ENTITY_FIND_UNORDERED(, entity, fld, match, true, body)
#define FOREACH_ENTITY_STRING(fld, match, body) ORDERED(FOREACH_ENTITY_STRING)(fld, match, body)
-#define FOREACH_ENTITY_STRING_ORDERED(fld, match, body) FOREACH_ENTITY_ORDERED(it.fld == match, body)
-.entity _FOREACH_ENTITY_STRING_next;
-noref string _FOREACH_ENTITY_STRING_mutex;
-#define FOREACH_ENTITY_STRING_UNORDERED(fld, match, body) \
- MACRO_BEGIN { \
- if (_FOREACH_ENTITY_STRING_mutex) LOG_SEVEREF("Loop mutex held by %s", _FOREACH_ENTITY_STRING_mutex); \
- _FOREACH_ENTITY_STRING_mutex = __FUNC__; \
- entity _foundchain_first = _findchainstring_tofield(fld, match, _FOREACH_ENTITY_STRING_next); \
- FOREACH_LIST(_foundchain, _FOREACH_ENTITY_STRING_next, true, body); \
- _FOREACH_ENTITY_STRING_mutex = string_null; \
- } MACRO_END
+#define FOREACH_ENTITY_STRING_ORDERED(fld, match, body) _FOREACH_ENTITY_FIND_ORDERED(string, fld, match, true, body)
+.entity _FOREACH_ENTITY_FIND_string_next; noref string _FOREACH_ENTITY_FIND_string_mutex;
+#define FOREACH_ENTITY_STRING_UNORDERED(fld, match, body) _FOREACH_ENTITY_FIND_UNORDERED(, string, fld, match, true, body)
+
+#define FOREACH_ENTITY_CLASS(class, cond, body) ORDERED(FOREACH_ENTITY_CLASS)(class, cond, body)
+#define FOREACH_ENTITY_CLASS_ORDERED(class, cond, body) _FOREACH_ENTITY_FIND_ORDERED(string, classname, class, cond, body)
+.entity _FOREACH_ENTITY_FIND_string_nextclazz; noref string _FOREACH_ENTITY_FIND_string_clazzmutex;
+#define FOREACH_ENTITY_CLASS_UNORDERED(class, cond, body) _FOREACH_ENTITY_FIND_UNORDERED(clazz, string, classname, class, cond, body)
--- /dev/null
+#include "test.qh"
+
+STRING_ITERATOR(_json, string_null, 0);
+// Store interleaved keys/values in a string buffer
+int _json_buffer;
+// Last read string
+string _json_temp;
+
+/** parse a json object */
+bool _json_parse_object();
+ bool _json_parse_members();
+ bool _json_parse_pair();
+bool _json_parse_array();
+bool _json_parse_value();
+ bool _json_parse_true();
+ bool _json_parse_false();
+ bool _json_parse_null();
+bool _json_parse_string(bool add);
+bool _json_parse_number();
+ bool _json_parse_float();
+ bool _json_parse_int();
+
+#define JSON_BEGIN() int __i = STRING_ITERATOR_SAVE(_json)
+#define JSON_FAIL(reason) goto fail
+#define JSON_END() \
+ return true; \
+:fail \
+ STRING_ITERATOR_LOAD(_json, __i); \
+ return false;
+// Current namespace
+string _json_ns;
+// Current keys
+int _json_keys;
+
+bool _json_parse_object() {
+ JSON_BEGIN();
+ if (STRING_ITERATOR_GET(_json) != '{') JSON_FAIL("expected '{'");
+ WITH(int, _json_keys, bufstr_add(_json_buffer, "", 0), _json_parse_members());
+ if (STRING_ITERATOR_GET(_json) != '}') JSON_FAIL("expected '}'");
+ JSON_END();
+}
+
+ bool _json_parse_members() {
+ JSON_BEGIN();
+ for (;;) {
+ if (!_json_parse_pair()) JSON_FAIL("expected pair");
+ if (STRING_ITERATOR_PEEK(_json) == ',') {
+ STRING_ITERATOR_NEXT(_json);
+ continue;
+ }
+ break;
+ }
+ JSON_END();
+ }
+
+ bool _json_parse_pair() {
+ JSON_BEGIN();
+ if (!_json_parse_string(false)) JSON_FAIL("expected string");
+ string key = _json_temp;
+ bufstr_set(_json_buffer, _json_keys, cons(bufstr_get(_json_buffer, _json_keys), key));
+ key = _json_ns ? strcat(_json_ns, ".", key) : key;
+ bufstr_add(_json_buffer, key, 0);
+ if (STRING_ITERATOR_GET(_json) != ':') JSON_FAIL("expected ':'");
+ bool ret = false; WITH(string, _json_ns, key, ret = _json_parse_value());
+ if (!ret) JSON_FAIL("expected value");
+ JSON_END();
+ }
+
+bool _json_parse_array() {
+ JSON_BEGIN();
+ if (STRING_ITERATOR_GET(_json) != '[') JSON_FAIL("expected '['");
+ int len = bufstr_add(_json_buffer, "0", 0);
+ if (len) bufstr_set(_json_buffer, len - 1, strcat(bufstr_get(_json_buffer, len - 1), ".length"));
+ bool required = false;
+ for (int n = 0; ; n++) {
+ string key = ftos(n);
+ key = _json_ns ? strcat(_json_ns, ".", key) : key;
+ int it = bufstr_add(_json_buffer, key, 0);
+ bool ret = false; WITH(string, _json_ns, key, ret = _json_parse_value());
+ if (!ret) {
+ bufstr_free(_json_buffer, it);
+ if (required) JSON_FAIL("expected value"); else break;
+ }
+ bufstr_set(_json_buffer, len, ftos(n + 1));
+ if (STRING_ITERATOR_PEEK(_json) == ',') {
+ STRING_ITERATOR_NEXT(_json);
+ required = true;
+ continue;
+ }
+ break;
+ }
+ if (STRING_ITERATOR_GET(_json) != ']') JSON_FAIL("expected ']'");
+ JSON_END();
+}
+
+bool _json_parse_value() {
+ JSON_BEGIN();
+ if (!(_json_parse_string(true)
+ || _json_parse_number()
+ || _json_parse_object()
+ || _json_parse_array()
+ || _json_parse_true()
+ || _json_parse_false()
+ || _json_parse_null())) JSON_FAIL("expected value");
+ JSON_END();
+}
+
+ bool _json_parse_true() {
+ JSON_BEGIN();
+ if (!(STRING_ITERATOR_GET(_json) == 't'
+ && STRING_ITERATOR_GET(_json) == 'r'
+ && STRING_ITERATOR_GET(_json) == 'u'
+ && STRING_ITERATOR_GET(_json) == 'e'))
+ JSON_FAIL("expected 'true'");
+ bufstr_add(_json_buffer, "1", 0);
+ JSON_END();
+ }
+
+ bool _json_parse_false() {
+ JSON_BEGIN();
+ if (!(STRING_ITERATOR_GET(_json) == 'f'
+ && STRING_ITERATOR_GET(_json) == 'a'
+ && STRING_ITERATOR_GET(_json) == 'l'
+ && STRING_ITERATOR_GET(_json) == 's'
+ && STRING_ITERATOR_GET(_json) == 'e'))
+ JSON_FAIL("expected 'false'");
+ bufstr_add(_json_buffer, "0", 0);
+ JSON_END();
+ }
+
+ bool _json_parse_null() {
+ JSON_BEGIN();
+ if (!(STRING_ITERATOR_GET(_json) == 'n'
+ && STRING_ITERATOR_GET(_json) == 'u'
+ && STRING_ITERATOR_GET(_json) == 'l'
+ && STRING_ITERATOR_GET(_json) == 'l'))
+ JSON_FAIL("expected 'null'");
+ bufstr_add(_json_buffer, "", 0);
+ JSON_END();
+ }
+
+bool _json_parse_string(bool add) {
+ JSON_BEGIN();
+ if (STRING_ITERATOR_GET(_json) != '"') JSON_FAIL("expected opening '\"'");
+ string s = "";
+ for (int c; (c = STRING_ITERATOR_GET(_json)); ) {
+ if (c == '"') {
+ STRING_ITERATOR_UNGET(_json);
+ break;
+ } else if (c == '\\') {
+ string esc;
+ switch (STRING_ITERATOR_GET(_json)) {
+ default:
+ JSON_FAIL("expected ( '\"' | '\\' | 'n' | 't' )");
+ case '"': esc = "\""; break;
+ case '\\': esc = "\\"; break;
+ case 'n': esc = "\n"; break;
+ case 't': esc = "\t"; break;
+ case 'u': esc = "\\u"; break; // TODO
+ case '/': esc = "/"; break;
+ }
+ s = strcat(s, esc);
+ } else {
+ s = strcat(s, chr2str(c));
+ }
+ }
+ if (STRING_ITERATOR_GET(_json) != '"') JSON_FAIL("expected closing '\"'");
+ if (add) bufstr_add(_json_buffer, s, 0);
+ _json_temp = s;
+ JSON_END();
+}
+
+bool _json_parse_number() {
+ JSON_BEGIN();
+ if (!(_json_parse_float() || _json_parse_int())) JSON_FAIL("expected number");
+ JSON_END();
+}
+
+ bool _json_parse_float() {
+ JSON_BEGIN();
+ string s = "";
+ bool needdot = true;
+ for (int c; (c = STRING_ITERATOR_GET(_json)); ) {
+ if (!(c >= '0' && c <= '9')) {
+ if (c == '.' && needdot) {
+ // fine
+ needdot = false;
+ } else {
+ STRING_ITERATOR_UNGET(_json);
+ break;
+ }
+ }
+ s = strcat(s, chr2str(c));
+ }
+ if (s == "") JSON_FAIL("expected float");
+ bufstr_add(_json_buffer, s, 0);
+ JSON_END();
+ }
+
+ bool _json_parse_int() {
+ JSON_BEGIN();
+ string s = "";
+ for (int c; (c = STRING_ITERATOR_GET(_json)); ) {
+ if (!(c >= '0' && c <= '9')) {
+ STRING_ITERATOR_UNGET(_json);
+ break;
+ }
+ if (s == "" && c == '0') JSON_FAIL("expected [1-9]");
+ s = strcat(s, chr2str(c));
+ }
+ if (s == "") JSON_FAIL("expected int");
+ if (ftos(stof(s)) != s) JSON_FAIL("expected int");
+ bufstr_add(_json_buffer, s, 0);
+ JSON_END();
+ }
+
+int json_parse(string in, bool() func) {
+ string trimmed = "";
+ LABEL(trim) {
+ int o = strstrofs(in, "\"", 0);
+ if (o >= 0) {
+ string part = substring(in, 0, o + 1); in = substring(in, o + 1, -1);
+ part = strreplace(" ", "", part);
+ part = strreplace("\n", "", part);
+ trimmed = strcat(trimmed, part);
+ goto trim_str;
+ } else {
+ string part = in;
+ part = strreplace(" ", "", part);
+ part = strreplace("\n", "", part);
+ trimmed = strcat(trimmed, part);
+ goto done;
+ }
+ }
+ LABEL(trim_str) {
+ int o = strstrofs(in, "\"", 0);
+ int esc = strstrofs(in, "\\\"", 0);
+ if (o < esc || esc < 0) {
+ // simple string
+ string part = substring(in, 0, o + 1); in = substring(in, o + 1, -1);
+ trimmed = strcat(trimmed, part);
+ goto trim;
+ } else {
+ // has escape
+ string part = substring(in, 0, esc + 2); in = substring(in, esc + 2, -1);
+ trimmed = strcat(trimmed, part);
+ goto trim_str;
+ }
+ }
+ LABEL(done);
+
+ STRING_ITERATOR_SET(_json, trimmed, 0);
+ _json_buffer = buf_create();
+ bool ret = func();
+ if (!ret) {
+ buf_del(_json_buffer);
+ _json_buffer = -1;
+ }
+ return _json_buffer;
+}
+
+string json_get(int buf, string key)
+{
+ for (int i = 1, n = buf_getsize(buf); i < n; i += 2) {
+ if (bufstr_get(buf, i) == key) return bufstr_get(buf, i + 1);
+ }
+ return string_null;
+}
+
+void json_del(int buf)
+{
+ buf_del(buf);
+}
+
+void json_dump(int buf)
+{
+ for (int i = 0, n = buf_getsize(buf); i < n; ++i) {
+ print(bufstr_get(buf, i), "\n");
+ }
+}
+
+#undef JSON_BEGIN
+#undef JSON_FAIL
+#undef JSON_END
+
+TEST(json, Parse)
+{
+ string s = "{\n\
+ \"m_string\": \"\\\"string\\\"\",\n\
+ \"m_int\": 123,\n\
+ \"m_bool\": true,\n\
+ \"m_null\": null,\n\
+ \"m_obj\": { },\n\
+ \"m_arr\": [ ]\n}"; // "
+ print(s, "\n");
+ int buf = json_parse(s, _json_parse_object);
+ EXPECT_NE(-1, buf);
+ json_dump(buf);
+ SUCCEED();
+}
string(string...) strcat0n = #115;
#endif
+#define __SOURCELOC__ (sprintf("^9"__FILE__"^7" ":" "^9%s^7" ":" "^9"STR(__LINE__)"^7", __FUNC__))
+
#define _LOG(f, level, s) \
MACRO_BEGIN { \
- f(sprintf("^9[::^7" PROGNAME "^9::" level "^9] [" __FILE__ "^7:^9%s^7:^9" STR(__LINE__) "] \n^7%s\n", __FUNC__, s)); \
+ f(sprintf("^9[::^7" PROGNAME "^9::" level "^9] [%s^9]\n^7%s\n", __SOURCELOC__, s)); \
} MACRO_END
#define LOG_FATAL(...) _LOG_FATAL(strcat0n(__VA_ARGS__))
--- /dev/null
+// generated file; do not modify
+#include "command.qc"
+#include "matrix.qc"
--- /dev/null
+#include "command.qh"
+
+#include <common/command/all.qh>
+
+GENERIC_COMMAND(mx, "Send a matrix command") {
+ switch (argv(1)) {
+ case "user":
+ if (matrix_user) strunzone(matrix_user);
+ matrix_user = strzone(substring(command, argv_start_index(2), -1));
+ break;
+ case "token":
+ if (matrix_access_token) strunzone(matrix_access_token);
+ matrix_access_token = strzone(substring(command, argv_start_index(2), -1));
+ break;
+ case "messages":
+ MX_Messages(string_null);
+ break;
+ case "nick":
+ MX_Nick(substring(command, argv_start_index(2), -1));
+ break;
+ case "join":
+ string s = substring(command, argv_start_index(2), -1);
+ if (s != matrix_room && matrix_room != "") {
+ MX_Leave(matrix_room);
+ strunzone(matrix_room);
+ }
+ matrix_room = strzone(s);
+ MX_Join(matrix_room);
+ break;
+ case "sync":
+ MX_Sync(string_null);
+ break;
+ case "typing":
+ MX_Typing(true);
+ break;
+ case "say":
+ MX_Say(substring(command, argv_start_index(2), -1));
+ break;
+ case "leave":
+ MX_Leave(matrix_room);
+ matrix_room = string_null;
+ break;
+ case "forget":
+ MX_Forget(matrix_room);
+ matrix_room = "";
+ break;
+ }
+}
--- /dev/null
+#pragma once
+
+#include "matrix.qh"
--- /dev/null
+#include "matrix.qh"
+
+.string message;
+
+void MX_Nick_(entity fh, entity pass, int status);
+void MX_Nick(string name)
+{
+ if (!matrix_access_token) return;
+ entity pass = new_pure(mx);
+ pass.message = name;
+ url_single_fopen(
+ sprintf("%s/_matrix/client/r0/profile/%s/displayname?access_token=%s", autocvar_matrix_server, matrix_user, matrix_access_token),
+ FILE_WRITE,
+ MX_Nick_,
+ pass
+ );
+}
+void MX_Nick_(entity fh, entity pass, int status)
+{
+ switch (status) {
+ case URL_READY_CANWRITE: {
+ fh.url_verb = "PUT";
+ fh.url_content_type = "application/json";
+ url_fputs(fh, sprintf("{\"displayname\": \"%s\"}", pass.message));
+ remove(pass);
+ url_fclose(fh);
+ break;
+ }
+ }
+}
+
+
+void MX_Messages_(entity fh, entity pass, int status);
+void MX_Messages(string from)
+{
+ if (!matrix_access_token) return;
+ string s = sprintf("%s/_matrix/client/r0/events?room_id=%s&limit=50&timeout=30000&from=%s&access_token=%s", autocvar_matrix_server, matrix_room, from, matrix_access_token);
+ url_single_fopen(
+ s,
+ FILE_READ,
+ MX_Messages_,
+ NULL
+ );
+}
+void MX_Messages_(entity fh, entity pass, int status)
+{
+ switch (status) {
+ default: {
+ LOG_WARNINGF("status: %d", status);
+ break;
+ }
+ case URL_READY_CLOSED: break;
+ case URL_READY_CANREAD: {
+ string json = "";
+ for (string s; (s = url_fgets(fh)); ) { json = strcat(json, s, "\n"); }
+ url_fclose(fh);
+ int buf = json_parse(json, _json_parse_object);
+ EXPECT_NE(-1, buf);
+ for (int i = 0, n = stof(json_get(buf, "chunk.length")); i < n; ++i) {
+ MX_Handle(buf, sprintf("chunk.%d", i));
+ }
+ MX_Messages(json_get(buf, "end"));
+ break;
+ }
+ }
+}
+
+
+void MX_Sync_(entity fh, entity pass, int status);
+void MX_Sync(string since)
+{
+ if (!matrix_access_token) return;
+ string s = strcat(autocvar_matrix_server, "/_matrix/client/r0/sync?");
+ if (since) {
+ s = strcat(s,
+ "since=", since, "&",
+ "timeout=30000&",
+ sprintf("filter={\"account_data\":{\"types\":[]},\"presence\":{\"types\":[]},\"room\":{\"rooms\":[\"%s\"]}}&", matrix_room)
+ );
+ } else {
+ s = strcat(s,
+ "timeout=0&",
+ "filter={\"account_data\":{\"types\":[]},\"presence\":{\"types\":[]},\"room\":{\"rooms\":[]}}&"
+ );
+ }
+ s = strcat(s, "access_token=", matrix_access_token);
+ url_single_fopen(s, FILE_READ, MX_Sync_, NULL);
+}
+void MX_Sync_(entity fh, entity pass, int status)
+{
+ switch (status) {
+ default: {
+ LOG_WARNINGF("status: %d", status);
+ break;
+ }
+ case URL_READY_CLOSED: break;
+ case URL_READY_CANREAD: {
+ string json = "";
+ for (string s; (s = url_fgets(fh)); ) { json = strcat(json, s, "\n"); }
+ url_fclose(fh);
+ int buf = json_parse(json, _json_parse_object);
+ EXPECT_NE(-1, buf);
+ string arr = sprintf("rooms.join.%s.timeline.events", matrix_room);
+ for (int i = 0, n = stof(json_get(buf, sprintf("%s.length", arr))); i < n; ++i) {
+ MX_Handle(buf, sprintf("%s.%d", arr, i));
+ }
+ MX_Sync(json_get(buf, "next_batch"));
+ break;
+ }
+ }
+}
+
+
+void MX_JLF_(entity fh, entity pass, int status);
+void MX_Join(string room)
+{
+ if (!matrix_access_token) return;
+ url_single_fopen(
+ sprintf("%s/_matrix/client/r0/rooms/%s/join?access_token=%s", autocvar_matrix_server, matrix_room, matrix_access_token),
+ FILE_WRITE,
+ MX_JLF_,
+ NULL
+ );
+}
+void MX_Leave(string room)
+{
+ if (!matrix_access_token) return;
+ url_single_fopen(
+ sprintf("%s/_matrix/client/r0/rooms/%s/leave?access_token=%s", autocvar_matrix_server, matrix_room, matrix_access_token),
+ FILE_WRITE,
+ MX_JLF_,
+ NULL
+ );
+}
+void MX_Forget(string room)
+{
+ if (!matrix_access_token) return;
+ url_single_fopen(
+ sprintf("%s/_matrix/client/r0/rooms/%s/forget?access_token=%s", autocvar_matrix_server, matrix_room, matrix_access_token),
+ FILE_WRITE,
+ MX_JLF_,
+ NULL
+ );
+}
+void MX_JLF_(entity fh, entity pass, int status)
+{
+ switch (status) {
+ case URL_READY_CANWRITE: {
+ fh.url_content_type = "application/json";
+ url_fputs(fh, sprintf("{}", pass.message));
+ url_fclose(fh);
+ break;
+ }
+ }
+}
+
+
+void MX_Typing_(entity fh, entity pass, int status);
+void MX_Typing(bool state)
+{
+ if (!matrix_access_token) return;
+ entity pass = new_pure(mx);
+ pass.message = state ? "true" : "false";
+ url_single_fopen(
+ sprintf("%s/_matrix/client/r0/rooms/%s/typing/%s?access_token=%s", autocvar_matrix_server, matrix_room, matrix_user, matrix_access_token),
+ FILE_WRITE,
+ MX_Typing_,
+ pass
+ );
+}
+void MX_Typing_(entity fh, entity pass, int status)
+{
+ switch (status) {
+ case URL_READY_CANWRITE: {
+ fh.url_verb = "PUT";
+ fh.url_content_type = "application/json";
+ url_fputs(fh, sprintf("{\"typing\": %s, \"timeout\": 30000}", pass.message));
+ remove(pass);
+ url_fclose(fh);
+ break;
+ }
+ }
+}
+
+
+void MX_Say_(entity fh, entity pass, int status);
+void MX_Say(string body)
+{
+ if (!matrix_access_token) return;
+ static int txnid;
+ entity pass = new_pure(mx);
+ pass.message = strzone(body);
+ url_single_fopen(
+ sprintf("%s/_matrix/client/r0/rooms/%s/send/m.room.message/%d?access_token=%s", autocvar_matrix_server, matrix_room, ++txnid, matrix_access_token),
+ FILE_WRITE,
+ MX_Say_,
+ pass
+ );
+}
+void MX_Say_(entity fh, entity pass, int status)
+{
+ switch (status) {
+ case URL_READY_CANWRITE: {
+ fh.url_verb = "PUT";
+ fh.url_content_type = "application/json";
+ url_fputs(fh, sprintf("{\"msgtype\": \"m.text\", \"body\": \"%s\"}", pass.message));
+ strunzone(pass.message); remove(pass);
+ url_fclose(fh);
+ break;
+ }
+ }
+}
--- /dev/null
+#pragma once
+
+string autocvar_matrix_server = "http://matrix.org";
+string matrix_user;
+string matrix_access_token;
+string matrix_room;
+
+void MX_Messages(string from);
+void MX_Nick(string name);
+void MX_Join(string room);
+void MX_Sync(string since);
+void MX_Typing(bool state);
+void MX_Say(string body);
+void MX_Leave(string room);
+void MX_Forget(string room);
+
+var void(int buf, string ancestor) MX_Handle;
#define REGISTER_NET_LINKED(id) \
[[accumulate]] NET_HANDLE(id, bool isnew) \
{ \
- this = self; \
+ this = __self; \
this.sourceLoc = __FILE__ ":" STR(__LINE__); \
if (!this) isnew = true; \
} \
void UncustomizeEntitiesRun()
{
- SELFPARAM();
- FOREACH_ENTITY_FLOAT(uncustomizeentityforclient_set, true, WITH(entity, self, it, it.uncustomizeentityforclient()));
+ FOREACH_ENTITY_FLOAT(uncustomizeentityforclient_set, true, WITHSELF(it, it.uncustomizeentityforclient()));
}
STRING_ITERATOR(g_buf, string_null, 0);
if (pure) {
make_pure(this);
#ifdef CSQC
- setorigin(this, '0 0 10000');
+ setorigin(this, (world.mins + world.maxs) * 0.5);
#endif
#ifdef SVQC
- setorigin(this, '0 0 -10000');
+ setorigin(this, (world.mins + world.maxs) * 0.5);
#endif
}
return this;
entityclass(cname, base); \
class(cname).bool instanceOf##cname; \
bool is_##cname(entity e) { return e.instanceOf##cname; } \
+ void isnt_##cname(entity e) { eprint(e); } \
VTBL(cname, base) \
_INIT_STATIC(cname) \
{ \
// Transition from global 'self' to local 'this'
-[[alias("self")]] entity __self;
-
// Step 1: auto oldself
#if 1
- #define SELFPARAM() noref entity this = __self
- #define setself(s) (__self = s)
- #define self __self
+ #define SELFPARAM() noref const entity this = self
#endif
-// Step 2: check SELFPARAM() is present for functions that use self
-#if 0
- #define SELFPARAM() [[alias("__self")]] noref entity this = __self
- #define setself(s) (__self = s)
- #define self this
+// Step 2: const self
+#if 1
+ #define self (0, self)
+ [[alias("self")]] entity __self;
+ #define setself(s) (__self = s)
+ #define WITHSELF(value, block) WITH(entity, __self, value, (0, block))
+#endif
+
+// Step 3: propagate SELFPARAM()
+#if 1
+ #undef self
+ #define self (this, self)
#endif
-// Step 3: const self
+// Step 4: kill unstructured setself
#if 0
- #define SELFPARAM() noref const entity this = __self
- entity setself(entity e) { return self = e; }
- entity getself() { return self; }
- #define self getself()
+ #undef setself
#endif
-// Step 4: enable when possible
-// TODO: Remove SELFPARAM in favor of a parameter
+// Step 5: this should work
#if 0
- #define SELFPARAM() noref const entity this = __self
- #define self this
+ #define self (0, this)
#endif
+
+// Step 6: Remove SELFPARAM in favor of a parameter
+
+.void(entity this) selftouch;
+void touch_self() { SELFPARAM(); this.selftouch(this); }
+#define settouch(e, f) (e.touch = touch_self, e.selftouch = f)
+
+.void(entity this) selfuse;
+void use_self() { SELFPARAM(); this.selfuse(this); }
+#define setuse(e, f) (e.use = use_self, e.selfuse = f)
+
+.void(entity this) selfthink;
+void think_self() { SELFPARAM(); this.selfthink(this); }
+#define setthink(e, f) (e.think = think_self, e.selfthink = f)
void __spawnfunc_##id(entity this); \
[[accumulate]] void spawnfunc_##id(entity this) \
{ \
- if (self == __spawnfunc_expect) \
+ if (__self == __spawnfunc_expect) \
{ \
/* engine call */ \
__spawnfunc_expect = NULL; \
- this = self; \
+ this = __self; \
} \
else \
{ \
/**
* converts a number to a string with the indicated number of decimals
- * works for up to 10 decimals!
*/
string ftos_decimals(float number, int decimals)
{
// inhibit stupid negative zero
if (number == 0) number = 0;
- // we have sprintf...
return sprintf("%.*f", decimals, number);
}
+/**
+ * converts a number to a string with the minimum number of decimals
+ */
+string ftos_mindecimals(float number)
+{
+ // inhibit stupid negative zero
+ if (number == 0) number = 0;
+ return sprintf("%.7g", number);
+}
+
int vercmp_recursive(string v1, string v2)
{
int dot1 = strstrofs(v1, ".", 0);
#define EXPECT_FALSE(condition) EXPECT_EQ(false, condition)
#define ASSERT_FALSE(condition) ASSERT_EQ(false, condition)
-#define EXPECT_NE(val1, val2) EXPECT_TRUE(val1 != val2)
+#define EXPECT_NE(val1, val2) EXPECT_TRUE((val1) != (val2))
#define ASSERT_NE(val1, val2) _TEST_ASSERT(EXPECT_NE(val1, val2))
-#define EXPECT_LT(val1, val2) EXPECT_TRUE(val1 < val2)
+#define EXPECT_LT(val1, val2) EXPECT_TRUE((val1) < (val2))
#define ASSERT_LT(val1, val2) _TEST_ASSERT(EXPECT_LT(val1, val2))
-#define EXPECT_LE(val1, val2) EXPECT_TRUE(val1 <= val2)
+#define EXPECT_LE(val1, val2) EXPECT_TRUE((val1) <= (val2))
#define ASSERT_LE(val1, val2) _TEST_ASSERT(EXPECT_LE(val1, val2))
-#define EXPECT_GT(val1, val2) EXPECT_TRUE(val1 > val2)
+#define EXPECT_GT(val1, val2) EXPECT_TRUE((val1) > (val2))
#define ASSERT_GT(val1, val2) _TEST_ASSERT(EXPECT_GT(val1, val2))
-#define EXPECT_GE(val1, val2) EXPECT_TRUE(val1 >= val2)
+#define EXPECT_GE(val1, val2) EXPECT_TRUE((val1) >= (val2))
#define ASSERT_GE(val1, val2) _TEST_ASSERT(EXPECT_GE(val1, val2))
#define EXPECT_NO_FATAL_FAILURE(statement) EXPECT_NO_FATAL_FAILURE_(statement, { })
// URLs
.string url_url;
+.string url_content_type;
+.string url_verb;
.float url_wbuf;
.float url_wbufpos;
.float url_rbuf;
// create a writing end that does nothing yet
e = new_pure(url_single_fopen_file);
e.url_url = strzone(url);
+ e.url_content_type = "text/plain";
+ e.url_verb = "";
e.url_fh = URL_FH_CURL;
e.url_wbuf = buf_create();
if (e.url_wbuf < 0)
}
// POST the data
- if (!crypto_uri_postbuf(e.url_url, i + MIN_URL_ID, "text/plain", "", e.url_wbuf, 0))
+ if (!crypto_uri_postbuf(e.url_url, i + MIN_URL_ID, e.url_content_type, e.url_verb, e.url_wbuf, 0))
{
LOG_INFO("url_fclose: failure in crypto_uri_postbuf\n");
e.url_ready(e, e.url_ready_pass, URL_READY_ERROR);
NET_HANDLE(ENT_CLIENT_WARPZONE, bool isnew)
{
warpzone_warpzones_exist = 1;
- if (!self.enemy)
+ if (!this.enemy)
{
- self.enemy = new(warpzone_from);
+ this.enemy = new(warpzone_from);
}
- self.classname = "trigger_warpzone";
+ this.classname = "trigger_warpzone";
int f = ReadByte();
- self.warpzone_isboxy = (f & 1);
+ this.warpzone_isboxy = (f & 1);
if(f & 4)
{
- self.origin_x = ReadCoord();
- self.origin_y = ReadCoord();
- self.origin_z = ReadCoord();
+ this.origin_x = ReadCoord();
+ this.origin_y = ReadCoord();
+ this.origin_z = ReadCoord();
}
else
- self.origin = '0 0 0';
- self.modelindex = ReadShort();
- self.mins_x = ReadCoord();
- self.mins_y = ReadCoord();
- self.mins_z = ReadCoord();
- self.maxs_x = ReadCoord();
- self.maxs_y = ReadCoord();
- self.maxs_z = ReadCoord();
- self.scale = ReadByte() / 16;
- self.enemy.oldorigin_x = ReadCoord();
- self.enemy.oldorigin_y = ReadCoord();
- self.enemy.oldorigin_z = ReadCoord();
- self.enemy.avelocity_x = ReadCoord();
- self.enemy.avelocity_y = ReadCoord();
- self.enemy.avelocity_z = ReadCoord();
- self.oldorigin_x = ReadCoord();
- self.oldorigin_y = ReadCoord();
- self.oldorigin_z = ReadCoord();
- self.avelocity_x = ReadCoord();
- self.avelocity_y = ReadCoord();
- self.avelocity_z = ReadCoord();
+ this.origin = '0 0 0';
+ this.modelindex = ReadShort();
+ this.mins_x = ReadCoord();
+ this.mins_y = ReadCoord();
+ this.mins_z = ReadCoord();
+ this.maxs_x = ReadCoord();
+ this.maxs_y = ReadCoord();
+ this.maxs_z = ReadCoord();
+ this.scale = ReadByte() / 16;
+ this.enemy.oldorigin_x = ReadCoord();
+ this.enemy.oldorigin_y = ReadCoord();
+ this.enemy.oldorigin_z = ReadCoord();
+ this.enemy.avelocity_x = ReadCoord();
+ this.enemy.avelocity_y = ReadCoord();
+ this.enemy.avelocity_z = ReadCoord();
+ this.oldorigin_x = ReadCoord();
+ this.oldorigin_y = ReadCoord();
+ this.oldorigin_z = ReadCoord();
+ this.avelocity_x = ReadCoord();
+ this.avelocity_y = ReadCoord();
+ this.avelocity_z = ReadCoord();
if(f & 2)
{
- self.warpzone_fadestart = ReadShort();
- self.warpzone_fadeend = max(self.warpzone_fadestart + 1, ReadShort());
+ this.warpzone_fadestart = ReadShort();
+ this.warpzone_fadeend = max(this.warpzone_fadestart + 1, ReadShort());
}
else
{
- self.warpzone_fadestart = 0;
- self.warpzone_fadeend = 0;
+ this.warpzone_fadestart = 0;
+ this.warpzone_fadeend = 0;
}
// common stuff
- WarpZone_SetUp(self, self.enemy.oldorigin, self.enemy.avelocity, self.oldorigin, self.avelocity);
+ WarpZone_SetUp(this, this.enemy.oldorigin, this.enemy.avelocity, this.oldorigin, this.avelocity);
// link me
- //setmodel(self, self.model);
- setorigin(self, self.origin);
- setsize(self, self.mins, self.maxs);
+ //setmodel(this, this.model);
+ setorigin(this, this.origin);
+ setsize(this, this.mins, this.maxs);
// how to draw
// engine currently wants this
- setpredraw(self, WarpZone_Fade_PreDraw);
+ setpredraw(this, WarpZone_Fade_PreDraw);
- //self.move_touch = WarpZone_Touch;
+ //this.move_touch = WarpZone_Touch;
return true;
}
NET_HANDLE(ENT_CLIENT_WARPZONE_CAMERA, bool isnew)
{
warpzone_cameras_exist = 1;
- self.classname = "func_warpzone_camera";
+ this.classname = "func_warpzone_camera";
int f = ReadByte();
if(f & 4)
{
- self.origin_x = ReadCoord();
- self.origin_y = ReadCoord();
- self.origin_z = ReadCoord();
+ this.origin_x = ReadCoord();
+ this.origin_y = ReadCoord();
+ this.origin_z = ReadCoord();
}
else
- self.origin = '0 0 0';
- self.modelindex = ReadShort();
- self.mins_x = ReadCoord();
- self.mins_y = ReadCoord();
- self.mins_z = ReadCoord();
- self.maxs_x = ReadCoord();
- self.maxs_y = ReadCoord();
- self.maxs_z = ReadCoord();
- self.scale = ReadByte() / 16;
- self.oldorigin_x = ReadCoord();
- self.oldorigin_y = ReadCoord();
- self.oldorigin_z = ReadCoord();
- self.avelocity_x = ReadCoord();
- self.avelocity_y = ReadCoord();
- self.avelocity_z = ReadCoord();
+ this.origin = '0 0 0';
+ this.modelindex = ReadShort();
+ this.mins_x = ReadCoord();
+ this.mins_y = ReadCoord();
+ this.mins_z = ReadCoord();
+ this.maxs_x = ReadCoord();
+ this.maxs_y = ReadCoord();
+ this.maxs_z = ReadCoord();
+ this.scale = ReadByte() / 16;
+ this.oldorigin_x = ReadCoord();
+ this.oldorigin_y = ReadCoord();
+ this.oldorigin_z = ReadCoord();
+ this.avelocity_x = ReadCoord();
+ this.avelocity_y = ReadCoord();
+ this.avelocity_z = ReadCoord();
if(f & 2)
{
- self.warpzone_fadestart = ReadShort();
- self.warpzone_fadeend = max(self.warpzone_fadestart + 1, ReadShort());
+ this.warpzone_fadestart = ReadShort();
+ this.warpzone_fadeend = max(this.warpzone_fadestart + 1, ReadShort());
}
else
{
- self.warpzone_fadestart = 0;
- self.warpzone_fadeend = 0;
+ this.warpzone_fadestart = 0;
+ this.warpzone_fadeend = 0;
}
// common stuff
- WarpZone_Camera_SetUp(self, self.oldorigin, self.avelocity);
+ WarpZone_Camera_SetUp(this, this.oldorigin, this.avelocity);
// engine currently wants this
- self.drawmask = MASK_NORMAL;
+ this.drawmask = MASK_NORMAL;
// link me
- //setmodel(self, self.model);
- setorigin(self, self.origin);
- setsize(self, self.mins, self.maxs);
+ //setmodel(this, this.model);
+ setorigin(this, this.origin);
+ setsize(this, this.mins, this.maxs);
// how to draw
// engine currently wants this
- setpredraw(self, WarpZone_Fade_PreDraw);
+ setpredraw(this, WarpZone_Fade_PreDraw);
return true;
}
void CL_RotateMoves(vector ang) = #638;
NET_HANDLE(ENT_CLIENT_WARPZONE_TELEPORTED, bool isnew)
{
- self.classname = "warpzone_teleported";
+ this.classname = "warpzone_teleported";
vector v;
v.x = ReadCoord();
v.y = ReadCoord();
v.z = ReadCoord();
return = true;
if (!isnew) return;
- self.warpzone_transform = v;
- setproperty(VF_CL_VIEWANGLES, WarpZone_TransformVAngles(self, getpropertyvec(VF_CL_VIEWANGLES)));
+ this.warpzone_transform = v;
+ setproperty(VF_CL_VIEWANGLES, WarpZone_TransformVAngles(this, getpropertyvec(VF_CL_VIEWANGLES)));
if(checkextension("DP_CSQC_ROTATEMOVES"))
CL_RotateMoves(v);
//CL_RotateMoves('0 90 0');
void WarpZone_FixPMove()
{
- entity e;
- e = WarpZone_Find(pmove_org, pmove_org);
+ entity e = WarpZone_Find(pmove_org, pmove_org);
if(e)
{
pmove_org = WarpZone_TransformOrigin(e, pmove_org);
vector WarpZone_camera_transform(vector org, vector ang)
{SELFPARAM();
vector vf, vr, vu;
- if(self.warpzone_fadestart)
- if(vdist(org - self.origin - 0.5 * (self.mins + self.maxs), >, self.warpzone_fadeend + 400))
+ if(this.warpzone_fadestart)
+ if(vdist(org - this.origin - 0.5 * (this.mins + this.maxs), >, this.warpzone_fadeend + 400))
return org;
// don't transform if zone faded out (plus 400qu safety margin for typical speeds and latencies)
// unneeded on client, on server this helps a lot
vf = v_forward;
vr = v_right;
vu = v_up;
- org = WarpZone_TransformOrigin(self, org);
- vf = WarpZone_TransformVelocity(self, vf);
- vr = WarpZone_TransformVelocity(self, vr);
- vu = WarpZone_TransformVelocity(self, vu);
+ org = WarpZone_TransformOrigin(this, org);
+ vf = WarpZone_TransformVelocity(this, vf);
+ vr = WarpZone_TransformVelocity(this, vr);
+ vu = WarpZone_TransformVelocity(this, vu);
if(autocvar_cl_warpzone_usetrace)
- traceline(self.warpzone_targetorigin, org, MOVE_NOMONSTERS, world);
+ traceline(this.warpzone_targetorigin, org, MOVE_NOMONSTERS, world);
else
- trace_endpos = self.warpzone_targetorigin;
+ trace_endpos = this.warpzone_targetorigin;
v_forward = vf;
v_right = vr;
v_up = vu;
vector WarpZone_Camera_camera_transform(vector org, vector ang)
{SELFPARAM();
// a fixed camera view
- if(self.warpzone_fadestart)
- if(vdist(org - self.origin - 0.5 * (self.mins + self.maxs), >, self.warpzone_fadeend + 400))
+ if(this.warpzone_fadestart)
+ if(vdist(org - this.origin - 0.5 * (this.mins + this.maxs), >, this.warpzone_fadeend + 400))
return org;
// don't transform if zone faded out (plus 400qu safety margin for typical speeds and latencies)
// unneeded on client, on server this helps a lot
- trace_endpos = self.warpzone_origin;
- makevectors(self.warpzone_angles);
- return self.warpzone_origin;
+ trace_endpos = this.warpzone_origin;
+ makevectors(this.warpzone_angles);
+ return this.warpzone_origin;
}
void WarpZone_Camera_SetUp(entity e, vector my_org, vector my_ang) // we assume that e.oldorigin and e.avelocity point to view origin and direction
void WarpZone_RefSys_GC()
{SELFPARAM();
// garbage collect unused reference systems
- self.nextthink = time + 1;
- if(self.owner.WarpZone_refsys != self)
- remove(self);
+ this.nextthink = time + 1;
+ if(this.owner.WarpZone_refsys != this)
+ remove(this);
}
void WarpZone_RefSys_CheckCreate(entity me)
{
float WarpZoneLib_ExactTrigger_Touch()
{SELFPARAM();
- return !WarpZoneLib_BoxTouchesBrush(other.absmin, other.absmax, self, other);
+ return !WarpZoneLib_BoxTouchesBrush(other.absmin, other.absmax, this, other);
}
}
#ifdef SVQC
-bool WarpZone_Teleported_Send(entity to, int sf)
-{SELFPARAM();
+bool WarpZone_Teleported_Send(entity this, entity to, int sf)
+{
WriteHeader(MSG_ENTITY, ENT_CLIENT_WARPZONE_TELEPORTED);
- WriteCoord(MSG_ENTITY, self.angles.x);
- WriteCoord(MSG_ENTITY, self.angles.y);
- WriteCoord(MSG_ENTITY, self.angles.z);
+ WriteCoord(MSG_ENTITY, this.angles.x);
+ WriteCoord(MSG_ENTITY, this.angles.y);
+ WriteCoord(MSG_ENTITY, this.angles.z);
return true;
}
#endif
entity ts = new(warpzone_teleported);
setmodel(ts, MDL_Null);
- ts.SendEntity = WarpZone_Teleported_Send;
+ ts.SendEntity = SendEntity_self;
+ ts.SendEntity3 = WarpZone_Teleported_Send;
ts.SendFlags = 0xFFFFFF;
ts.drawonlytoclient = player;
ts.think = SUB_Remove_self;
return;
#ifdef SVQC
- if(WarpZone_PlaneDist(self, other.origin + other.view_ofs) >= 0) // wrong side of the trigger_warpzone (don't teleport yet)
+ if(WarpZone_PlaneDist(this, other.origin + other.view_ofs) >= 0) // wrong side of the trigger_warpzone (don't teleport yet)
#elif defined(CSQC)
- if(WarpZone_PlaneDist(self, other.move_origin + other.view_ofs) >= 0) // wrong side of the trigger_warpzone (don't teleport yet)
+ if(WarpZone_PlaneDist(this, other.move_origin + other.view_ofs) >= 0) // wrong side of the trigger_warpzone (don't teleport yet)
#endif
return;
#endif
else
f = -1;
- if(WarpZone_Teleport(self, other, f, 0))
+ if(WarpZone_Teleport(this, other, f, 0))
{
#ifdef SVQC
string save1, save2;
activator = other;
- save1 = self.target; self.target = string_null;
- save2 = self.target3; self.target3 = string_null;
+ save1 = this.target; this.target = string_null;
+ save2 = this.target3; this.target3 = string_null;
SUB_UseTargets();
- if (!self.target) self.target = save1;
- if (!self.target3) self.target3 = save2;
+ if (!this.target) this.target = save1;
+ if (!this.target3) this.target3 = save2;
- setself(self.enemy);
- save1 = self.target; self.target = string_null;
- save2 = self.target2; self.target2 = string_null;
+ setself(this.enemy);
+ save1 = this.target; this.target = string_null;
+ save2 = this.target2; this.target2 = string_null;
SUB_UseTargets();
- if (!self.target) self.target = save1;
- if (!self.target2) self.target2 = save2;
+ if (!this.target) this.target = save1;
+ if (!this.target2) this.target2 = save2;
setself(this);
#endif
}
}
#ifdef SVQC
-bool WarpZone_Send(entity to, int sendflags)
-{SELFPARAM();
+bool WarpZone_Send(entity this, entity to, int sendflags)
+{
WriteHeader(MSG_ENTITY, ENT_CLIENT_WARPZONE);
// we must send this flag for clientside to match properly too
int f = 0;
- if(self.warpzone_isboxy)
+ if(this.warpzone_isboxy)
BITSET_ASSIGN(f, 1);
- if(self.warpzone_fadestart)
+ if(this.warpzone_fadestart)
BITSET_ASSIGN(f, 2);
- if(self.origin != '0 0 0')
+ if(this.origin != '0 0 0')
BITSET_ASSIGN(f, 4);
WriteByte(MSG_ENTITY, f);
// we need THESE to render the warpzone (and cull properly)...
if(f & 4)
{
- WriteCoord(MSG_ENTITY, self.origin.x);
- WriteCoord(MSG_ENTITY, self.origin.y);
- WriteCoord(MSG_ENTITY, self.origin.z);
+ WriteCoord(MSG_ENTITY, this.origin.x);
+ WriteCoord(MSG_ENTITY, this.origin.y);
+ WriteCoord(MSG_ENTITY, this.origin.z);
}
- WriteShort(MSG_ENTITY, self.modelindex);
- WriteCoord(MSG_ENTITY, self.mins.x);
- WriteCoord(MSG_ENTITY, self.mins.y);
- WriteCoord(MSG_ENTITY, self.mins.z);
- WriteCoord(MSG_ENTITY, self.maxs.x);
- WriteCoord(MSG_ENTITY, self.maxs.y);
- WriteCoord(MSG_ENTITY, self.maxs.z);
- WriteByte(MSG_ENTITY, bound(1, self.scale * 16, 255));
+ WriteShort(MSG_ENTITY, this.modelindex);
+ WriteCoord(MSG_ENTITY, this.mins.x);
+ WriteCoord(MSG_ENTITY, this.mins.y);
+ WriteCoord(MSG_ENTITY, this.mins.z);
+ WriteCoord(MSG_ENTITY, this.maxs.x);
+ WriteCoord(MSG_ENTITY, this.maxs.y);
+ WriteCoord(MSG_ENTITY, this.maxs.z);
+ WriteByte(MSG_ENTITY, bound(1, this.scale * 16, 255));
// we need THESE to calculate the proper transform
- WriteCoord(MSG_ENTITY, self.warpzone_origin.x);
- WriteCoord(MSG_ENTITY, self.warpzone_origin.y);
- WriteCoord(MSG_ENTITY, self.warpzone_origin.z);
- WriteCoord(MSG_ENTITY, self.warpzone_angles.x);
- WriteCoord(MSG_ENTITY, self.warpzone_angles.y);
- WriteCoord(MSG_ENTITY, self.warpzone_angles.z);
- WriteCoord(MSG_ENTITY, self.warpzone_targetorigin.x);
- WriteCoord(MSG_ENTITY, self.warpzone_targetorigin.y);
- WriteCoord(MSG_ENTITY, self.warpzone_targetorigin.z);
- WriteCoord(MSG_ENTITY, self.warpzone_targetangles.x);
- WriteCoord(MSG_ENTITY, self.warpzone_targetangles.y);
- WriteCoord(MSG_ENTITY, self.warpzone_targetangles.z);
+ WriteCoord(MSG_ENTITY, this.warpzone_origin.x);
+ WriteCoord(MSG_ENTITY, this.warpzone_origin.y);
+ WriteCoord(MSG_ENTITY, this.warpzone_origin.z);
+ WriteCoord(MSG_ENTITY, this.warpzone_angles.x);
+ WriteCoord(MSG_ENTITY, this.warpzone_angles.y);
+ WriteCoord(MSG_ENTITY, this.warpzone_angles.z);
+ WriteCoord(MSG_ENTITY, this.warpzone_targetorigin.x);
+ WriteCoord(MSG_ENTITY, this.warpzone_targetorigin.y);
+ WriteCoord(MSG_ENTITY, this.warpzone_targetorigin.z);
+ WriteCoord(MSG_ENTITY, this.warpzone_targetangles.x);
+ WriteCoord(MSG_ENTITY, this.warpzone_targetangles.y);
+ WriteCoord(MSG_ENTITY, this.warpzone_targetangles.z);
if(f & 2)
{
- WriteShort(MSG_ENTITY, self.warpzone_fadestart);
- WriteShort(MSG_ENTITY, self.warpzone_fadeend);
+ WriteShort(MSG_ENTITY, this.warpzone_fadestart);
+ WriteShort(MSG_ENTITY, this.warpzone_fadeend);
}
return true;
}
-bool WarpZone_Camera_Send(entity to, int sendflags)
-{SELFPARAM();
+bool WarpZone_Camera_Send(entity this, entity to, int sendflags)
+{
int f = 0;
WriteHeader(MSG_ENTITY, ENT_CLIENT_WARPZONE_CAMERA);
- if(self.warpzone_fadestart)
+ if(this.warpzone_fadestart)
BITSET_ASSIGN(f, 2);
- if(self.origin != '0 0 0')
+ if(this.origin != '0 0 0')
BITSET_ASSIGN(f, 4);
WriteByte(MSG_ENTITY, f);
// we need THESE to render the warpzone (and cull properly)...
if(f & 4)
{
- WriteCoord(MSG_ENTITY, self.origin.x);
- WriteCoord(MSG_ENTITY, self.origin.y);
- WriteCoord(MSG_ENTITY, self.origin.z);
+ WriteCoord(MSG_ENTITY, this.origin.x);
+ WriteCoord(MSG_ENTITY, this.origin.y);
+ WriteCoord(MSG_ENTITY, this.origin.z);
}
- WriteShort(MSG_ENTITY, self.modelindex);
- WriteCoord(MSG_ENTITY, self.mins.x);
- WriteCoord(MSG_ENTITY, self.mins.y);
- WriteCoord(MSG_ENTITY, self.mins.z);
- WriteCoord(MSG_ENTITY, self.maxs.x);
- WriteCoord(MSG_ENTITY, self.maxs.y);
- WriteCoord(MSG_ENTITY, self.maxs.z);
- WriteByte(MSG_ENTITY, bound(1, self.scale * 16, 255));
+ WriteShort(MSG_ENTITY, this.modelindex);
+ WriteCoord(MSG_ENTITY, this.mins.x);
+ WriteCoord(MSG_ENTITY, this.mins.y);
+ WriteCoord(MSG_ENTITY, this.mins.z);
+ WriteCoord(MSG_ENTITY, this.maxs.x);
+ WriteCoord(MSG_ENTITY, this.maxs.y);
+ WriteCoord(MSG_ENTITY, this.maxs.z);
+ WriteByte(MSG_ENTITY, bound(1, this.scale * 16, 255));
// we need THESE to calculate the proper transform
- WriteCoord(MSG_ENTITY, self.enemy.origin.x);
- WriteCoord(MSG_ENTITY, self.enemy.origin.y);
- WriteCoord(MSG_ENTITY, self.enemy.origin.z);
- WriteCoord(MSG_ENTITY, self.enemy.angles.x);
- WriteCoord(MSG_ENTITY, self.enemy.angles.y);
- WriteCoord(MSG_ENTITY, self.enemy.angles.z);
+ WriteCoord(MSG_ENTITY, this.enemy.origin.x);
+ WriteCoord(MSG_ENTITY, this.enemy.origin.y);
+ WriteCoord(MSG_ENTITY, this.enemy.origin.z);
+ WriteCoord(MSG_ENTITY, this.enemy.angles.x);
+ WriteCoord(MSG_ENTITY, this.enemy.angles.y);
+ WriteCoord(MSG_ENTITY, this.enemy.angles.z);
if(f & 2)
{
- WriteShort(MSG_ENTITY, self.warpzone_fadestart);
- WriteShort(MSG_ENTITY, self.warpzone_fadeend);
+ WriteShort(MSG_ENTITY, this.warpzone_fadestart);
+ WriteShort(MSG_ENTITY, this.warpzone_fadeend);
}
return true;
// engine now aborts moves on teleport, so this SHOULD not happen any more
// but if this is called from TouchAreaGrid of the projectile moving,
// then this won't do
- if(time == self.warpzone_teleport_time)
+ if(time == this.warpzone_teleport_time)
return true;
#ifdef SVQC
save_inopen = trace_inopen;
save_inwater = trace_inwater;
float f;
- if((f = WarpZone_CheckProjectileImpact(self)) != 0)
+ if((f = WarpZone_CheckProjectileImpact(this)) != 0)
return (f > 0);
trace_dpstartcontents = save_dpstartcontents;
trace_dphitcontents = save_dphitcontents;
#ifdef SVQC
-void WarpZone_InitStep_FindOriginTarget()
-{SELFPARAM();
- if(self.killtarget != "")
+void WarpZone_InitStep_FindOriginTarget(entity this)
+{
+ if(this.killtarget != "")
{
- self.aiment = find(world, targetname, self.killtarget);
- if(self.aiment == world)
+ this.aiment = find(world, targetname, this.killtarget);
+ if(this.aiment == world)
{
error("Warp zone with nonexisting killtarget");
return;
}
- self.killtarget = string_null;
+ this.killtarget = string_null;
}
}
-void WarpZonePosition_InitStep_FindTarget()
-{SELFPARAM();
- if(self.target == "")
+void WarpZonePosition_InitStep_FindTarget(entity this)
+{
+ if(this.target == "")
{
error("Warp zone position with no target");
return;
}
- self.enemy = find(world, targetname, self.target);
- if(self.enemy == world)
+ this.enemy = find(world, targetname, this.target);
+ if(this.enemy == world)
{
error("Warp zone position with nonexisting target");
return;
}
- if(self.enemy.aiment)
+ if(this.enemy.aiment)
{
// already is positioned
error("Warp zone position targeting already oriented warpzone");
return;
}
- self.enemy.aiment = self;
+ this.enemy.aiment = this;
}
void WarpZoneCamera_Think()
{SELFPARAM();
- if(self.warpzone_save_origin != self.origin
- || self.warpzone_save_angles != self.angles
- || self.warpzone_save_eorigin != self.enemy.origin
- || self.warpzone_save_eangles != self.enemy.angles)
+ if(this.warpzone_save_origin != this.origin
+ || this.warpzone_save_angles != this.angles
+ || this.warpzone_save_eorigin != this.enemy.origin
+ || this.warpzone_save_eangles != this.enemy.angles)
{
- WarpZone_Camera_SetUp(self, self.enemy.origin, self.enemy.angles);
- self.warpzone_save_origin = self.origin;
- self.warpzone_save_angles = self.angles;
- self.warpzone_save_eorigin = self.enemy.origin;
- self.warpzone_save_eangles = self.enemy.angles;
+ WarpZone_Camera_SetUp(this, this.enemy.origin, this.enemy.angles);
+ this.warpzone_save_origin = this.origin;
+ this.warpzone_save_angles = this.angles;
+ this.warpzone_save_eorigin = this.enemy.origin;
+ this.warpzone_save_eangles = this.enemy.angles;
}
- self.nextthink = time;
+ this.nextthink = time;
}
-void WarpZoneCamera_InitStep_FindTarget()
-{SELFPARAM();
+void WarpZoneCamera_InitStep_FindTarget(entity this)
+{
entity e;
float i;
- if(self.target == "")
+ if(this.target == "")
{
error("Camera with no target");
return;
}
- self.enemy = world;
- for(e = world, i = 0; (e = find(e, targetname, self.target)); )
+ this.enemy = world;
+ for(e = world, i = 0; (e = find(e, targetname, this.target)); )
if(random() * ++i < 1)
- self.enemy = e;
- if(self.enemy == world)
+ this.enemy = e;
+ if(this.enemy == world)
{
error("Camera with nonexisting target");
return;
}
warpzone_cameras_exist = 1;
- WarpZone_Camera_SetUp(self, self.enemy.origin, self.enemy.angles);
- self.SendFlags = 0xFFFFFF;
- if(self.spawnflags & 1)
+ WarpZone_Camera_SetUp(this, this.enemy.origin, this.enemy.angles);
+ this.SendFlags = 0xFFFFFF;
+ if(this.spawnflags & 1)
{
- self.think = WarpZoneCamera_Think;
- self.nextthink = time;
+ this.think = WarpZoneCamera_Think;
+ this.nextthink = time;
}
else
- self.nextthink = 0;
+ this.nextthink = 0;
}
-void WarpZone_InitStep_UpdateTransform()
-{SELFPARAM();
+void WarpZone_InitStep_UpdateTransform(entity this)
+{
vector org, ang, norm, point;
float area;
vector tri, a, b, c, n;
float i_s, i_t, n_t;
string tex;
- org = self.origin;
+ org = this.origin;
if(org == '0 0 0')
- org = 0.5 * (self.mins + self.maxs);
+ org = 0.5 * (this.mins + this.maxs);
norm = point = '0 0 0';
area = 0;
for(i_s = 0; ; ++i_s)
{
- tex = getsurfacetexture(self, i_s);
+ tex = getsurfacetexture(this, i_s);
if (!tex)
break; // this is beyond the last one
if(tex == "textures/common/trigger" || tex == "trigger")
continue;
- n_t = getsurfacenumtriangles(self, i_s);
+ n_t = getsurfacenumtriangles(this, i_s);
for(i_t = 0; i_t < n_t; ++i_t)
{
- tri = getsurfacetriangle(self, i_s, i_t);
- a = getsurfacepoint(self, i_s, tri.x);
- b = getsurfacepoint(self, i_s, tri.y);
- c = getsurfacepoint(self, i_s, tri.z);
+ tri = getsurfacetriangle(this, i_s, i_t);
+ a = getsurfacepoint(this, i_s, tri.x);
+ b = getsurfacepoint(this, i_s, tri.y);
+ c = getsurfacepoint(this, i_s, tri.z);
n = cross(c - a, b - a);
area = area + vlen(n);
norm = norm + n;
point = point * (1 / (3 * area));
if(vdist(norm, <, 0.99))
{
- LOG_INFO("trigger_warpzone near ", vtos(self.aiment.origin), " is nonplanar. BEWARE.\n");
+ LOG_INFO("trigger_warpzone near ", vtos(this.aiment.origin), " is nonplanar. BEWARE.\n");
area = 0; // no autofixing in this case
}
norm = normalize(norm);
}
ang = '0 0 0';
- if(self.aiment)
+ if(this.aiment)
{
- org = self.aiment.origin;
- ang = self.aiment.angles;
+ org = this.aiment.origin;
+ ang = this.aiment.angles;
if(area > 0)
{
org = org - ((org - point) * norm) * norm; // project to plane
makevectors(ang);
if(norm * v_forward < 0)
{
- LOG_INFO("Position target of trigger_warpzone near ", vtos(self.aiment.origin), " points into trigger_warpzone. BEWARE.\n");
+ LOG_INFO("Position target of trigger_warpzone near ", vtos(this.aiment.origin), " points into trigger_warpzone. BEWARE.\n");
norm = -1 * norm;
}
ang = vectoangles2(norm, v_up); // keep rotation, but turn exactly against plane
ang.x = -ang.x;
if(norm * v_forward < 0.99)
- LOG_INFO("trigger_warpzone near ", vtos(self.aiment.origin), " has been turned to match plane orientation (", vtos(self.aiment.angles), " -> ", vtos(ang), "\n");
- if(vdist(org - self.aiment.origin, >, 0.5))
- LOG_INFO("trigger_warpzone near ", vtos(self.aiment.origin), " has been moved to match the plane (", vtos(self.aiment.origin), " -> ", vtos(org), ").\n");
+ LOG_INFO("trigger_warpzone near ", vtos(this.aiment.origin), " has been turned to match plane orientation (", vtos(this.aiment.angles), " -> ", vtos(ang), "\n");
+ if(vdist(org - this.aiment.origin, >, 0.5))
+ LOG_INFO("trigger_warpzone near ", vtos(this.aiment.origin), " has been moved to match the plane (", vtos(this.aiment.origin), " -> ", vtos(org), ").\n");
}
}
else if(area > 0)
else
error("cannot infer origin/angles for this warpzone, please use a killtarget or a trigger_warpzone_position");
- self.warpzone_origin = org;
- self.warpzone_angles = ang;
+ this.warpzone_origin = org;
+ this.warpzone_angles = ang;
}
-void WarpZone_InitStep_ClearTarget()
-{SELFPARAM();
- if(self.enemy)
- self.enemy.enemy = world;
- self.enemy = world;
+void WarpZone_InitStep_ClearTarget(entity this)
+{
+ if(this.enemy)
+ this.enemy.enemy = world;
+ this.enemy = world;
}
entity warpzone_first; .entity warpzone_next;
-void WarpZone_InitStep_FindTarget()
-{SELFPARAM();
+void WarpZone_InitStep_FindTarget(entity this)
+{
float i;
entity e, e2;
- if(self.enemy)
+ if(this.enemy)
return;
// this way only one of the two ents needs to target
- if(self.target != "")
+ if(this.target != "")
{
- self.enemy = self; // so the if(!e.enemy) check also skips self, saves one IF
+ this.enemy = this; // so the if(!e.enemy) check also skips this, saves one IF
e2 = world;
- for(e = world, i = 0; (e = find(e, targetname, self.target)); )
+ for(e = world, i = 0; (e = find(e, targetname, this.target)); )
if(!e.enemy)
- if(e.classname == self.classname) // possibly non-warpzones may use the same targetname!
+ if(e.classname == this.classname) // possibly non-warpzones may use the same targetname!
if(random() * ++i < 1)
e2 = e;
if(!e2)
{
- self.enemy = world;
+ this.enemy = world;
error("Warpzone with non-existing target");
return;
}
- self.enemy = e2;
- e2.enemy = self;
+ this.enemy = e2;
+ e2.enemy = this;
}
}
void WarpZone_Think();
-void WarpZone_InitStep_FinalizeTransform()
-{SELFPARAM();
- if(!self.enemy || self.enemy.enemy != self)
+void WarpZone_InitStep_FinalizeTransform(entity this)
+{
+ if(!this.enemy || this.enemy.enemy != this)
{
error("Invalid warp zone detected. Killed.");
return;
}
warpzone_warpzones_exist = 1;
- WarpZone_SetUp(self, self.warpzone_origin, self.warpzone_angles, self.enemy.warpzone_origin, self.enemy.warpzone_angles);
- self.touch = WarpZone_Touch;
- self.SendFlags = 0xFFFFFF;
- if(self.spawnflags & 1)
+ WarpZone_SetUp(this, this.warpzone_origin, this.warpzone_angles, this.enemy.warpzone_origin, this.enemy.warpzone_angles);
+ this.touch = WarpZone_Touch;
+ this.SendFlags = 0xFFFFFF;
+ if(this.spawnflags & 1)
{
- self.think = WarpZone_Think;
- self.nextthink = time;
+ this.think = WarpZone_Think;
+ this.nextthink = time;
}
else
- self.nextthink = 0;
+ this.nextthink = 0;
}
float warpzone_initialized;
spawnfunc(misc_warpzone_position)
{
// "target", "angles", "origin"
- self.warpzone_next = warpzone_position_first;
- warpzone_position_first = self;
+ this.warpzone_next = warpzone_position_first;
+ warpzone_position_first = this;
}
spawnfunc(trigger_warpzone_position)
{
// the map, with another killtarget to designate its
// orientation
- if(!self.scale)
- self.scale = self.modelscale;
- if(!self.scale)
- self.scale = 1;
+ if(!this.scale)
+ this.scale = this.modelscale;
+ if(!this.scale)
+ this.scale = 1;
string m;
- m = self.model;
+ m = this.model;
WarpZoneLib_ExactTrigger_Init();
if(m != "")
{
precache_model(m);
- _setmodel(self, m); // no precision needed
+ _setmodel(this, m); // no precision needed
}
- setorigin(self, self.origin);
- if(self.scale)
- setsize(self, self.mins * self.scale, self.maxs * self.scale);
+ setorigin(this, this.origin);
+ if(this.scale)
+ setsize(this, this.mins * this.scale, this.maxs * this.scale);
else
- setsize(self, self.mins, self.maxs);
- self.SendEntity = WarpZone_Send;
- self.SendFlags = 0xFFFFFF;
- BITSET_ASSIGN(self.effects, EF_NODEPTHTEST);
- self.warpzone_next = warpzone_first;
- warpzone_first = self;
+ setsize(this, this.mins, this.maxs);
+ this.SendEntity = SendEntity_self;
+ this.SendEntity3 = WarpZone_Send;
+ this.SendFlags = 0xFFFFFF;
+ BITSET_ASSIGN(this.effects, EF_NODEPTHTEST);
+ this.warpzone_next = warpzone_first;
+ warpzone_first = this;
}
spawnfunc(func_camera)
{
- if(!self.scale)
- self.scale = self.modelscale;
- if(!self.scale)
- self.scale = 1;
- if(self.model != "")
+ if(!this.scale)
+ this.scale = this.modelscale;
+ if(!this.scale)
+ this.scale = 1;
+ if(this.model != "")
{
- precache_model(self.model);
- _setmodel(self, self.model); // no precision needed
+ precache_model(this.model);
+ _setmodel(this, this.model); // no precision needed
}
- setorigin(self, self.origin);
- if(self.scale)
- setsize(self, self.mins * self.scale, self.maxs * self.scale);
+ setorigin(this, this.origin);
+ if(this.scale)
+ setsize(this, this.mins * this.scale, this.maxs * this.scale);
else
- setsize(self, self.mins, self.maxs);
- if(!self.solid)
- self.solid = SOLID_BSP;
- else if(self.solid < 0)
- self.solid = SOLID_NOT;
- self.SendEntity = WarpZone_Camera_Send;
- self.SendFlags = 0xFFFFFF;
- self.warpzone_next = warpzone_camera_first;
- warpzone_camera_first = self;
+ setsize(this, this.mins, this.maxs);
+ if(!this.solid)
+ this.solid = SOLID_BSP;
+ else if(this.solid < 0)
+ this.solid = SOLID_NOT;
+ this.SendEntity = SendEntity_self;
+ this.SendEntity3 = WarpZone_Camera_Send;
+ this.SendFlags = 0xFFFFFF;
+ this.warpzone_next = warpzone_camera_first;
+ warpzone_camera_first = this;
}
void WarpZones_Reconnect()
-{SELFPARAM();
- for(setself(warpzone_first); self; setself(self.warpzone_next))
- WarpZone_InitStep_ClearTarget();
- for(setself(warpzone_first); self; setself(self.warpzone_next))
- WarpZone_InitStep_FindTarget();
- for(setself(warpzone_camera_first); self; setself(self.warpzone_next))
- WarpZoneCamera_InitStep_FindTarget();
- for(setself(warpzone_first); self; setself(self.warpzone_next))
- WarpZone_InitStep_FinalizeTransform();
- setself(this);
+{
+ for(entity e = warpzone_first; e; e = e.warpzone_next)
+ WarpZone_InitStep_ClearTarget(e);
+ for(entity e = warpzone_first; e; e = e.warpzone_next)
+ WarpZone_InitStep_FindTarget(e);
+ for(entity e = warpzone_camera_first; e; e = e.warpzone_next)
+ WarpZoneCamera_InitStep_FindTarget(e);
+ for(entity e = warpzone_first; e; e = e.warpzone_next)
+ WarpZone_InitStep_FinalizeTransform(e);
}
void WarpZone_Think()
{SELFPARAM();
- if(self.warpzone_save_origin != self.origin
- || self.warpzone_save_angles != self.angles
- || self.warpzone_save_eorigin != self.enemy.origin
- || self.warpzone_save_eangles != self.enemy.angles)
+ if(this.warpzone_save_origin != this.origin
+ || this.warpzone_save_angles != this.angles
+ || this.warpzone_save_eorigin != this.enemy.origin
+ || this.warpzone_save_eangles != this.enemy.angles)
{
- WarpZone_InitStep_UpdateTransform();
- setself(self.enemy);
- WarpZone_InitStep_UpdateTransform();
- setself(this);
- WarpZone_InitStep_FinalizeTransform();
- setself(self.enemy);
- WarpZone_InitStep_FinalizeTransform();
- setself(this);
- self.warpzone_save_origin = self.origin;
- self.warpzone_save_angles = self.angles;
- self.warpzone_save_eorigin = self.enemy.origin;
- self.warpzone_save_eangles = self.enemy.angles;
- }
- self.nextthink = time;
+ WarpZone_InitStep_UpdateTransform(this);
+ WarpZone_InitStep_UpdateTransform(this.enemy);
+ WarpZone_InitStep_FinalizeTransform(this);
+ WarpZone_InitStep_FinalizeTransform(this.enemy);
+ this.warpzone_save_origin = this.origin;
+ this.warpzone_save_angles = this.angles;
+ this.warpzone_save_eorigin = this.enemy.origin;
+ this.warpzone_save_eangles = this.enemy.angles;
+ }
+ this.nextthink = time;
}
void WarpZone_StartFrame()
if (!warpzone_initialized)
{
warpzone_initialized = true;
- for (setself(warpzone_first); self; setself(self.warpzone_next))
- WarpZone_InitStep_FindOriginTarget();
- for (setself(warpzone_position_first); self; setself(self.warpzone_next))
- WarpZonePosition_InitStep_FindTarget();
- for (setself(warpzone_first); self; setself(self.warpzone_next))
- WarpZone_InitStep_UpdateTransform();
- setself(this);
+ for(entity e = warpzone_first; e; e = e.warpzone_next)
+ WarpZone_InitStep_FindOriginTarget(e);
+ for(entity e = warpzone_position_first; e; e = e.warpzone_next)
+ WarpZonePosition_InitStep_FindTarget(e);
+ for(entity e = warpzone_first; e; e = e.warpzone_next)
+ WarpZone_InitStep_UpdateTransform(e);
WarpZones_Reconnect();
WarpZone_PostInitialize_Callback();
}
entity oldother = other;
- FOREACH_ENTITY(true,
+ FOREACH_ENTITY(!is_pure(it),
{
if(warpzone_warpzones_exist)
WarpZone_StoreProjectileData(it);
}
void trigger_warpzone_reconnect_use()
{SELFPARAM();
- entity e;
- e = self;
// NOTE: this matches for target, not targetname, but of course
// targetname must be set too on the other entities
- for(setself(warpzone_first); self; setself(self.warpzone_next))
- self.warpzone_reconnecting = ((e.target == "" || self.target == e.target) && !((e.spawnflags & 1) && (visible_to_some_client(self) || visible_to_some_client(self.enemy))));
- for(setself(warpzone_camera_first); self; setself(self.warpzone_next))
- self.warpzone_reconnecting = ((e.target == "" || self.target == e.target) && !((e.spawnflags & 1) && visible_to_some_client(self)));
- for(setself(warpzone_first); self; setself(self.warpzone_next))
- if(self.warpzone_reconnecting)
- WarpZone_InitStep_ClearTarget();
- for(setself(warpzone_first); self; setself(self.warpzone_next))
- if(self.warpzone_reconnecting)
- WarpZone_InitStep_FindTarget();
- for(setself(warpzone_camera_first); self; setself(self.warpzone_next))
- if(self.warpzone_reconnecting)
- WarpZoneCamera_InitStep_FindTarget();
- for(setself(warpzone_first); self; setself(self.warpzone_next))
- if(self.warpzone_reconnecting || self.enemy.warpzone_reconnecting)
- WarpZone_InitStep_FinalizeTransform();
- setself(e);
+ for(entity e = warpzone_first; e; e = e.warpzone_next)
+ e.warpzone_reconnecting = ((this.target == "" || e.target == this.target) && !((this.spawnflags & 1) && (visible_to_some_client(e) || visible_to_some_client(e.enemy))));
+ for(entity e = warpzone_camera_first; e; e = e.warpzone_next)
+ e.warpzone_reconnecting = ((this.target == "" || e.target == this.target) && !((this.spawnflags & 1) && visible_to_some_client(e)));
+ for(entity e = warpzone_first; e; e = e.warpzone_next)
+ if(e.warpzone_reconnecting)
+ WarpZone_InitStep_ClearTarget(e);
+ for(entity e = warpzone_first; e; e = e.warpzone_next)
+ if(e.warpzone_reconnecting)
+ WarpZone_InitStep_FindTarget(e);
+ for(entity e = warpzone_camera_first; e; e = e.warpzone_next)
+ if(e.warpzone_reconnecting)
+ WarpZoneCamera_InitStep_FindTarget(e);
+ for(entity e = warpzone_first; e; e = e.warpzone_next)
+ if(e.warpzone_reconnecting || e.enemy.warpzone_reconnecting)
+ WarpZone_InitStep_FinalizeTransform(e);
}
spawnfunc(trigger_warpzone_reconnect)
{
- self.use = trigger_warpzone_reconnect_use;
+ this.use = trigger_warpzone_reconnect_use;
}
spawnfunc(target_warpzone_reconnect)
spawnfunc_trigger_warpzone_reconnect(this); // both names make sense here :(
}
-void WarpZone_PlayerPhysics_FixVAngle()
-{SELFPARAM();
+void WarpZone_PlayerPhysics_FixVAngle(entity this)
+{
#ifndef WARPZONE_DONT_FIX_VANGLE
- if(IS_REAL_CLIENT(self))
- if(self.v_angle.z <= 360) // if not already adjusted
- if(time - self.ping * 0.001 < self.warpzone_teleport_time)
+ if(IS_REAL_CLIENT(this))
+ if(this.v_angle.z <= 360) // if not already adjusted
+ if(time - this.ping * 0.001 < this.warpzone_teleport_time)
{
- self.v_angle = WarpZone_TransformVAngles(self.warpzone_teleport_zone, self.v_angle);
- self.v_angle_z += 720; // mark as adjusted
+ this.v_angle = WarpZone_TransformVAngles(this.warpzone_teleport_zone, this.v_angle);
+ this.v_angle_z += 720; // mark as adjusted
}
#endif
}
//const float ENT_CLIENT_WARPZONE;
//const float ENT_CLIENT_WARPZONE_CAMERA;
-void WarpZone_PlayerPhysics_FixVAngle();
+void WarpZone_PlayerPhysics_FixVAngle(entity this);
void WarpZone_PostInitialize_Callback();
#endif
void WarpZoneLib_ExactTrigger_Init()
{SELFPARAM();
vector mi, ma;
- if (self.movedir == '0 0 0')
- if (self.angles != '0 0 0')
+ if (this.movedir == '0 0 0')
+ if (this.angles != '0 0 0')
{
- makevectors (self.angles);
- self.movedir = v_forward;
+ makevectors (this.angles);
+ this.movedir = v_forward;
}
- if(self.model == "")
+ if(this.model == "")
{
// It's a box! No need to match with exacttriggers.
- self.warpzone_isboxy = 1;
+ this.warpzone_isboxy = 1;
}
else
{
- mi = self.mins;
- ma = self.maxs;
- precache_model(self.model);
- _setmodel(self, self.model);
+ mi = this.mins;
+ ma = this.maxs;
+ precache_model(this.model);
+ _setmodel(this, this.model);
// let mapper-set mins/maxs override the model's bounds if set
if(mi != '0 0 0' || ma != '0 0 0')
{
// It's a box! No need to match with exacttriggers.
- self.mins = mi;
- self.maxs = ma;
- self.warpzone_isboxy = 1;
+ this.mins = mi;
+ this.maxs = ma;
+ this.warpzone_isboxy = 1;
}
}
- setorigin(self, self.origin);
- if(self.scale)
- setsize(self, self.mins * self.scale, self.maxs * self.scale);
+ setorigin(this, this.origin);
+ if(this.scale)
+ setsize(this, this.mins * this.scale, this.maxs * this.scale);
else
- setsize(self, self.mins, self.maxs);
- self.movetype = MOVETYPE_NONE;
- self.solid = SOLID_TRIGGER;
- self.model = "";
+ setsize(this, this.mins, this.maxs);
+ this.movetype = MOVETYPE_NONE;
+ this.solid = SOLID_TRIGGER;
+ this.model = "";
}
// generated file; do not modify
#include "draw.qc"
#include "item.qc"
+#include "matrix.qc"
#include "menu.qc"
{
LOG_INFO(_("Available options:\n"));
- FOREACH_ENTITY_ORDERED(it.name != "", LAMBDA(
+ FOREACH_ENTITY_ORDERED(it.name != "", {
if (it.classname == "vtbl") continue;
string s = it.name;
if (filter)
s = substring(s, strlen(filter), strlen(s) - strlen(filter));
}
LOG_INFOF(" %s\n", s);
- ));
+ });
}
else if (argc == 2 && !isdemo()) // don't allow this command in demos
{
--- /dev/null
+var void MX_Handle(int buf, string ancestor)
+{
+ string type = json_get(buf, strcat(ancestor, ".type"));
+ switch (type) {
+ case "m.typing": {
+ string arr = strcat(ancestor, ".content.user_ids");
+ for (int i = 0, n = stof(json_get(buf, sprintf("%s.length", arr))); i < n; ++i) {
+ string s = json_get(buf, sprintf("%s.%d", arr, i));
+ print("\{1}", s, " is typing...\n");
+ }
+ break;
+ }
+ case "m.room.message": {
+ string msgtype = json_get(buf, strcat(ancestor, ".content.msgtype"));
+ switch (msgtype) {
+ case "m.text": {
+ string sender = json_get(buf, strcat(ancestor, ".sender"));
+ string body = json_get(buf, strcat(ancestor, ".content.body"));
+ if (body) print("\{1}", sender, ": ", body, "\n");
+ break;
+ }
+ }
+ break;
+ }
+ }
+}
void m_draw(float width, float height)
{
+ if (clientstate() == CS_DISCONNECTED) m_toggle(true);
m_gamestatus();
execute_next_frame();
void Shutdown()
{
m_hide();
- FOREACH_ENTITY_ORDERED(it.destroy, LAMBDA(
+ FOREACH_ENTITY_ORDERED(it.destroy, {
if (it.classname == "vtbl") continue;
it.destroy(it);
- ));
+ });
}
void m_focus_item_chain(entity outermost, entity innermost)
return;
if(me.checked)
- cvar_set(me.cvarName, ftos(me.yesValue));
+ cvar_set(me.cvarName, ftos_mindecimals(me.yesValue));
else
- cvar_set(me.cvarName, ftos(me.noValue));
+ cvar_set(me.cvarName, ftos_mindecimals(me.noValue));
CheckSendCvars(me, me.cvarName);
}
DIALOG_HUDPANEL_COMMON();
+ me.TR(me);
+ me.TD(me, 1, 4, e = makeXonoticCheckBox(0, "hud_panel_healtharmor_combined", _("Combine health and armor")));
me.TR(me);
me.TD(me, 1, 4, e = makeXonoticCheckBox(0, "hud_panel_healtharmor_progressbar", _("Enable status bar")));
me.TR(me);
ATTRIB(XonoticHUDHealthArmorDialog, title, string, _("Health/Armor Panel"))
ATTRIB(XonoticHUDHealthArmorDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
ATTRIB(XonoticHUDHealthArmorDialog, intendedWidth, float, 0.4)
- ATTRIB(XonoticHUDHealthArmorDialog, rows, float, 15)
+ ATTRIB(XonoticHUDHealthArmorDialog, rows, float, 16)
ATTRIB(XonoticHUDHealthArmorDialog, columns, float, 4)
ATTRIB(XonoticHUDHealthArmorDialog, name, string, "HUDhealtharmor")
ATTRIB(XonoticHUDHealthArmorDialog, requiresConnection, float, true)
me.TR(me);
me.TD(me, 1, 1, e = makeXonoticCheckBox_T(1, "mod_q3bsp_nolightmaps", _("Use lightmaps"),
_("Use high resolution lightmaps, which will look pretty but use up some extra video memory (default: enabled)")));
+ e.applyButton = effectsApplyButton;
me.TD(me, 1, 1, e = makeXonoticCheckBox_T(0, "r_glsl_deluxemapping", _("Deluxe mapping"),
_("Use per-pixel lighting effects (default: enabled)")));
setDependentAND(e, "vid_gl20", 1, 1, "mod_q3bsp_nolightmaps", 0, 0);
e.addValue(e, _("4x"), "4");
e.configureXonoticTextSliderValues(e);
setDependent(e, "r_viewfbo", 0, 0);
+ e.applyButton = videoApplyButton;
me.TR(me);
me.TD(me, 1, 3, e = makeXonoticCheckBoxEx(2, 0, "r_viewfbo", _("High-quality frame buffer")));
setDependent(e, "vid_samples", 1, 1);
_("Make the CPU wait for the GPU to finish each frame, can help with some strange input or video lag on some machines (default: disabled)")));
me.TR(me);
me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "vid_gl20", _("Use OpenGL 2.0 shaders (GLSL)")));
+ e.applyButton = videoApplyButton;
me.TR(me);
me.TDempty(me, 0.2);
me.TD(me, 1, 2.8, e = makeXonoticCheckBox_T(0, "v_glslgamma", _("Use GLSL to handle color control"),
if (!me.cvarName)
return;
- cvar_set(me.cvarName, ftos(me.value));
+ cvar_set(me.cvarName, ftos_mindecimals(me.value));
CheckSendCvars(me, me.cvarName);
}
#define IS_OBSERVER(v) ((v).classname == STR_OBSERVER)
#define IS_CLIENT(v) (v.flags & FL_CLIENT)
+/** want: (IS_CLIENT(v) && !IS_REAL_CLIENT(v)) */
#define IS_BOT_CLIENT(v) (clienttype(v) == CLIENTTYPE_BOT)
+#define IS_FAKE_CLIENT(v) (clienttype(v) == CLIENTTYPE_NOTACLIENT)
#define IS_REAL_CLIENT(v) (clienttype(v) == CLIENTTYPE_REAL)
-#define IS_NOT_A_CLIENT(v) (clienttype(v) == CLIENTTYPE_NOTACLIENT)
+/** was: (clienttype(v) == CLIENTTYPE_NOTACLIENT) */
+#define IS_NOT_A_CLIENT(v) (!IS_CLIENT(v))
#define IS_MONSTER(v) (v.flags & FL_MONSTER)
#define IS_VEHICLE(v) (v.vehicle_flags & VHF_ISVEHICLE)
#include "ipban.qc"
#include "item_key.qc"
#include "mapvoting.qc"
+#include "matrix.qc"
#include "miscfunctions.qc"
#include "playerdemo.qc"
#include "portals.qc"
{
if (e.vehicle) {
if (e.vehicle.vehicle_flags == VHF_PLAYERSLOT) return;
- antilag_takeback(e.vehicle, store, t);
+ antilag_takeback(e.vehicle, e.vehicle, t);
}
if (!store.antilag_takenback)
bool autocvar_sv_curl_serverpackages_auto;
bool autocvar_sv_db_saveasdump;
bool autocvar_sv_defaultcharacter;
+bool autocvar_sv_defaultcharacterskin;
string autocvar_sv_defaultplayercolors;
string autocvar_sv_defaultplayermodel;
string autocvar_sv_defaultplayermodel_blue;
{
currentbots = currentbots + 1;
bot_setnameandstuff(bot);
- WITH(entity, self, bot, ClientConnect());
- WITH(entity, self, bot, PutClientInServer());
+ WITHSELF(bot, ClientConnect());
+ WITHSELF(bot, PutClientInServer());
}
return bot;
}
void SV_ParseClientCommand(string s);
float bot_cmd_cc(entity this)
{
- WITH(entity, self, this, SV_ParseClientCommand(bot_cmd.bot_cmd_parm_string));
+ WITHSELF(this, SV_ParseClientCommand(bot_cmd.bot_cmd_parm_string));
return CMD_STATUS_FINISHED;
}
w = new(waypoint);
w.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY | DPCONTENTS_PLAYERCLIP | DPCONTENTS_BOTCLIP;
w.wpflags = f;
+ w.solid = SOLID_TRIGGER;
setorigin(w, (m1 + m2) * 0.5);
setsize(w, m1 - w.origin, m2 - w.origin);
if (vlen(w.size) > 0)
cheatcount_total += n; \
e.cheatcount += n
#define END_CHEAT_FUNCTION() \
- ADD_CHEATS(self,cheating); \
+ ADD_CHEATS(this, cheating); \
return attempting
#define IS_CHEAT(i,argc,fr) \
if((++attempting, !CheatsAllowed(i,argc,fr))) \
break
float num_autoscreenshot;
-void info_autoscreenshot_findtarget()
-{SELFPARAM();
+void info_autoscreenshot_findtarget(entity this)
+{
entity e;
e = find(world, targetname, self.target);
if(!e)
e.angles = fixedvectoangles2(trace_plane_normal, v_forward);
e.angles = AnglesTransform_ApplyToAngles(e.angles, '-90 0 0'); // so unrotated models work
}
- WITH(entity, self, e, spawnfunc_func_breakable(e));
+ WITHSELF(e, spawnfunc_func_breakable(e));
// now, is it valid?
if(f == 0)
{
setself(new(cheattriggerteleport));
setorigin(self, self.origin);
self.target = argv(1);
- teleport_findtarget();
+ teleport_findtarget(self);
if(!wasfreed(self))
{
Simple_TeleportPlayer(self, this);
switch(0)
{
default:
- if(self.maycheat || (gamestart_sv_cheats && autocvar_sv_cheats))
+ if(this.maycheat || (gamestart_sv_cheats && autocvar_sv_cheats))
{
// use cheat dragging if cheats are enabled
- crosshair_trace_plusvisibletriggers(self);
+ crosshair_trace_plusvisibletriggers(this);
Drag(true, true);
}
else
switch(0)
{
default:
- if(Drag_IsDragging(self))
+ if(Drag_IsDragging(this))
{
- if(PHYS_INPUT_BUTTON_DRAG(self))
+ if(PHYS_INPUT_BUTTON_DRAG(this))
{
- if(self.impulse == 10 || self.impulse == 15 || self.impulse == 18)
+ if(this.impulse == 10 || this.impulse == 15 || this.impulse == 18)
{
- Drag_MoveForward(self);
- self.impulse = 0;
+ Drag_MoveForward(this);
+ this.impulse = 0;
}
- else if(self.impulse == 12 || self.impulse == 16 || self.impulse == 19)
+ else if(this.impulse == 12 || this.impulse == 16 || this.impulse == 19)
{
- Drag_MoveBackward(self);
- self.impulse = 0;
+ Drag_MoveBackward(this);
+ this.impulse = 0;
}
- else if(self.impulse >= 1 && self.impulse <= 9)
+ else if(this.impulse >= 1 && this.impulse <= 9)
{
- Drag_SetSpeed(self, self.impulse - 1);
+ Drag_SetSpeed(this, this.impulse - 1);
}
- else if(self.impulse == 14)
+ else if(this.impulse == 14)
{
- Drag_SetSpeed(self, 9);
+ Drag_SetSpeed(this, 9);
}
if(frametime)
- Drag_Update(self);
+ Drag_Update(this);
}
else
{
- Drag_Finish(self);
+ Drag_Finish(this);
}
}
else
{
- if(Drag_CanDrag(self))
- if(PHYS_INPUT_BUTTON_DRAG(self))
+ if(Drag_CanDrag(this))
+ if(PHYS_INPUT_BUTTON_DRAG(this))
{
- crosshair_trace_plusvisibletriggers(self);
+ crosshair_trace_plusvisibletriggers(this);
entity e = trace_ent;
float pick = force_allow_pick;
if (e && !pick)
// This also makes sure that an object can only pe picked up if in range, but does not get dropped if
// it goes out of range while slinging it around.
- if(vlen(self.origin - e.origin) <= autocvar_g_grab_range)
+ if(vlen(this.origin - e.origin) <= autocvar_g_grab_range)
{
switch(e.grab)
{
case 0: // can't grab
break;
case 1: // owner can grab
- if(e.owner == self || e.realowner == self)
+ if(e.owner == this || e.realowner == this)
pick = true;
break;
case 2: // owner and team mates can grab
- if(SAME_TEAM(e.owner, self) || SAME_TEAM(e.realowner, self) || e.team == self.team)
+ if(SAME_TEAM(e.owner, this) || SAME_TEAM(e.realowner, this) || e.team == this.team)
pick = true;
break;
case 3: // anyone can grab
Drag_Finish(e.draggedby);
if(e.tag_entity)
detach_sameorigin(e);
- Drag_Begin(self, e, trace_endpos);
+ Drag_Begin(this, e, trace_endpos);
if(ischeat)
DID_CHEAT();
return true;
void DragBox_Think()
{SELFPARAM();
- if(self.aiment && self.enemy)
+ if(this.aiment && this.enemy)
{
- self.origin_x = (self.aiment.origin.x + self.enemy.origin.x) * 0.5;
- self.origin_y = (self.aiment.origin.y + self.enemy.origin.y) * 0.5;
- self.origin_z = (self.aiment.origin.z + self.enemy.origin.z) * 0.5;
- self.maxs_x = fabs(self.aiment.origin.x - self.enemy.origin.x) * 0.5;
- self.maxs_y = fabs(self.aiment.origin.y - self.enemy.origin.y) * 0.5;
- self.maxs_z = fabs(self.aiment.origin.z - self.enemy.origin.z) * 0.5;
- self.mins = -1 * self.maxs;
- setorigin(self, self.origin);
- setsize(self, self.mins, self.maxs); // link edict
+ this.origin_x = (this.aiment.origin.x + this.enemy.origin.x) * 0.5;
+ this.origin_y = (this.aiment.origin.y + this.enemy.origin.y) * 0.5;
+ this.origin_z = (this.aiment.origin.z + this.enemy.origin.z) * 0.5;
+ this.maxs_x = fabs(this.aiment.origin.x - this.enemy.origin.x) * 0.5;
+ this.maxs_y = fabs(this.aiment.origin.y - this.enemy.origin.y) * 0.5;
+ this.maxs_z = fabs(this.aiment.origin.z - this.enemy.origin.z) * 0.5;
+ this.mins = -1 * this.maxs;
+ setorigin(this, this.origin);
+ setsize(this, this.mins, this.maxs); // link edict
}
- if(self.cnt == -1) // actually race_place -1
+ if(this.cnt == -1) // actually race_place -1
{
// show "10 10" for qualifying spawns
- setmodel(self.killindicator, MDL_NUM(10));
- setmodel(self.killindicator.killindicator, MDL_NUM(10));
+ setmodel(this.killindicator, MDL_NUM(10));
+ setmodel(this.killindicator.killindicator, MDL_NUM(10));
}
- else if(self.cnt == -2) // actually race_place 0
+ else if(this.cnt == -2) // actually race_place 0
{
// show "10 0" for loser spawns
- setmodel(self.killindicator, MDL_NUM(10));
- setmodel(self.killindicator.killindicator, MDL_NUM(0));
+ setmodel(this.killindicator, MDL_NUM(10));
+ setmodel(this.killindicator.killindicator, MDL_NUM(0));
}
else
{
- setmodel(self.killindicator, MDL_NUM(self.cnt % 10));
- setmodel(self.killindicator.killindicator, MDL_NUM(floor(self.cnt / 10)));
+ setmodel(this.killindicator, MDL_NUM(this.cnt % 10));
+ setmodel(this.killindicator.killindicator, MDL_NUM(floor(this.cnt / 10)));
}
- self.nextthink = time;
+ this.nextthink = time;
}
#endif
STATIC_METHOD(Client, Add, void(Client this, int _team))
{
- WITH(entity, self, this, ClientConnect());
+ WITHSELF(this, ClientConnect());
TRANSMUTE(Player, this);
this.frame = 12; // 7
this.team = _team;
- WITH(entity, self, this, PutClientInServer());
+ WITHSELF(this, PutClientInServer());
}
void PutObserverInServer();
STATIC_METHOD(Client, Remove, void(Client this))
{
TRANSMUTE(Observer, this);
- WITH(entity, self, this, PutClientInServer(); ClientDisconnect());
+ WITHSELF(this, PutClientInServer());
+ WITHSELF(this, ClientDisconnect());
}
void send_CSQC_teamnagger() {
defaultmodel = substring(defaultmodel, 0, i);
}
}
+ if(autocvar_sv_defaultcharacterskin && !defaultskin)
+ {
+ if(teamplay)
+ {
+ string s = Static_Team_ColorName_Lower(player.team);
+ if (s != "neutral")
+ defaultskin = cvar(strcat("sv_defaultplayerskin_", s));
+ }
+
+ if(!defaultskin)
+ defaultskin = autocvar_sv_defaultplayerskin;
+ }
+
MUTATOR_CALLHOOK(FixPlayermodel, defaultmodel, defaultskin);
defaultmodel = ret_string;
defaultskin = ret_int;
chmdl = true;
}
- oldskin = player.skin;
- player.skin = stof(player.playerskin);
+ if(!autocvar_sv_defaultcharacterskin)
+ {
+ oldskin = player.skin;
+ player.skin = stof(player.playerskin);
+ }
+ else
+ {
+ oldskin = player.skin;
+ player.skin = defaultskin;
+ }
}
if(chmdl || oldskin != player.skin) // model or skin has changed
this.oldorigin = this.origin;
this.prevorigin = this.origin;
this.lastteleporttime = time; // prevent insane speeds due to changing origin
- this.hud = HUD_NORMAL;
+ this.conveyor = NULL; // prevent conveyors at the previous location from moving a freshly spawned player
+ this.hud = HUD_NORMAL;
this.event_damage = PlayerDamage;
string s = spot.target;
spot.target = string_null;
WITH(entity, activator, this, LAMBDA(
- WITH(entity, self, spot, SUB_UseTargets())
+ WITHSELF(spot, SUB_UseTargets())
));
spot.target = s;
}
WriteString(channel, world.fog);
else
WriteString(channel, "");
- WriteByte(channel, self.count * 255.0); // g_balance_armor_blockpercent
+ WriteByte(channel, this.count * 255.0); // g_balance_armor_blockpercent
WriteByte(channel, serverflags); // client has to know if it should zoom or not
WriteCoord(channel, autocvar_g_trueaim_minrange);
}
void ClientInit_CheckUpdate()
{SELFPARAM();
- self.nextthink = time;
- if(self.count != autocvar_g_balance_armor_blockpercent)
+ this.nextthink = time;
+ if(this.count != autocvar_g_balance_armor_blockpercent)
{
- self.count = autocvar_g_balance_armor_blockpercent;
- self.SendFlags |= 1;
+ this.count = autocvar_g_balance_armor_blockpercent;
+ this.SendFlags |= 1;
}
}
e.think = ClientInit_CheckUpdate;
Net_LinkEntity(e, false, 0, ClientInit_SendEntity);
- WITH(entity, self, e, ClientInit_CheckUpdate());
+ WITHSELF(e, ClientInit_CheckUpdate());
}
/*
void SetChangeParms ()
{SELFPARAM();
// save parms for level change
- parm1 = self.parm_idlesince - time;
+ parm1 = this.parm_idlesince - time;
MUTATOR_CALLHOOK(SetChangeParms);
}
{
if(blockSpectators)
Send_Notification(NOTIF_ONE_ONLY, this, MSG_INFO, INFO_SPECTATE_WARNING, autocvar_g_maxplayers_spectator_blocktime);
- WITH(entity, self, this, PutObserverInServer());
+ WITHSELF(this, PutObserverInServer());
}
else
- WITH(entity, self, this, SV_ChangeTeam(this.killindicator_teamchange - 1));
+ WITHSELF(this, SV_ChangeTeam(this.killindicator_teamchange - 1));
this.killindicator_teamchange = 0;
}
void ClientKill_Now()
{SELFPARAM();
- if(self.vehicle)
+ if(this.vehicle)
{
vehicles_exit(VHEF_RELEASE);
- if(!self.killindicator_teamchange)
+ if(!this.killindicator_teamchange)
{
- self.vehicle_health = -1;
- Damage(self, self, self, 1 , DEATH_KILL.m_id, self.origin, '0 0 0');
+ this.vehicle_health = -1;
+ Damage(this, this, this, 1 , DEATH_KILL.m_id, this.origin, '0 0 0');
}
}
- if(self.killindicator && !wasfreed(self.killindicator))
- remove(self.killindicator);
+ if(this.killindicator && !wasfreed(this.killindicator))
+ remove(this.killindicator);
- self.killindicator = world;
+ this.killindicator = world;
- if(self.killindicator_teamchange)
- ClientKill_Now_TeamChange(self);
+ if(this.killindicator_teamchange)
+ ClientKill_Now_TeamChange(this);
- if(IS_PLAYER(self))
- Damage(self, self, self, 100000, DEATH_KILL.m_id, self.origin, '0 0 0');
+ if(IS_PLAYER(this))
+ Damage(this, this, this, 100000, DEATH_KILL.m_id, this.origin, '0 0 0');
// now I am sure the player IS dead
}
{SELFPARAM();
if (gameover)
{
- self.owner.killindicator = world;
- remove(self);
+ this.owner.killindicator = world;
+ remove(this);
return;
}
- if (self.owner.alpha < 0 && !self.owner.vehicle)
+ if (this.owner.alpha < 0 && !this.owner.vehicle)
{
- self.owner.killindicator = world;
- remove(self);
+ this.owner.killindicator = world;
+ remove(this);
return;
}
- if(self.cnt <= 0)
+ if(this.cnt <= 0)
{
- WITH(entity, self, self.owner, ClientKill_Now());
+ WITHSELF(this.owner, ClientKill_Now());
return;
}
- else if(g_cts && self.health == 1) // health == 1 means that it's silent
+ else if(g_cts && this.health == 1) // health == 1 means that it's silent
{
- self.nextthink = time + 1;
- self.cnt -= 1;
+ this.nextthink = time + 1;
+ this.cnt -= 1;
}
else
{
- if(self.cnt <= 10)
- setmodel(self, MDL_NUM(self.cnt));
- if(IS_REAL_CLIENT(self.owner))
+ if(this.cnt <= 10)
+ setmodel(this, MDL_NUM(this.cnt));
+ if(IS_REAL_CLIENT(this.owner))
{
- if(self.cnt <= 10)
- { Send_Notification(NOTIF_ONE, self.owner, MSG_ANNCE, Announcer_PickNumber(CNT_KILL, self.cnt)); }
+ if(this.cnt <= 10)
+ { Send_Notification(NOTIF_ONE, this.owner, MSG_ANNCE, Announcer_PickNumber(CNT_KILL, this.cnt)); }
}
- self.nextthink = time + 1;
- self.cnt -= 1;
+ this.nextthink = time + 1;
+ this.cnt -= 1;
}
}
if(g_race_qualifying || g_cts)
killtime = 0;
- if(MUTATOR_CALLHOOK(ClientKill, self, killtime))
+ if(MUTATOR_CALLHOOK(ClientKill, this, killtime))
return;
- self.killindicator_teamchange = targetteam;
+ this.killindicator_teamchange = targetteam;
- if(!self.killindicator)
+ if(!this.killindicator)
{
- if(!IS_DEAD(self))
+ if(!IS_DEAD(this))
{
- killtime = max(killtime, self.clientkill_nexttime - time);
- self.clientkill_nexttime = time + killtime + autocvar_g_balance_kill_antispam;
+ killtime = max(killtime, this.clientkill_nexttime - time);
+ this.clientkill_nexttime = time + killtime + autocvar_g_balance_kill_antispam;
}
- if(killtime <= 0 || !IS_PLAYER(self) || IS_DEAD(self))
+ if(killtime <= 0 || !IS_PLAYER(this) || IS_DEAD(this))
{
ClientKill_Now();
}
{
starttime = max(time, clientkilltime);
- self.killindicator = spawn();
- self.killindicator.owner = self;
- self.killindicator.scale = 0.5;
- setattachment(self.killindicator, self, "");
- setorigin(self.killindicator, '0 0 52');
- self.killindicator.think = KillIndicator_Think;
- self.killindicator.nextthink = starttime + (self.lip) * 0.05;
- clientkilltime = max(clientkilltime, self.killindicator.nextthink + 0.05);
- self.killindicator.cnt = ceil(killtime);
- self.killindicator.count = bound(0, ceil(killtime), 10);
- //sprint(self, strcat("^1You'll be dead in ", ftos(self.killindicator.cnt), " seconds\n"));
+ this.killindicator = spawn();
+ this.killindicator.owner = this;
+ this.killindicator.scale = 0.5;
+ setattachment(this.killindicator, this, "");
+ setorigin(this.killindicator, '0 0 52');
+ this.killindicator.think = KillIndicator_Think;
+ this.killindicator.nextthink = starttime + (this.lip) * 0.05;
+ clientkilltime = max(clientkilltime, this.killindicator.nextthink + 0.05);
+ this.killindicator.cnt = ceil(killtime);
+ this.killindicator.count = bound(0, ceil(killtime), 10);
+ //sprint(this, strcat("^1You'll be dead in ", ftos(this.killindicator.cnt), " seconds\n"));
for(e = world; (e = find(e, classname, "body")) != world; )
{
- if(e.enemy != self)
+ if(e.enemy != this)
continue;
e.killindicator = spawn();
e.killindicator.owner = e;
clientkilltime = max(clientkilltime, e.killindicator.nextthink + 0.05);
e.killindicator.cnt = ceil(killtime);
}
- self.lip = 0;
+ this.lip = 0;
}
}
- if(self.killindicator)
+ if(this.killindicator)
{
if(targetteam == 0) // just die
{
- self.killindicator.colormod = '0 0 0';
- if(IS_REAL_CLIENT(self))
- if(self.killindicator.cnt > 0)
- Send_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CENTER_TEAMCHANGE_SUICIDE, self.killindicator.cnt);
+ this.killindicator.colormod = '0 0 0';
+ if(IS_REAL_CLIENT(this))
+ if(this.killindicator.cnt > 0)
+ Send_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CENTER_TEAMCHANGE_SUICIDE, this.killindicator.cnt);
}
else if(targetteam == -1) // auto
{
- self.killindicator.colormod = '0 1 0';
- if(IS_REAL_CLIENT(self))
- if(self.killindicator.cnt > 0)
- Send_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CENTER_TEAMCHANGE_AUTO, self.killindicator.cnt);
+ this.killindicator.colormod = '0 1 0';
+ if(IS_REAL_CLIENT(this))
+ if(this.killindicator.cnt > 0)
+ Send_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CENTER_TEAMCHANGE_AUTO, this.killindicator.cnt);
}
else if(targetteam == -2) // spectate
{
- self.killindicator.colormod = '0.5 0.5 0.5';
- if(IS_REAL_CLIENT(self))
- if(self.killindicator.cnt > 0)
- Send_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CENTER_TEAMCHANGE_SPECTATE, self.killindicator.cnt);
+ this.killindicator.colormod = '0.5 0.5 0.5';
+ if(IS_REAL_CLIENT(this))
+ if(this.killindicator.cnt > 0)
+ Send_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CENTER_TEAMCHANGE_SPECTATE, this.killindicator.cnt);
}
else
{
- self.killindicator.colormod = Team_ColorRGB(targetteam);
- if(IS_REAL_CLIENT(self))
- if(self.killindicator.cnt > 0)
- Send_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, APP_TEAM_NUM(targetteam, CENTER_TEAMCHANGE), self.killindicator.cnt);
+ this.killindicator.colormod = Team_ColorRGB(targetteam);
+ if(IS_REAL_CLIENT(this))
+ if(this.killindicator.cnt > 0)
+ Send_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, APP_TEAM_NUM(targetteam, CENTER_TEAMCHANGE), this.killindicator.cnt);
}
}
void ClientKill ()
{SELFPARAM();
if(gameover) return;
- if(self.player_blocked) return;
- if(STAT(FROZEN, self)) return;
+ if(this.player_blocked) return;
+ if(STAT(FROZEN, this)) return;
ClientKill_TeamChange(0);
}
if(autocvar_sv_eventlog)
{
GameLogEcho(sprintf(":connect:%d:%d:%s",
- self.playerid,
- etof(self),
- ((IS_REAL_CLIENT(self)) ? self.netaddress : "bot")
+ this.playerid,
+ etof(this),
+ ((IS_REAL_CLIENT(this)) ? this.netaddress : "bot")
));
}
}
sv_notice_join(this);
FOREACH_ENTITY_FLOAT(init_for_player_needed, true, {
- WITH(entity, self, it, it.init_for_player(it));
+ WITHSELF(it, it.init_for_player(it));
});
MUTATOR_CALLHOOK(ClientConnect, this);
ClientState_detach(this);
- Portal_ClearAll(self);
+ Portal_ClearAll(this);
- Unfreeze(self);
+ Unfreeze(this);
- RemoveGrapplingHook(self);
+ RemoveGrapplingHook(this);
// Here, everything has been done that requires this player to be a client.
- self.flags &= ~FL_CLIENT;
+ this.flags &= ~FL_CLIENT;
if (this.chatbubbleentity) remove(this.chatbubbleentity);
if (this.killindicator) remove(this.killindicator);
bot_relinkplayerlist();
- if (self.netname_previous) strunzone(self.netname_previous);
- if (self.clientstatus) strunzone(self.clientstatus);
- if (self.weaponorder_byimpulse) strunzone(self.weaponorder_byimpulse);
- if (self.personal) remove(self.personal);
+ if (this.netname_previous) strunzone(this.netname_previous);
+ if (this.clientstatus) strunzone(this.clientstatus);
+ if (this.weaponorder_byimpulse) strunzone(this.weaponorder_byimpulse);
+ if (this.personal) remove(this.personal);
this.playerid = 0;
ReadyCount();
void ChatBubbleThink()
{SELFPARAM();
- self.nextthink = time;
- if ((self.owner.alpha < 0) || self.owner.chatbubbleentity != self)
+ this.nextthink = time;
+ if ((this.owner.alpha < 0) || this.owner.chatbubbleentity != this)
{
- if(self.owner) // but why can that ever be world?
- self.owner.chatbubbleentity = world;
- remove(self);
+ if(this.owner) // but why can that ever be world?
+ this.owner.chatbubbleentity = world;
+ remove(this);
return;
}
- self.mdl = "";
+ this.mdl = "";
- if ( !IS_DEAD(self.owner) && IS_PLAYER(self.owner) )
+ if ( !IS_DEAD(this.owner) && IS_PLAYER(this.owner) )
{
- if ( self.owner.active_minigame )
- self.mdl = "models/sprites/minigame_busy.iqm";
- else if (PHYS_INPUT_BUTTON_CHAT(self.owner))
- self.mdl = "models/misc/chatbubble.spr";
+ if ( this.owner.active_minigame )
+ this.mdl = "models/sprites/minigame_busy.iqm";
+ else if (PHYS_INPUT_BUTTON_CHAT(this.owner))
+ this.mdl = "models/misc/chatbubble.spr";
}
- if ( self.model != self.mdl )
- _setmodel(self, self.mdl);
+ if ( this.model != this.mdl )
+ _setmodel(this, this.mdl);
}
void UpdateChatBubble()
{SELFPARAM();
- if (self.alpha < 0)
+ if (this.alpha < 0)
return;
// spawn a chatbubble entity if needed
- if (!self.chatbubbleentity)
- {
- self.chatbubbleentity = new(chatbubbleentity);
- self.chatbubbleentity.owner = self;
- self.chatbubbleentity.exteriormodeltoclient = self;
- self.chatbubbleentity.think = ChatBubbleThink;
- self.chatbubbleentity.nextthink = time;
- setmodel(self.chatbubbleentity, MDL_CHAT); // precision set below
- //setorigin(self.chatbubbleentity, self.origin + '0 0 15' + self.maxs_z * '0 0 1');
- setorigin(self.chatbubbleentity, '0 0 15' + self.maxs_z * '0 0 1');
- setattachment(self.chatbubbleentity, self, ""); // sticks to moving player better, also conserves bandwidth
- self.chatbubbleentity.mdl = self.chatbubbleentity.model;
- //self.chatbubbleentity.model = "";
- self.chatbubbleentity.effects = EF_LOWPRECISION;
+ if (!this.chatbubbleentity)
+ {
+ this.chatbubbleentity = new(chatbubbleentity);
+ this.chatbubbleentity.owner = this;
+ this.chatbubbleentity.exteriormodeltoclient = this;
+ this.chatbubbleentity.think = ChatBubbleThink;
+ this.chatbubbleentity.nextthink = time;
+ setmodel(this.chatbubbleentity, MDL_CHAT); // precision set below
+ //setorigin(this.chatbubbleentity, this.origin + '0 0 15' + this.maxs_z * '0 0 1');
+ setorigin(this.chatbubbleentity, '0 0 15' + this.maxs_z * '0 0 1');
+ setattachment(this.chatbubbleentity, this, ""); // sticks to moving player better, also conserves bandwidth
+ this.chatbubbleentity.mdl = this.chatbubbleentity.model;
+ //this.chatbubbleentity.model = "";
+ this.chatbubbleentity.effects = EF_LOWPRECISION;
}
}
/*void UpdateColorModHack()
{
float c;
- c = self.clientcolors & 15;
+ c = this.clientcolors & 15;
// LordHavoc: only bothering to support white, green, red, yellow, blue
- if (!teamplay) self.colormod = '0 0 0';
- else if (c == 0) self.colormod = '1.00 1.00 1.00';
- else if (c == 3) self.colormod = '0.10 1.73 0.10';
- else if (c == 4) self.colormod = '1.73 0.10 0.10';
- else if (c == 12) self.colormod = '1.22 1.22 0.10';
- else if (c == 13) self.colormod = '0.10 0.10 1.73';
- else self.colormod = '1 1 1';
+ if (!teamplay) this.colormod = '0 0 0';
+ else if (c == 0) this.colormod = '1.00 1.00 1.00';
+ else if (c == 3) this.colormod = '0.10 1.73 0.10';
+ else if (c == 4) this.colormod = '1.73 0.10 0.10';
+ else if (c == 12) this.colormod = '1.22 1.22 0.10';
+ else if (c == 13) this.colormod = '0.10 0.10 1.73';
+ else this.colormod = '1 1 1';
}*/
void respawn()
{SELFPARAM();
- if(self.alpha >= 0 && autocvar_g_respawn_ghosts)
- {
- self.solid = SOLID_NOT;
- self.takedamage = DAMAGE_NO;
- self.movetype = MOVETYPE_FLY;
- self.velocity = '0 0 1' * autocvar_g_respawn_ghosts_speed;
- self.avelocity = randomvec() * autocvar_g_respawn_ghosts_speed * 3 - randomvec() * autocvar_g_respawn_ghosts_speed * 3;
- self.effects |= CSQCMODEL_EF_RESPAWNGHOST;
- Send_Effect(EFFECT_RESPAWN_GHOST, self.origin, '0 0 0', 1);
+ if(this.alpha >= 0 && autocvar_g_respawn_ghosts)
+ {
+ this.solid = SOLID_NOT;
+ this.takedamage = DAMAGE_NO;
+ this.movetype = MOVETYPE_FLY;
+ this.velocity = '0 0 1' * autocvar_g_respawn_ghosts_speed;
+ this.avelocity = randomvec() * autocvar_g_respawn_ghosts_speed * 3 - randomvec() * autocvar_g_respawn_ghosts_speed * 3;
+ this.effects |= CSQCMODEL_EF_RESPAWNGHOST;
+ Send_Effect(EFFECT_RESPAWN_GHOST, this.origin, '0 0 0', 1);
if(autocvar_g_respawn_ghosts_maxtime)
- SUB_SetFade (self, time + autocvar_g_respawn_ghosts_maxtime / 2 + random () * (autocvar_g_respawn_ghosts_maxtime - autocvar_g_respawn_ghosts_maxtime / 2), 1.5);
+ SUB_SetFade (this, time + autocvar_g_respawn_ghosts_maxtime / 2 + random () * (autocvar_g_respawn_ghosts_maxtime - autocvar_g_respawn_ghosts_maxtime / 2), 1.5);
}
- CopyBody(self, 1);
+ CopyBody(this, 1);
- self.effects |= EF_NODRAW; // prevent another CopyBody
+ this.effects |= EF_NODRAW; // prevent another CopyBody
PutClientInServer();
}
void play_countdown(float finished, Sound samp)
{SELFPARAM();
TC(Sound, samp);
- if(IS_REAL_CLIENT(self))
+ if(IS_REAL_CLIENT(this))
if(floor(finished - time - frametime) != floor(finished - time))
if(finished - time < 6)
- sound (self, CH_INFO, samp, VOL_BASE, ATTEN_NORM);
+ sound (this, CH_INFO, samp, VOL_BASE, ATTEN_NORM);
}
void player_powerups ()
{SELFPARAM();
// add a way to see what the items were BEFORE all of these checks for the mutator hook
- int items_prev = self.items;
+ int items_prev = this.items;
- if((self.items & IT_USING_JETPACK) && !IS_DEAD(self) && !gameover)
- self.modelflags |= MF_ROCKET;
+ if((this.items & IT_USING_JETPACK) && !IS_DEAD(this) && !gameover)
+ this.modelflags |= MF_ROCKET;
else
- self.modelflags &= ~MF_ROCKET;
+ this.modelflags &= ~MF_ROCKET;
- self.effects &= ~(EF_RED | EF_BLUE | EF_ADDITIVE | EF_FULLBRIGHT | EF_FLAME | EF_NODEPTHTEST);
+ this.effects &= ~(EF_RED | EF_BLUE | EF_ADDITIVE | EF_FULLBRIGHT | EF_FLAME | EF_NODEPTHTEST);
- if((self.alpha < 0 || IS_DEAD(self)) && !self.vehicle) // don't apply the flags if the player is gibbed
+ if((this.alpha < 0 || IS_DEAD(this)) && !this.vehicle) // don't apply the flags if the player is gibbed
return;
- Fire_ApplyDamage(self);
- Fire_ApplyEffect(self);
+ Fire_ApplyDamage(this);
+ Fire_ApplyEffect(this);
if (!g_instagib)
{
- if (self.items & ITEM_Strength.m_itemid)
+ if (this.items & ITEM_Strength.m_itemid)
{
- play_countdown(self.strength_finished, SND_POWEROFF);
- self.effects = self.effects | (EF_BLUE | EF_ADDITIVE | EF_FULLBRIGHT);
- if (time > self.strength_finished)
+ play_countdown(this.strength_finished, SND_POWEROFF);
+ this.effects = this.effects | (EF_BLUE | EF_ADDITIVE | EF_FULLBRIGHT);
+ if (time > this.strength_finished)
{
- self.items = self.items - (self.items & ITEM_Strength.m_itemid);
- //Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_POWERDOWN_STRENGTH, self.netname);
- Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_POWERDOWN_STRENGTH);
+ this.items = this.items - (this.items & ITEM_Strength.m_itemid);
+ //Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_POWERDOWN_STRENGTH, this.netname);
+ Send_Notification(NOTIF_ONE, this, MSG_CENTER, CENTER_POWERDOWN_STRENGTH);
}
}
else
{
- if (time < self.strength_finished)
+ if (time < this.strength_finished)
{
- self.items = self.items | ITEM_Strength.m_itemid;
- Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_POWERUP_STRENGTH, self.netname);
- Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_POWERUP_STRENGTH);
+ this.items = this.items | ITEM_Strength.m_itemid;
+ Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_POWERUP_STRENGTH, this.netname);
+ Send_Notification(NOTIF_ONE, this, MSG_CENTER, CENTER_POWERUP_STRENGTH);
}
}
- if (self.items & ITEM_Shield.m_itemid)
+ if (this.items & ITEM_Shield.m_itemid)
{
- play_countdown(self.invincible_finished, SND_POWEROFF);
- self.effects = self.effects | (EF_RED | EF_ADDITIVE | EF_FULLBRIGHT);
- if (time > self.invincible_finished)
+ play_countdown(this.invincible_finished, SND_POWEROFF);
+ this.effects = this.effects | (EF_RED | EF_ADDITIVE | EF_FULLBRIGHT);
+ if (time > this.invincible_finished)
{
- self.items = self.items - (self.items & ITEM_Shield.m_itemid);
- //Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_POWERDOWN_SHIELD, self.netname);
- Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_POWERDOWN_SHIELD);
+ this.items = this.items - (this.items & ITEM_Shield.m_itemid);
+ //Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_POWERDOWN_SHIELD, this.netname);
+ Send_Notification(NOTIF_ONE, this, MSG_CENTER, CENTER_POWERDOWN_SHIELD);
}
}
else
{
- if (time < self.invincible_finished)
+ if (time < this.invincible_finished)
{
- self.items = self.items | ITEM_Shield.m_itemid;
- Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_POWERUP_SHIELD, self.netname);
- Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_POWERUP_SHIELD);
+ this.items = this.items | ITEM_Shield.m_itemid;
+ Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_POWERUP_SHIELD, this.netname);
+ Send_Notification(NOTIF_ONE, this, MSG_CENTER, CENTER_POWERUP_SHIELD);
}
}
- if (self.items & IT_SUPERWEAPON)
+ if (this.items & IT_SUPERWEAPON)
{
- if (!(self.weapons & WEPSET_SUPERWEAPONS))
+ if (!(this.weapons & WEPSET_SUPERWEAPONS))
{
- self.superweapons_finished = 0;
- self.items = self.items - (self.items & IT_SUPERWEAPON);
- //Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_SUPERWEAPON_LOST, self.netname);
- Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_SUPERWEAPON_LOST);
+ this.superweapons_finished = 0;
+ this.items = this.items - (this.items & IT_SUPERWEAPON);
+ //Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_SUPERWEAPON_LOST, this.netname);
+ Send_Notification(NOTIF_ONE, this, MSG_CENTER, CENTER_SUPERWEAPON_LOST);
}
- else if (self.items & IT_UNLIMITED_SUPERWEAPONS)
+ else if (this.items & IT_UNLIMITED_SUPERWEAPONS)
{
// don't let them run out
}
else
{
- play_countdown(self.superweapons_finished, SND_POWEROFF);
- if (time > self.superweapons_finished)
+ play_countdown(this.superweapons_finished, SND_POWEROFF);
+ if (time > this.superweapons_finished)
{
- self.items = self.items - (self.items & IT_SUPERWEAPON);
- self.weapons &= ~WEPSET_SUPERWEAPONS;
- //Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_SUPERWEAPON_BROKEN, self.netname);
- Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_SUPERWEAPON_BROKEN);
+ this.items = this.items - (this.items & IT_SUPERWEAPON);
+ this.weapons &= ~WEPSET_SUPERWEAPONS;
+ //Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_SUPERWEAPON_BROKEN, this.netname);
+ Send_Notification(NOTIF_ONE, this, MSG_CENTER, CENTER_SUPERWEAPON_BROKEN);
}
}
}
- else if(self.weapons & WEPSET_SUPERWEAPONS)
+ else if(this.weapons & WEPSET_SUPERWEAPONS)
{
- if (time < self.superweapons_finished || (self.items & IT_UNLIMITED_SUPERWEAPONS))
+ if (time < this.superweapons_finished || (this.items & IT_UNLIMITED_SUPERWEAPONS))
{
- self.items = self.items | IT_SUPERWEAPON;
- Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_SUPERWEAPON_PICKUP, self.netname);
- Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_SUPERWEAPON_PICKUP);
+ this.items = this.items | IT_SUPERWEAPON;
+ Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_SUPERWEAPON_PICKUP, this.netname);
+ Send_Notification(NOTIF_ONE, this, MSG_CENTER, CENTER_SUPERWEAPON_PICKUP);
}
else
{
- self.superweapons_finished = 0;
- self.weapons &= ~WEPSET_SUPERWEAPONS;
+ this.superweapons_finished = 0;
+ this.weapons &= ~WEPSET_SUPERWEAPONS;
}
}
else
{
- self.superweapons_finished = 0;
+ this.superweapons_finished = 0;
}
}
if(autocvar_g_nodepthtestplayers)
- self.effects = self.effects | EF_NODEPTHTEST;
+ this.effects = this.effects | EF_NODEPTHTEST;
if(autocvar_g_fullbrightplayers)
- self.effects = self.effects | EF_FULLBRIGHT;
+ this.effects = this.effects | EF_FULLBRIGHT;
if (time >= game_starttime)
- if (time < self.spawnshieldtime)
- self.effects = self.effects | (EF_ADDITIVE | EF_FULLBRIGHT);
+ if (time < this.spawnshieldtime)
+ this.effects = this.effects | (EF_ADDITIVE | EF_FULLBRIGHT);
- MUTATOR_CALLHOOK(PlayerPowerups, self, items_prev);
+ MUTATOR_CALLHOOK(PlayerPowerups, this, items_prev);
}
float CalcRegen(float current, float stable, float regenfactor, float regenframetime)
regen_health_stable = autocvar_g_balance_health_regenstable;
regen_health_rotstable = autocvar_g_balance_health_rotstable;
if(!MUTATOR_CALLHOOK(PlayerRegen))
- if(!STAT(FROZEN, self))
+ if(!STAT(FROZEN, this))
{
float mina, maxa, limith, limita;
maxa = autocvar_g_balance_armor_rotstable;
limith = limith * limit_mod;
limita = limita * limit_mod;
- self.armorvalue = CalcRotRegen(self.armorvalue, mina, autocvar_g_balance_armor_regen, autocvar_g_balance_armor_regenlinear, regen_mod * frametime * (time > self.pauseregen_finished), maxa, autocvar_g_balance_armor_rot, autocvar_g_balance_armor_rotlinear, rot_mod * frametime * (time > self.pauserotarmor_finished), limita);
- self.health = CalcRotRegen(self.health, regen_health_stable, regen_health, regen_health_linear, regen_mod * frametime * (time > self.pauseregen_finished), regen_health_rotstable, regen_health_rot, regen_health_rotlinear, rot_mod * frametime * (time > self.pauserothealth_finished), limith);
+ this.armorvalue = CalcRotRegen(this.armorvalue, mina, autocvar_g_balance_armor_regen, autocvar_g_balance_armor_regenlinear, regen_mod * frametime * (time > this.pauseregen_finished), maxa, autocvar_g_balance_armor_rot, autocvar_g_balance_armor_rotlinear, rot_mod * frametime * (time > this.pauserotarmor_finished), limita);
+ this.health = CalcRotRegen(this.health, regen_health_stable, regen_health, regen_health_linear, regen_mod * frametime * (time > this.pauseregen_finished), regen_health_rotstable, regen_health_rot, regen_health_rotlinear, rot_mod * frametime * (time > this.pauserothealth_finished), limith);
}
// if player rotted to death... die!
// check this outside above checks, as player may still be able to rot to death
- if(self.health < 1)
+ if(this.health < 1)
{
- if(self.vehicle)
+ if(this.vehicle)
vehicles_exit(VHEF_RELEASE);
- if(self.event_damage)
- self.event_damage(self, self, self, 1, DEATH_ROT.m_id, self.origin, '0 0 0');
+ if(this.event_damage)
+ this.event_damage(this, this, this, 1, DEATH_ROT.m_id, this.origin, '0 0 0');
}
- if (!(self.items & IT_UNLIMITED_WEAPON_AMMO))
+ if (!(this.items & IT_UNLIMITED_WEAPON_AMMO))
{
float minf, maxf, limitf;
minf = autocvar_g_balance_fuel_regenstable;
limitf = autocvar_g_balance_fuel_limit;
- self.ammo_fuel = CalcRotRegen(self.ammo_fuel, minf, autocvar_g_balance_fuel_regen, autocvar_g_balance_fuel_regenlinear, frametime * (time > self.pauseregen_finished) * ((self.items & ITEM_JetpackRegen.m_itemid) != 0), maxf, autocvar_g_balance_fuel_rot, autocvar_g_balance_fuel_rotlinear, frametime * (time > self.pauserotfuel_finished), limitf);
+ this.ammo_fuel = CalcRotRegen(this.ammo_fuel, minf, autocvar_g_balance_fuel_regen, autocvar_g_balance_fuel_regenlinear, frametime * (time > this.pauseregen_finished) * ((this.items & ITEM_JetpackRegen.m_itemid) != 0), maxf, autocvar_g_balance_fuel_rot, autocvar_g_balance_fuel_rotlinear, frametime * (time > this.pauserotfuel_finished), limitf);
}
}
-float zoomstate_set;
+bool zoomstate_set;
void SetZoomState(float z)
{SELFPARAM();
- if(z != self.zoomstate)
+ if(z != this.zoomstate)
{
- self.zoomstate = z;
- ClientData_Touch(self);
+ this.zoomstate = z;
+ ClientData_Touch(this);
}
- zoomstate_set = 1;
+ zoomstate_set = true;
}
void GetPressedKeys()
bool SpectateUpdate()
{SELFPARAM();
- if(!self.enemy)
+ if(!this.enemy)
return false;
- if(!IS_PLAYER(self.enemy) || self == self.enemy)
+ if(!IS_PLAYER(this.enemy) || this == this.enemy)
{
- SetSpectatee(self, NULL);
+ SetSpectatee(this, NULL);
return false;
}
bool SpectateSet()
{SELFPARAM();
- if(!IS_PLAYER(self.enemy))
+ if(!IS_PLAYER(this.enemy))
return false;
- msg_entity = self;
+ msg_entity = this;
WriteByte(MSG_ONE, SVC_SETVIEW);
- WriteEntity(MSG_ONE, self.enemy);
- self.movetype = MOVETYPE_NONE;
- accuracy_resend(self);
+ WriteEntity(MSG_ONE, this.enemy);
+ this.movetype = MOVETYPE_NONE;
+ accuracy_resend(this);
if(!SpectateUpdate())
PutObserverInServer();
bool Spectate(entity pl)
{SELFPARAM();
- if(MUTATOR_CALLHOOK(SpectateSet, self, pl))
+ if(MUTATOR_CALLHOOK(SpectateSet, this, pl))
return false;
pl = spec_player;
- SetSpectatee(self, pl);
+ SetSpectatee(this, pl);
return SpectateSet();
}
bool SpectateNext()
{SELFPARAM();
- other = find(self.enemy, classname, STR_PLAYER);
+ other = find(this.enemy, classname, STR_PLAYER);
- if (MUTATOR_CALLHOOK(SpectateNext, self, other))
+ if (MUTATOR_CALLHOOK(SpectateNext, this, other))
other = spec_player;
else if (!other)
other = find(other, classname, STR_PLAYER);
- if(other) { SetSpectatee(self, other); }
+ if(other) { SetSpectatee(this, other); }
return SpectateSet();
}
entity first = other;
// skip players until current spectated player
- if(self.enemy)
- while(other && other != self.enemy)
+ if(this.enemy)
+ while(other && other != this.enemy)
other = other.chain;
- switch (MUTATOR_CALLHOOK(SpectatePrev, self, other, first))
+ switch (MUTATOR_CALLHOOK(SpectatePrev, this, other, first))
{
case MUT_SPECPREV_FOUND:
other = spec_player;
}
}
- SetSpectatee(self, other);
+ SetSpectatee(this, other);
return SpectateSet();
}
void ShowRespawnCountdown()
{SELFPARAM();
float number;
- if(!IS_DEAD(self)) // just respawned?
+ if(!IS_DEAD(this)) // just respawned?
return;
else
{
- number = ceil(self.respawn_time - time);
+ number = ceil(this.respawn_time - time);
if(number <= 0)
return;
- if(number <= self.respawn_countdown)
+ if(number <= this.respawn_countdown)
{
- self.respawn_countdown = number - 1;
- if(ceil(self.respawn_time - (time + 0.5)) == number) // only say it if it is the same number even in 0.5s; to prevent overlapping sounds
- { Send_Notification(NOTIF_ONE, self, MSG_ANNCE, Announcer_PickNumber(CNT_RESPAWN, number)); }
+ this.respawn_countdown = number - 1;
+ if(ceil(this.respawn_time - (time + 0.5)) == number) // only say it if it is the same number even in 0.5s; to prevent overlapping sounds
+ { Send_Notification(NOTIF_ONE, this, MSG_ANNCE, Announcer_PickNumber(CNT_RESPAWN, number)); }
}
}
}
void LeaveSpectatorMode()
{SELFPARAM();
- if(self.caplayer)
+ if(this.caplayer)
return;
- if(nJoinAllowed(self, self))
+ if(nJoinAllowed(this, this))
{
- if(!teamplay || autocvar_g_campaign || autocvar_g_balance_teams || (self.wasplayer && autocvar_g_changeteam_banned) || self.team_forced > 0)
+ if(!teamplay || autocvar_g_campaign || autocvar_g_balance_teams || (this.wasplayer && autocvar_g_changeteam_banned) || this.team_forced > 0)
{
- TRANSMUTE(Player, self);
+ TRANSMUTE(Player, this);
if(autocvar_g_campaign || autocvar_g_balance_teams)
- { JoinBestTeam(self, false, true); }
+ { JoinBestTeam(this, false, true); }
if(autocvar_g_campaign)
{ campaign_bots_may_start = true; }
- Kill_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CPID_PREVENT_JOIN);
+ Kill_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CPID_PREVENT_JOIN);
PutClientInServer();
- if(IS_PLAYER(self)) { Send_Notification(NOTIF_ALL, world, MSG_INFO, ((teamplay && this.team != -1) ? APP_TEAM_ENT(this, INFO_JOIN_PLAY_TEAM) : INFO_JOIN_PLAY), self.netname); }
+ if(IS_PLAYER(this)) { Send_Notification(NOTIF_ALL, world, MSG_INFO, ((teamplay && this.team != -1) ? APP_TEAM_ENT(this, INFO_JOIN_PLAY_TEAM) : INFO_JOIN_PLAY), this.netname); }
}
else
- stuffcmd(self, "menu_showteamselect\n");
+ stuffcmd(this, "menu_showteamselect\n");
}
else
{
// Player may not join because g_maxplayers is set
- Send_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CENTER_JOIN_PREVENT);
+ Send_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CENTER_JOIN_PREVENT);
}
}
*/
void checkSpectatorBlock()
{SELFPARAM();
- if(IS_SPEC(self) || IS_OBSERVER(self))
- if(!self.caplayer)
- if(IS_REAL_CLIENT(self))
+ if(IS_SPEC(this) || IS_OBSERVER(this))
+ if(!this.caplayer)
+ if(IS_REAL_CLIENT(this))
{
- if( time > (self.spectatortime + autocvar_g_maxplayers_spectator_blocktime) ) {
- Send_Notification(NOTIF_ONE_ONLY, self, MSG_INFO, INFO_QUIT_KICK_SPECTATING);
- dropclient(self);
+ if( time > (this.spectatortime + autocvar_g_maxplayers_spectator_blocktime) ) {
+ Send_Notification(NOTIF_ONE_ONLY, this, MSG_INFO, INFO_QUIT_KICK_SPECTATING);
+ dropclient(this);
}
}
}
-void PrintWelcomeMessage()
-{SELFPARAM();
- if(self.motd_actived_time == 0)
+void PrintWelcomeMessage(entity this)
+{
+ if(this.motd_actived_time == 0)
{
if (autocvar_g_campaign) {
- if ((IS_PLAYER(self) && PHYS_INPUT_BUTTON_INFO(self)) || (!IS_PLAYER(self))) {
- self.motd_actived_time = time;
- Send_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CENTER_MOTD, campaign_message);
+ if ((IS_PLAYER(this) && PHYS_INPUT_BUTTON_INFO(this)) || (!IS_PLAYER(this))) {
+ this.motd_actived_time = time;
+ Send_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CENTER_MOTD, campaign_message);
}
} else {
- if (PHYS_INPUT_BUTTON_INFO(self)) {
- self.motd_actived_time = time;
- Send_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CENTER_MOTD, getwelcomemessage());
+ if (PHYS_INPUT_BUTTON_INFO(this)) {
+ this.motd_actived_time = time;
+ Send_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CENTER_MOTD, getwelcomemessage());
}
}
}
- else if(self.motd_actived_time > 0) // showing MOTD or campaign message
+ else if(this.motd_actived_time > 0) // showing MOTD or campaign message
{
if (autocvar_g_campaign) {
- if (PHYS_INPUT_BUTTON_INFO(self))
- self.motd_actived_time = time;
- else if ((time - self.motd_actived_time > 2) && IS_PLAYER(self)) { // hide it some seconds after BUTTON_INFO has been released
- self.motd_actived_time = 0;
- Kill_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CPID_MOTD);
+ if (PHYS_INPUT_BUTTON_INFO(this))
+ this.motd_actived_time = time;
+ else if ((time - this.motd_actived_time > 2) && IS_PLAYER(this)) { // hide it some seconds after BUTTON_INFO has been released
+ this.motd_actived_time = 0;
+ Kill_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CPID_MOTD);
}
} else {
- if (PHYS_INPUT_BUTTON_INFO(self))
- self.motd_actived_time = time;
- else if (time - self.motd_actived_time > 2) { // hide it some seconds after BUTTON_INFO has been released
- self.motd_actived_time = 0;
- Kill_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CPID_MOTD);
+ if (PHYS_INPUT_BUTTON_INFO(this))
+ this.motd_actived_time = time;
+ else if (time - this.motd_actived_time > 2) { // hide it some seconds after BUTTON_INFO has been released
+ this.motd_actived_time = 0;
+ Kill_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CPID_MOTD);
}
}
}
- else //if(self.motd_actived_time < 0) // just connected, motd is active
+ else //if(this.motd_actived_time < 0) // just connected, motd is active
{
- if(PHYS_INPUT_BUTTON_INFO(self)) // BUTTON_INFO hides initial MOTD
- self.motd_actived_time = -2; // wait until BUTTON_INFO gets released
- else if(self.motd_actived_time == -2 || IS_PLAYER(self) || IS_SPEC(self))
+ if(PHYS_INPUT_BUTTON_INFO(this)) // BUTTON_INFO hides initial MOTD
+ this.motd_actived_time = -2; // wait until BUTTON_INFO gets released
+ else if(this.motd_actived_time == -2 || IS_PLAYER(this) || IS_SPEC(this))
{
// instanctly hide MOTD
- self.motd_actived_time = 0;
- Kill_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CPID_MOTD);
+ this.motd_actived_time = 0;
+ Kill_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CPID_MOTD);
}
}
}
void ObserverThink()
{SELFPARAM();
- if ( self.impulse )
+ if ( this.impulse )
{
- MinigameImpulse(self, self.impulse);
- self.impulse = 0;
+ MinigameImpulse(this, this.impulse);
+ this.impulse = 0;
}
float prefered_movetype;
- if (self.flags & FL_JUMPRELEASED) {
- if (PHYS_INPUT_BUTTON_JUMP(self) && !self.version_mismatch) {
- self.flags &= ~FL_JUMPRELEASED;
- self.flags |= FL_SPAWNING;
- } else if(PHYS_INPUT_BUTTON_ATCK(self) && !self.version_mismatch) {
- self.flags &= ~FL_JUMPRELEASED;
+ if (this.flags & FL_JUMPRELEASED) {
+ if (PHYS_INPUT_BUTTON_JUMP(this) && !this.version_mismatch) {
+ this.flags &= ~FL_JUMPRELEASED;
+ this.flags |= FL_SPAWNING;
+ } else if(PHYS_INPUT_BUTTON_ATCK(this) && !this.version_mismatch) {
+ this.flags &= ~FL_JUMPRELEASED;
if(SpectateNext()) {
- TRANSMUTE(Spectator, self);
+ TRANSMUTE(Spectator, this);
}
} else {
- prefered_movetype = ((!PHYS_INPUT_BUTTON_USE(self) ? self.cvar_cl_clippedspectating : !self.cvar_cl_clippedspectating) ? MOVETYPE_FLY_WORLDONLY : MOVETYPE_NOCLIP);
- if (self.movetype != prefered_movetype)
- self.movetype = prefered_movetype;
+ prefered_movetype = ((!PHYS_INPUT_BUTTON_USE(this) ? this.cvar_cl_clippedspectating : !this.cvar_cl_clippedspectating) ? MOVETYPE_FLY_WORLDONLY : MOVETYPE_NOCLIP);
+ if (this.movetype != prefered_movetype)
+ this.movetype = prefered_movetype;
}
} else {
- if (!(PHYS_INPUT_BUTTON_ATCK(self) || PHYS_INPUT_BUTTON_JUMP(self))) {
- self.flags |= FL_JUMPRELEASED;
- if(self.flags & FL_SPAWNING)
+ if (!(PHYS_INPUT_BUTTON_ATCK(this) || PHYS_INPUT_BUTTON_JUMP(this))) {
+ this.flags |= FL_JUMPRELEASED;
+ if(this.flags & FL_SPAWNING)
{
- self.flags &= ~FL_SPAWNING;
+ this.flags &= ~FL_SPAWNING;
LeaveSpectatorMode();
return;
}
void SpectatorThink()
{SELFPARAM();
- if ( self.impulse )
+ if ( this.impulse )
{
- if(MinigameImpulse(self, self.impulse))
- self.impulse = 0;
- }
- if (self.flags & FL_JUMPRELEASED) {
- if (PHYS_INPUT_BUTTON_JUMP(self) && !self.version_mismatch) {
- self.flags &= ~FL_JUMPRELEASED;
- self.flags |= FL_SPAWNING;
- } else if(PHYS_INPUT_BUTTON_ATCK(self) || self.impulse == 10 || self.impulse == 15 || self.impulse == 18 || (self.impulse >= 200 && self.impulse <= 209)) {
- self.flags &= ~FL_JUMPRELEASED;
+ if(MinigameImpulse(this, this.impulse))
+ this.impulse = 0;
+ }
+ if (this.flags & FL_JUMPRELEASED) {
+ if (PHYS_INPUT_BUTTON_JUMP(this) && !this.version_mismatch) {
+ this.flags &= ~FL_JUMPRELEASED;
+ this.flags |= FL_SPAWNING;
+ } else if(PHYS_INPUT_BUTTON_ATCK(this) || this.impulse == 10 || this.impulse == 15 || this.impulse == 18 || (this.impulse >= 200 && this.impulse <= 209)) {
+ this.flags &= ~FL_JUMPRELEASED;
if(SpectateNext()) {
- TRANSMUTE(Spectator, self);
+ TRANSMUTE(Spectator, this);
} else {
- TRANSMUTE(Observer, self);
+ TRANSMUTE(Observer, this);
PutClientInServer();
}
- self.impulse = 0;
- } else if(self.impulse == 12 || self.impulse == 16 || self.impulse == 19 || (self.impulse >= 220 && self.impulse <= 229)) {
- self.flags &= ~FL_JUMPRELEASED;
+ this.impulse = 0;
+ } else if(this.impulse == 12 || this.impulse == 16 || this.impulse == 19 || (this.impulse >= 220 && this.impulse <= 229)) {
+ this.flags &= ~FL_JUMPRELEASED;
if(SpectatePrev()) {
- TRANSMUTE(Spectator, self);
+ TRANSMUTE(Spectator, this);
} else {
- TRANSMUTE(Observer, self);
+ TRANSMUTE(Observer, this);
PutClientInServer();
}
- self.impulse = 0;
- } else if (PHYS_INPUT_BUTTON_ATCK2(self)) {
- self.flags &= ~FL_JUMPRELEASED;
- TRANSMUTE(Observer, self);
+ this.impulse = 0;
+ } else if (PHYS_INPUT_BUTTON_ATCK2(this)) {
+ this.flags &= ~FL_JUMPRELEASED;
+ TRANSMUTE(Observer, this);
PutClientInServer();
} else {
if(!SpectateUpdate())
PutObserverInServer();
}
} else {
- if (!(PHYS_INPUT_BUTTON_ATCK(self) || PHYS_INPUT_BUTTON_ATCK2(self))) {
- self.flags |= FL_JUMPRELEASED;
- if(self.flags & FL_SPAWNING)
+ if (!(PHYS_INPUT_BUTTON_ATCK(this) || PHYS_INPUT_BUTTON_ATCK2(this))) {
+ this.flags |= FL_JUMPRELEASED;
+ if(this.flags & FL_SPAWNING)
{
- self.flags &= ~FL_SPAWNING;
+ this.flags &= ~FL_SPAWNING;
LeaveSpectatorMode();
return;
}
PutObserverInServer();
}
- self.flags |= FL_CLIENT | FL_NOTARGET;
+ this.flags |= FL_CLIENT | FL_NOTARGET;
}
void vehicles_enter (entity pl, entity veh);
void PlayerUseKey()
{SELFPARAM();
- if (!IS_PLAYER(self))
+ if (!IS_PLAYER(this))
return;
- if(self.vehicle)
+ if(this.vehicle)
{
if(!gameover)
{
}
else if(autocvar_g_vehicles_enter)
{
- if(!STAT(FROZEN, self))
- if(!IS_DEAD(self))
+ if(!STAT(FROZEN, this))
+ if(!IS_DEAD(this))
if(!gameover)
{
entity head, closest_target = world;
- head = WarpZone_FindRadius(self.origin, autocvar_g_vehicles_enter_radius, true);
+ head = WarpZone_FindRadius(this.origin, autocvar_g_vehicles_enter_radius, true);
while(head) // find the closest acceptable target to enter
{
if(head.vehicle_flags & VHF_ISVEHICLE)
if(!IS_DEAD(head))
- if(!head.owner || ((head.vehicle_flags & VHF_MULTISLOT) && SAME_TEAM(head.owner, self)))
+ if(!head.owner || ((head.vehicle_flags & VHF_MULTISLOT) && SAME_TEAM(head.owner, this)))
if(head.takedamage != DAMAGE_NO)
{
if(closest_target)
{
- if(vlen(self.origin - head.origin) < vlen(self.origin - closest_target.origin))
+ if(vlen(this.origin - head.origin) < vlen(this.origin - closest_target.origin))
{ closest_target = head; }
}
else { closest_target = head; }
head = head.chain;
}
- if(closest_target) { vehicles_enter(self, closest_target); return; }
+ if(closest_target) { vehicles_enter(this, closest_target); return; }
}
}
.float last_vehiclecheck;
.int items_added;
void PlayerPreThink ()
-{SELFPARAM();
- WarpZone_PlayerPhysics_FixVAngle();
+{
+ SELFPARAM();
+ WarpZone_PlayerPhysics_FixVAngle(this);
- self.stat_game_starttime = game_starttime;
- self.stat_round_starttime = round_starttime;
- self.stat_allow_oldvortexbeam = autocvar_g_allow_oldvortexbeam;
- self.stat_leadlimit = autocvar_leadlimit;
+ STAT(GAMESTARTTIME, this) = game_starttime;
+ STAT(ROUNDSTARTTIME, this) = round_starttime;
+ STAT(ALLOW_OLDVORTEXBEAM, this) = autocvar_g_allow_oldvortexbeam;
+ STAT(LEADLIMIT, this) = autocvar_leadlimit;
- self.weaponsinmap = weaponsInMap;
+ STAT(WEAPONSINMAP, this) = weaponsInMap;
- if(frametime)
- {
+ if (frametime) {
// physics frames: update anticheat stuff
- anticheat_prethink(self);
+ anticheat_prethink(this);
}
- if(blockSpectators && frametime)
- // WORKAROUND: only use dropclient in server frames (frametime set). Never use it in cl_movement frames (frametime zero).
+ if (blockSpectators && frametime) {
+ // WORKAROUND: only use dropclient in server frames (frametime set).
+ // Never use it in cl_movement frames (frametime zero).
checkSpectatorBlock();
+ }
- zoomstate_set = 0;
-
- // Savage: Check for nameless players
- if (isInvisibleString(self.netname)) {
- string new_name = strzone(strcat("Player@", ftos(self.playerid)));
- if(autocvar_sv_eventlog)
- GameLogEcho(strcat(":name:", ftos(self.playerid), ":", new_name));
- if(self.netname_previous)
- strunzone(self.netname_previous);
- self.netname_previous = strzone(new_name);
- self.netname = self.netname_previous;
- // stuffcmd(self, strcat("name ", self.netname, "\n"));
- } else if(self.netname_previous != self.netname) {
- if(autocvar_sv_eventlog)
- GameLogEcho(strcat(":name:", ftos(self.playerid), ":", self.netname));
- if(self.netname_previous)
- strunzone(self.netname_previous);
- self.netname_previous = strzone(self.netname);
+ zoomstate_set = false;
+
+ // Check for nameless players
+ if (isInvisibleString(this.netname)) {
+ this.netname = strzone(sprintf("Player#%d", this.playerid));
+ // stuffcmd(this, strcat("name ", this.netname, "\n")); // maybe?
+ }
+ if (this.netname != this.netname_previous) {
+ if (autocvar_sv_eventlog) {
+ GameLogEcho(strcat(":name:", ftos(this.playerid), ":", this.netname));
+ }
+ if (this.netname_previous) strunzone(this.netname_previous);
+ this.netname_previous = strzone(this.netname);
}
// version nagging
- if(self.version_nagtime)
- if(self.cvar_g_xonoticversion)
- if(time > self.version_nagtime)
- {
- // don't notify git users
- if(strstrofs(self.cvar_g_xonoticversion, "git", 0) < 0 && strstrofs(self.cvar_g_xonoticversion, "autobuild", 0) < 0)
- {
- if(strstrofs(autocvar_g_xonoticversion, "git", 0) >= 0 || strstrofs(autocvar_g_xonoticversion, "autobuild", 0) >= 0)
- {
- // notify release users if connecting to git
- LOG_TRACE("^1NOTE^7 to ", self.netname, "^7 - the server is running ^3Xonotic ", autocvar_g_xonoticversion, " (beta)^7, you have ^3Xonotic ", self.cvar_g_xonoticversion, "^1\n");
- Send_Notification(NOTIF_ONE_ONLY, self, MSG_INFO, INFO_VERSION_BETA, autocvar_g_xonoticversion, self.cvar_g_xonoticversion);
- }
- else
- {
- float r;
- r = vercmp(self.cvar_g_xonoticversion, autocvar_g_xonoticversion);
- if(r < 0)
- {
- // give users new version
- LOG_TRACE("^1NOTE^7 to ", self.netname, "^7 - ^3Xonotic ", autocvar_g_xonoticversion, "^7 is out, and you still have ^3Xonotic ", self.cvar_g_xonoticversion, "^1 - get the update from ^4http://www.xonotic.org/^1!\n");
- Send_Notification(NOTIF_ONE_ONLY, self, MSG_INFO, INFO_VERSION_OUTDATED, autocvar_g_xonoticversion, self.cvar_g_xonoticversion);
- }
- else if(r > 0)
- {
- // notify users about old server version
- LOG_INFO("^1NOTE^7 to ", self.netname, "^7 - the server is running ^3Xonotic ", autocvar_g_xonoticversion, "^7, you have ^3Xonotic ", self.cvar_g_xonoticversion, "^1\n");
- Send_Notification(NOTIF_ONE_ONLY, self, MSG_INFO, INFO_VERSION_OLD, autocvar_g_xonoticversion, self.cvar_g_xonoticversion);
- }
- }
- }
- self.version_nagtime = 0;
- }
+ if (this.version_nagtime && this.cvar_g_xonoticversion && time > this.version_nagtime) {
+ this.version_nagtime = 0;
+ if (strstrofs(this.cvar_g_xonoticversion, "git", 0) >= 0 || strstrofs(this.cvar_g_xonoticversion, "autobuild", 0) >= 0) {
+ // git client
+ } else if (strstrofs(autocvar_g_xonoticversion, "git", 0) >= 0 || strstrofs(autocvar_g_xonoticversion, "autobuild", 0) >= 0) {
+ // git server
+ Send_Notification(NOTIF_ONE_ONLY, this, MSG_INFO, INFO_VERSION_BETA, autocvar_g_xonoticversion, this.cvar_g_xonoticversion);
+ } else {
+ int r = vercmp(this.cvar_g_xonoticversion, autocvar_g_xonoticversion);
+ if (r < 0) { // old client
+ Send_Notification(NOTIF_ONE_ONLY, this, MSG_INFO, INFO_VERSION_OUTDATED, autocvar_g_xonoticversion, this.cvar_g_xonoticversion);
+ } else if (r > 0) { // old server
+ Send_Notification(NOTIF_ONE_ONLY, this, MSG_INFO, INFO_VERSION_OLD, autocvar_g_xonoticversion, this.cvar_g_xonoticversion);
+ }
+ }
+ }
// GOD MODE info
- if(!(self.flags & FL_GODMODE)) if(self.max_armorvalue)
+ if (!(this.flags & FL_GODMODE) && this.max_armorvalue)
{
- Send_Notification(NOTIF_ONE_ONLY, self, MSG_INFO, INFO_GODMODE_OFF, self.max_armorvalue);
- self.max_armorvalue = 0;
+ Send_Notification(NOTIF_ONE_ONLY, this, MSG_INFO, INFO_GODMODE_OFF, this.max_armorvalue);
+ this.max_armorvalue = 0;
}
- if(STAT(FROZEN, self) == 2)
+ if (STAT(FROZEN, this) == 2)
{
- self.revive_progress = bound(0, self.revive_progress + frametime * self.revive_speed, 1);
- self.health = max(1, self.revive_progress * start_health);
- self.iceblock.alpha = bound(0.2, 1 - self.revive_progress, 1);
+ this.revive_progress = bound(0, this.revive_progress + frametime * this.revive_speed, 1);
+ this.health = max(1, this.revive_progress * start_health);
+ this.iceblock.alpha = bound(0.2, 1 - this.revive_progress, 1);
- if(self.revive_progress >= 1)
- Unfreeze(self);
+ if (this.revive_progress >= 1)
+ Unfreeze(this);
}
- else if(STAT(FROZEN, self) == 3)
+ else if (STAT(FROZEN, this) == 3)
{
- self.revive_progress = bound(0, self.revive_progress - frametime * self.revive_speed, 1);
- self.health = max(0, autocvar_g_nades_ice_health + (start_health-autocvar_g_nades_ice_health) * self.revive_progress );
+ this.revive_progress = bound(0, this.revive_progress - frametime * this.revive_speed, 1);
+ this.health = max(0, autocvar_g_nades_ice_health + (start_health-autocvar_g_nades_ice_health) * this.revive_progress );
- if(self.health < 1)
+ if (this.health < 1)
{
- if(self.vehicle)
+ if (this.vehicle)
vehicles_exit(VHEF_RELEASE);
- self.event_damage(self, self, self.frozen_by, 1, DEATH_NADE_ICE_FREEZE.m_id, self.origin, '0 0 0');
+ this.event_damage(this, this, this.frozen_by, 1, DEATH_NADE_ICE_FREEZE.m_id, this.origin, '0 0 0');
}
- else if ( self.revive_progress <= 0 )
- Unfreeze(self);
+ else if (this.revive_progress <= 0)
+ Unfreeze(this);
}
MUTATOR_CALLHOOK(PlayerPreThink);
if(autocvar_g_vehicles_enter)
- if(time > self.last_vehiclecheck)
- if(IS_PLAYER(self))
+ if(time > this.last_vehiclecheck)
+ if(IS_PLAYER(this))
if(!gameover)
- if(!STAT(FROZEN, self))
- if(!self.vehicle)
- if(!IS_DEAD(self))
+ if(!STAT(FROZEN, this))
+ if(!this.vehicle)
+ if(!IS_DEAD(this))
{
entity veh;
for(veh = world; (veh = findflags(veh, vehicle_flags, VHF_ISVEHICLE)); )
- if(vlen(veh.origin - self.origin) < autocvar_g_vehicles_enter_radius)
+ if(vlen(veh.origin - this.origin) < autocvar_g_vehicles_enter_radius)
if(!IS_DEAD(veh))
if(veh.takedamage != DAMAGE_NO)
- if((veh.vehicle_flags & VHF_MULTISLOT) && SAME_TEAM(veh.owner, self))
- Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_VEHICLE_ENTER_GUNNER);
+ if((veh.vehicle_flags & VHF_MULTISLOT) && SAME_TEAM(veh.owner, this))
+ Send_Notification(NOTIF_ONE, this, MSG_CENTER, CENTER_VEHICLE_ENTER_GUNNER);
else if(!veh.owner)
- if(!veh.team || SAME_TEAM(self, veh))
- Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_VEHICLE_ENTER);
+ if(!veh.team || SAME_TEAM(this, veh))
+ Send_Notification(NOTIF_ONE, this, MSG_CENTER, CENTER_VEHICLE_ENTER);
else if(autocvar_g_vehicles_steal)
- Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_VEHICLE_ENTER_STEAL);
+ Send_Notification(NOTIF_ONE, this, MSG_CENTER, CENTER_VEHICLE_ENTER_STEAL);
- self.last_vehiclecheck = time + 1;
+ this.last_vehiclecheck = time + 1;
}
- if(!self.cvar_cl_newusekeysupported) // FIXME remove this - it was a stupid idea to begin with, we can JUST use the button
+ if(!this.cvar_cl_newusekeysupported) // FIXME remove this - it was a stupid idea to begin with, we can JUST use the button
{
- if(PHYS_INPUT_BUTTON_USE(self) && !self.usekeypressed)
+ if(PHYS_INPUT_BUTTON_USE(this) && !this.usekeypressed)
PlayerUseKey();
- self.usekeypressed = PHYS_INPUT_BUTTON_USE(self);
+ this.usekeypressed = PHYS_INPUT_BUTTON_USE(this);
}
- if(IS_REAL_CLIENT(self))
- PrintWelcomeMessage();
-
- if(IS_PLAYER(self))
- {
+ if (IS_REAL_CLIENT(this))
+ PrintWelcomeMessage(this);
+ if (IS_PLAYER(this)) {
CheckRules_Player();
- if (intermission_running)
- {
- IntermissionThink (); // otherwise a button could be missed between
- return; // the think tics
+ if (intermission_running) {
+ IntermissionThink();
+ return;
}
- //don't allow the player to turn around while game is paused!
- if(timeout_status == TIMEOUT_ACTIVE) {
+ if (timeout_status == TIMEOUT_ACTIVE) {
+ // don't allow the player to turn around while game is paused
// FIXME turn this into CSQC stuff
- self.v_angle = self.lastV_angle;
- self.angles = self.lastV_angle;
- self.fixangle = true;
+ this.v_angle = this.lastV_angle;
+ this.angles = this.lastV_angle;
+ this.fixangle = true;
}
- if(frametime)
- {
- player_powerups();
- }
+ if (frametime) player_powerups();
- if (IS_DEAD(self))
- {
- if(self.personal && g_race_qualifying)
- {
- if(time > self.respawn_time)
- {
- self.respawn_time = time + 1; // only retry once a second
- self.stat_respawn_time = self.respawn_time;
+ if (IS_DEAD(this)) {
+ if (this.personal && g_race_qualifying) {
+ if (time > this.respawn_time) {
+ STAT(RESPAWN_TIME, this) = this.respawn_time = time + 1; // only retry once a second
respawn();
- self.impulse = 141;
- }
- }
- else
- {
- float button_pressed;
- if(frametime)
- player_anim();
- button_pressed = (PHYS_INPUT_BUTTON_ATCK(self) || PHYS_INPUT_BUTTON_JUMP(self) || PHYS_INPUT_BUTTON_ATCK2(self) || PHYS_INPUT_BUTTON_HOOK(self) || PHYS_INPUT_BUTTON_USE(self));
-
- if (self.deadflag == DEAD_DYING)
- {
- if((self.respawn_flags & RESPAWN_FORCE) && !autocvar_g_respawn_delay_max)
- self.deadflag = DEAD_RESPAWNING;
- else if(!button_pressed)
- self.deadflag = DEAD_DEAD;
+ this.impulse = CHIMPULSE_SPEEDRUN.impulse;
}
- else if (self.deadflag == DEAD_DEAD)
- {
- if(button_pressed)
- self.deadflag = DEAD_RESPAWNABLE;
- else if(time >= self.respawn_time_max && (self.respawn_flags & RESPAWN_FORCE))
- self.deadflag = DEAD_RESPAWNING;
- }
- else if (self.deadflag == DEAD_RESPAWNABLE)
- {
- if(!button_pressed)
- self.deadflag = DEAD_RESPAWNING;
- }
- else if (self.deadflag == DEAD_RESPAWNING)
- {
- if(time > self.respawn_time)
- {
- self.respawn_time = time + 1; // only retry once a second
- self.respawn_time_max = self.respawn_time;
+ } else {
+ if (frametime) player_anim();
+ bool button_pressed = (PHYS_INPUT_BUTTON_ATCK(this) || PHYS_INPUT_BUTTON_JUMP(this) || PHYS_INPUT_BUTTON_ATCK2(this) || PHYS_INPUT_BUTTON_HOOK(this) || PHYS_INPUT_BUTTON_USE(this));
+
+ if (this.deadflag == DEAD_DYING) {
+ if ((this.respawn_flags & RESPAWN_FORCE) && !autocvar_g_respawn_delay_max) {
+ this.deadflag = DEAD_RESPAWNING;
+ } else if (!button_pressed) {
+ this.deadflag = DEAD_DEAD;
+ }
+ } else if (this.deadflag == DEAD_DEAD) {
+ if (button_pressed) {
+ this.deadflag = DEAD_RESPAWNABLE;
+ } else if (time >= this.respawn_time_max && (this.respawn_flags & RESPAWN_FORCE)) {
+ this.deadflag = DEAD_RESPAWNING;
+ }
+ } else if (this.deadflag == DEAD_RESPAWNABLE) {
+ if (!button_pressed) {
+ this.deadflag = DEAD_RESPAWNING;
+ }
+ } else if (this.deadflag == DEAD_RESPAWNING) {
+ if (time > this.respawn_time) {
+ this.respawn_time = time + 1; // only retry once a second
+ this.respawn_time_max = this.respawn_time;
respawn();
}
}
ShowRespawnCountdown();
- if(self.respawn_flags & RESPAWN_SILENT)
- self.stat_respawn_time = 0;
- else if((self.respawn_flags & RESPAWN_FORCE) && autocvar_g_respawn_delay_max)
- self.stat_respawn_time = self.respawn_time_max;
+ if (this.respawn_flags & RESPAWN_SILENT)
+ STAT(RESPAWN_TIME, this) = 0;
+ else if ((this.respawn_flags & RESPAWN_FORCE) && autocvar_g_respawn_delay_max)
+ STAT(RESPAWN_TIME, this) = this.respawn_time_max;
else
- self.stat_respawn_time = self.respawn_time;
+ STAT(RESPAWN_TIME, this) = this.respawn_time;
}
// if respawning, invert stat_respawn_time to indicate this, the client translates it
- if(self.deadflag == DEAD_RESPAWNING && self.stat_respawn_time > 0)
- self.stat_respawn_time *= -1;
+ if (this.deadflag == DEAD_RESPAWNING && STAT(RESPAWN_TIME, this) > 0)
+ STAT(RESPAWN_TIME, this) *= -1;
return;
}
- self.prevorigin = self.origin;
-
- float do_crouch = PHYS_INPUT_BUTTON_CROUCH(self);
- if(self.hook.state)
- do_crouch = 0;
- if(self.vehicle)
- do_crouch = 0;
- if(STAT(FROZEN, self))
- do_crouch = 0;
+ this.prevorigin = this.origin;
- // WEAPONTODO: THIS SHIT NEEDS TO GO EVENTUALLY
- // It cannot be predicted by the engine!
- .entity weaponentity = weaponentities[0]; // TODO: unhardcode
- if((PS(self).m_weapon == WEP_SHOCKWAVE || PS(self).m_weapon == WEP_SHOTGUN) && self.(weaponentity).wframe == WFRAME_FIRE2 && time < self.(weaponentity).weapon_nextthink)
- do_crouch = 0;
+ bool do_crouch = PHYS_INPUT_BUTTON_CROUCH(this);
+ .entity weaponentity = weaponentities[0]; // TODO: unhardcode
+ if (this.hook.state) {
+ do_crouch = false;
+ } else if (this.vehicle) {
+ do_crouch = false;
+ } else if (STAT(FROZEN, this)) {
+ do_crouch = false;
+ } else if ((PS(this).m_weapon == WEP_SHOTGUN || PS(this).m_weapon == WEP_SHOCKWAVE) && this.(weaponentity).wframe == WFRAME_FIRE2 && time < this.(weaponentity).weapon_nextthink) {
+ // WEAPONTODO: predict
+ do_crouch = false;
+ }
- if (do_crouch)
- {
- if (!self.crouch)
- {
- self.crouch = true;
- self.view_ofs = STAT(PL_CROUCH_VIEW_OFS, self);
- setsize (self, STAT(PL_CROUCH_MIN, self), STAT(PL_CROUCH_MAX, self));
- // setanim(self, self.anim_duck, false, true, true); // this anim is BROKEN anyway
- }
- }
- else
- {
- if (self.crouch)
- {
- tracebox(self.origin, STAT(PL_MIN, self), STAT(PL_MAX, self), self.origin, false, self);
- if (!trace_startsolid)
- {
- self.crouch = false;
- self.view_ofs = STAT(PL_VIEW_OFS, self);
- setsize (self, STAT(PL_MIN, self), STAT(PL_MAX, self));
- }
+ if (do_crouch) {
+ if (!this.crouch) {
+ this.crouch = true;
+ this.view_ofs = STAT(PL_CROUCH_VIEW_OFS, this);
+ setsize(this, STAT(PL_CROUCH_MIN, this), STAT(PL_CROUCH_MAX, this));
+ // setanim(this, this.anim_duck, false, true, true); // this anim is BROKEN anyway
}
+ } else if (this.crouch) {
+ tracebox(this.origin, STAT(PL_MIN, this), STAT(PL_MAX, this), this.origin, false, this);
+ if (!trace_startsolid) {
+ this.crouch = false;
+ this.view_ofs = STAT(PL_VIEW_OFS, this);
+ setsize(this, STAT(PL_MIN, this), STAT(PL_MAX, this));
+ }
}
- FixPlayermodel(self);
+ FixPlayermodel(this);
// LordHavoc: allow firing on move frames (sub-ticrate), this gives better timing on slow servers
//if(frametime)
{
- self.items &= ~self.items_added;
+ this.items &= ~this.items_added;
- W_WeaponFrame(self);
+ W_WeaponFrame(this);
- self.items_added = 0;
- if(self.items & ITEM_Jetpack.m_itemid)
- if(self.items & ITEM_JetpackRegen.m_itemid || self.ammo_fuel >= 0.01)
- self.items_added |= IT_FUEL;
+ this.items_added = 0;
+ if (this.items & ITEM_Jetpack.m_itemid && (this.items & ITEM_JetpackRegen.m_itemid || this.ammo_fuel >= 0.01))
+ this.items_added |= IT_FUEL;
- self.items |= self.items_added;
+ this.items |= this.items_added;
}
player_regen();
// WEAPONTODO: Add a weapon request for this
// rot vortex charge to the charge limit
- if(WEP_CVAR(vortex, charge_rot_rate) && self.vortex_charge > WEP_CVAR(vortex, charge_limit) && self.vortex_charge_rottime < time)
- self.vortex_charge = bound(WEP_CVAR(vortex, charge_limit), self.vortex_charge - WEP_CVAR(vortex, charge_rot_rate) * frametime / W_TICSPERFRAME, 1);
+ if (WEP_CVAR(vortex, charge_rot_rate) && this.vortex_charge > WEP_CVAR(vortex, charge_limit) && this.vortex_charge_rottime < time)
+ this.vortex_charge = bound(WEP_CVAR(vortex, charge_limit), this.vortex_charge - WEP_CVAR(vortex, charge_rot_rate) * frametime / W_TICSPERFRAME, 1);
- if(frametime)
- player_anim();
+ if (frametime) player_anim();
// secret status
secrets_setstatus();
// monsters status
- monsters_setstatus(self);
-
- self.dmg_team = max(0, self.dmg_team - autocvar_g_teamdamage_resetspeed * frametime);
+ monsters_setstatus(this);
- //self.angles_y=self.v_angle_y + 90; // temp
- } else if(gameover) {
- if (intermission_running)
- IntermissionThink (); // otherwise a button could be missed between
+ this.dmg_team = max(0, this.dmg_team - autocvar_g_teamdamage_resetspeed * frametime);
+ }
+ else if (gameover) {
+ if (intermission_running) IntermissionThink();
return;
- } else if(IS_OBSERVER(self)) {
+ }
+ else if (IS_OBSERVER(this)) {
ObserverThink();
- } else if(IS_SPEC(self)) {
+ }
+ else if (IS_SPEC(this)) {
SpectatorThink();
}
// WEAPONTODO: Add weapon request for this
- if(!zoomstate_set)
+ if (!zoomstate_set) {
SetZoomState(
- PHYS_INPUT_BUTTON_ZOOM(self)
- || PHYS_INPUT_BUTTON_ZOOMSCRIPT(self)
- || (PHYS_INPUT_BUTTON_ATCK2(self) && PS(self).m_weapon == WEP_VORTEX)
- || (PHYS_INPUT_BUTTON_ATCK2(self) && PS(self).m_weapon == WEP_RIFLE && WEP_CVAR(rifle, secondary) == 0)
- ); // WEAPONTODO
-
- float oldspectatee_status;
- oldspectatee_status = self.spectatee_status;
- if(IS_SPEC(self))
- self.spectatee_status = etof(self.enemy);
- else if(IS_OBSERVER(self))
- self.spectatee_status = etof(self);
- else
- self.spectatee_status = 0;
- if(self.spectatee_status != oldspectatee_status)
- {
- ClientData_Touch(self);
- if(g_race || g_cts)
- race_InitSpectator();
+ PHYS_INPUT_BUTTON_ZOOM(this) || PHYS_INPUT_BUTTON_ZOOMSCRIPT(this)
+ || (PHYS_INPUT_BUTTON_ATCK2(this) && PS(this).m_weapon == WEP_VORTEX)
+ || (PHYS_INPUT_BUTTON_ATCK2(this) && PS(this).m_weapon == WEP_RIFLE && WEP_CVAR(rifle, secondary) == 0)
+ );
+ }
+
+ int oldspectatee_status = this.spectatee_status;
+ if (IS_SPEC(this)) {
+ this.spectatee_status = etof(this.enemy);
+ } else if (IS_OBSERVER(this)) {
+ this.spectatee_status = etof(this);
+ } else {
+ this.spectatee_status = 0;
+ }
+ if (this.spectatee_status != oldspectatee_status) {
+ ClientData_Touch(this);
+ if (g_race || g_cts) race_InitSpectator();
}
- if(self.teamkill_soundtime)
- if(time > self.teamkill_soundtime)
+ if (this.teamkill_soundtime && time > this.teamkill_soundtime)
{
- self.teamkill_soundtime = 0;
+ this.teamkill_soundtime = 0;
- entity e = self.teamkill_soundsource;
+ entity e = this.teamkill_soundsource;
entity oldpusher = e.pusher;
e.pusher = this;
PlayerSound(e, playersound_teamshoot, CH_VOICE, VOICETYPE_LASTATTACKER_ONLY);
e.pusher = oldpusher;
}
- if(self.taunt_soundtime)
- if(time > self.taunt_soundtime)
- {
- self.taunt_soundtime = 0;
- PlayerSound(self, playersound_taunt, CH_VOICE, VOICETYPE_AUTOTAUNT);
+ if (this.taunt_soundtime && time > this.taunt_soundtime) {
+ this.taunt_soundtime = 0;
+ PlayerSound(this, playersound_taunt, CH_VOICE, VOICETYPE_AUTOTAUNT);
}
- target_voicescript_next(self);
+ target_voicescript_next(this);
// WEAPONTODO: Move into weaponsystem somehow
// if a player goes unarmed after holding a loaded weapon, empty his clip size and remove the crosshair ammo ring
- if (PS(self).m_weapon == WEP_Null)
- self.clip_load = self.clip_size = 0;
+ if (PS(this).m_weapon == WEP_Null)
+ this.clip_load = this.clip_size = 0;
}
void DrownPlayer(entity this)
*/
.float idlekick_lasttimeleft;
void PlayerPostThink ()
-{SELFPARAM();
- if(sv_maxidle > 0 && frametime) // WORKAROUND: only use dropclient in server frames (frametime set). Never use it in cl_movement frames (frametime zero).
- if(IS_REAL_CLIENT(self))
- if(IS_PLAYER(self) || sv_maxidle_spectatorsareidle)
+{
+ SELFPARAM();
+ if (sv_maxidle > 0)
+ if (frametime) // WORKAROUND: only use dropclient in server frames (frametime set). Never use it in cl_movement frames (frametime zero).
+ if (IS_REAL_CLIENT(this))
+ if (IS_PLAYER(this) || sv_maxidle_spectatorsareidle)
{
- if (time - self.parm_idlesince < 1) // instead of (time == self.parm_idlesince) to support sv_maxidle <= 10
+ if (time - this.parm_idlesince < 1) // instead of (time == this.parm_idlesince) to support sv_maxidle <= 10
{
- if(self.idlekick_lasttimeleft)
+ if (this.idlekick_lasttimeleft)
{
- self.idlekick_lasttimeleft = 0;
- Kill_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CPID_IDLING);
+ this.idlekick_lasttimeleft = 0;
+ Kill_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CPID_IDLING);
}
}
else
{
- float timeleft;
- timeleft = ceil(sv_maxidle - (time - self.parm_idlesince));
- if(timeleft == min(10, sv_maxidle - 1)) // - 1 to support sv_maxidle <= 10
- {
- if(!self.idlekick_lasttimeleft)
- Send_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CENTER_DISCONNECT_IDLING, timeleft);
+ float timeleft = ceil(sv_maxidle - (time - this.parm_idlesince));
+ if (timeleft == min(10, sv_maxidle - 1)) { // - 1 to support sv_maxidle <= 10
+ if (!this.idlekick_lasttimeleft)
+ Send_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CENTER_DISCONNECT_IDLING, timeleft);
}
- if(timeleft <= 0)
- {
- Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_QUIT_KICK_IDLING, self.netname);
- dropclient(self);
+ if (timeleft <= 0) {
+ Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_QUIT_KICK_IDLING, this.netname);
+ dropclient(this);
return;
}
- else if(timeleft <= 10)
- {
- if(timeleft != self.idlekick_lasttimeleft)
- { Send_Notification(NOTIF_ONE, self, MSG_ANNCE, Announcer_PickNumber(CNT_IDLE, timeleft)); }
- self.idlekick_lasttimeleft = timeleft;
+ else if (timeleft <= 10) {
+ if (timeleft != this.idlekick_lasttimeleft) {
+ Send_Notification(NOTIF_ONE, this, MSG_ANNCE, Announcer_PickNumber(CNT_IDLE, timeleft));
+ }
+ this.idlekick_lasttimeleft = timeleft;
}
}
}
//CheckPlayerJump();
- if(IS_PLAYER(self)) {
- DrownPlayer(self);
+ if (IS_PLAYER(this)) {
+ DrownPlayer(this);
CheckRules_Player();
UpdateChatBubble();
- if (self.impulse)
- ImpulseCommands(self);
- if (intermission_running)
- return; // intermission or finale
+ if (this.impulse) ImpulseCommands(this);
+ if (intermission_running) return; // intermission or finale
GetPressedKeys();
}
- /*
- float i;
- for(i = 0; i < 1000; ++i)
- {
- vector end;
- end = self.origin + '0 0 1024' + 512 * randomvec();
- tracebox(self.origin, self.mins, self.maxs, end, MOVE_NORMAL, self);
- if(trace_fraction < 1)
- if(!(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT))
- {
- print("I HIT SOLID: ", vtos(self.origin), " -> ", vtos(end), "\n");
- break;
- }
- }
- */
-
- if(self.waypointsprite_attachedforcarrier)
- WaypointSprite_UpdateHealth(self.waypointsprite_attachedforcarrier, '1 0 0' * healtharmor_maxdamage(self.health, self.armorvalue, autocvar_g_balance_armor_blockpercent, DEATH_WEAPON.m_id));
+ if (this.waypointsprite_attachedforcarrier) {
+ vector v = healtharmor_maxdamage(this.health, this.armorvalue, autocvar_g_balance_armor_blockpercent, DEATH_WEAPON.m_id);
+ WaypointSprite_UpdateHealth(this.waypointsprite_attachedforcarrier, '1 0 0' * v);
+ }
playerdemo_write();
- CSQCMODEL_AUTOUPDATE(self);
+ CSQCMODEL_AUTOUPDATE(this);
}
void CopyBody_Think()
{SELFPARAM();
- if(self.CopyBody_nextthink && time > self.CopyBody_nextthink)
+ if(this.CopyBody_nextthink && time > this.CopyBody_nextthink)
{
- self.CopyBody_think();
- if(wasfreed(self))
+ this.CopyBody_think();
+ if(wasfreed(this))
return;
- self.CopyBody_nextthink = self.nextthink;
- self.CopyBody_think = self.think;
- self.think = CopyBody_Think;
+ this.CopyBody_nextthink = this.nextthink;
+ this.CopyBody_think = this.think;
+ this.think = CopyBody_Think;
}
- CSQCMODEL_AUTOUPDATE(self);
- self.nextthink = time;
+ CSQCMODEL_AUTOUPDATE(this);
+ this.nextthink = time;
}
void CopyBody(entity this, float keepvelocity)
{
void player_anim ()
{SELFPARAM();
- int deadbits = (self.anim_state & (ANIMSTATE_DEAD1 | ANIMSTATE_DEAD2));
- if(IS_DEAD(self)) {
+ int deadbits = (this.anim_state & (ANIMSTATE_DEAD1 | ANIMSTATE_DEAD2));
+ if(IS_DEAD(this)) {
if (!deadbits) {
// Decide on which death animation to use.
if(random() < 0.5)
deadbits = 0;
}
int animbits = deadbits;
- if(STAT(FROZEN, self))
+ if(STAT(FROZEN, this))
animbits |= ANIMSTATE_FROZEN;
- if(self.movetype == MOVETYPE_FOLLOW)
+ if(this.movetype == MOVETYPE_FOLLOW)
animbits |= ANIMSTATE_FOLLOW;
- if(self.crouch)
+ if(this.crouch)
animbits |= ANIMSTATE_DUCK;
- animdecide_setstate(self, animbits, false);
- animdecide_setimplicitstate(self, IS_ONGROUND(self));
+ animdecide_setstate(this, animbits, false);
+ animdecide_setimplicitstate(this, IS_ONGROUND(this));
}
void PlayerCorpseDamage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
excess = frag_damage;
Weapon wep = PS(this).m_weapon;
- WITH(entity, self, this, wep.wr_playerdeath(wep));
+ WITHSELF(this, wep.wr_playerdeath(wep));
RemoveGrapplingHook(this);
// reset fields the weapons may use just in case
FOREACH(Weapons, it != WEP_Null, LAMBDA(
- WITH(entity, self, this, it.wr_resetplayer(it));
+ WITHSELF(this, it.wr_resetplayer(it));
for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
{
ATTACK_FINISHED_FOR(this, it.m_id, slot) = 0;
LogTeamchange(client.playerid, client.team, type);
}
+/** print(), but only print if the server is not local */
+void dedicated_print(string input)
+{
+ if (server_is_dedicated) print(input);
+}
+
/**
* message "": do not say, just test flood control
* return value:
* 0 = reject
* -1 = fake accept
*/
-int Say(entity source, float teamsay, entity privatesay, string msgin, bool floodcontrol)
+int Say(entity source, int teamsay, entity privatesay, string msgin, bool floodcontrol)
{
- string msgstr, colorstr, cmsgstr, namestr, fullmsgstr, sourcemsgstr, fullcmsgstr, sourcecmsgstr, colorprefix;
- float flood;
- var .float flood_field;
- float ret;
- string privatemsgprefix = string_null; float privatemsgprefixlen = 0;
-
- if(!teamsay && !privatesay)
- if(substring(msgin, 0, 1) == " ")
- msgin = substring(msgin, 1, strlen(msgin) - 1); // work around DP say bug (say_team does not have this!)
+ if (!teamsay && !privatesay) if (substring(msgin, 0, 1) == " ")
+ msgin = substring(msgin, 1, -1); // work around DP say bug (say_team does not have this!)
msgin = formatmessage(msgin);
+ string colorstr;
if (!IS_PLAYER(source))
colorstr = "^0"; // black for spectators
else if(teamplay)
if(intermission_running)
teamsay = false;
+ if (!source) {
+ colorstr = "";
+ teamsay = false;
+ }
+
if(msgin != "")
msgin = trigger_magicear_processmessage_forallears(source, teamsay, privatesay, msgin);
}
*/
- if(autocvar_g_chat_teamcolors)
- namestr = playername(source);
- else
- namestr = source.netname;
+ string namestr = "";
+ if (source)
+ namestr = autocvar_g_chat_teamcolors ? playername(source) : source.netname;
- if(strdecolorize(namestr) == namestr)
- colorprefix = "^3";
- else
- colorprefix = "^7";
+ string colorprefix = (strdecolorize(namestr) == namestr) ? "^3" : "^7";
- if(msgin != "")
- {
+ string msgstr, cmsgstr;
+ string privatemsgprefix = string_null;
+ int privatemsgprefixlen = 0;
+ if (msgin == "") {
+ msgstr = cmsgstr = "";
+ } else {
if(privatesay)
{
msgstr = strcat("\{1}\{13}* ", colorprefix, namestr, "^3 tells you: ^7");
msgin = strreplace("/me", strcat(colorprefix, namestr), msgin);
msgstr = strcat("\{1}^4* ", "^7", msgin);
}
- else
- msgstr = strcat("\{1}", colorprefix, namestr, "^7: ", msgin);
+ else {
+ msgstr = "\{1}";
+ msgstr = strcat(msgstr, (namestr != "") ? strcat(colorprefix, namestr, "^7: ") : "^7");
+ msgstr = strcat(msgstr, msgin);
+ }
cmsgstr = "";
}
msgstr = strcat(strreplace("\n", " ", msgstr), "\n"); // newlines only are good for centerprint
}
- else
- {
- msgstr = cmsgstr = "";
- }
- fullmsgstr = msgstr;
- fullcmsgstr = cmsgstr;
+ string fullmsgstr = msgstr;
+ string fullcmsgstr = cmsgstr;
// FLOOD CONTROL
- flood = 0;
- flood_field = floodcontrol_chat;
+ int flood = 0;
+ var .float flood_field = floodcontrol_chat;
if(floodcontrol)
{
float flood_spl;
source.(flood_field) = flood = 0;
}
+ string sourcemsgstr, sourcecmsgstr;
if(flood == 2) // cannot happen for empty msgstr
{
if(autocvar_g_chat_flood_notify_flooder)
sourcecmsgstr = cmsgstr;
}
- if(!privatesay)
- if (!IS_PLAYER(source))
+ if (!privatesay && source && !IS_PLAYER(source))
{
if (!intermission_running)
if(teamsay || (autocvar_g_chat_nospectators == 1) || (autocvar_g_chat_nospectators == 2 && !(warmup_stage || gameover)))
if(privatesay)
sourcemsgstr = strcat(privatemsgprefix, substring(sourcemsgstr, privatemsgprefixlen, -1));
+ int ret;
if(source.muted)
{
// always fake the message
{
sprint(source, sourcemsgstr);
dedicated_print(msgstr); // send to server console too
- FOREACH_CLIENT(IS_REAL_CLIENT(it) && it != source && it.active_minigame == source.active_minigame, LAMBDA(sprint(it, msgstr)));
+ FOREACH_CLIENT(IS_REAL_CLIENT(it) && it != source && it.active_minigame == source.active_minigame, sprint(it, msgstr));
}
else if(teamsay > 0) // team message, only sent to team mates
{
dedicated_print(msgstr); // send to server console too
if(sourcecmsgstr != "")
centerprint(source, sourcecmsgstr);
- FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it) && it != source && it.team == source.team, LAMBDA(
+ FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it) && it != source && it.team == source.team, {
sprint(it, msgstr);
if(cmsgstr != "")
centerprint(it, cmsgstr);
- ));
+ });
}
else if(teamsay < 0) // spectator message, only sent to spectators
{
sprint(source, sourcemsgstr);
dedicated_print(msgstr); // send to server console too
- FOREACH_CLIENT(!IS_PLAYER(it) && IS_REAL_CLIENT(it) && it != source, LAMBDA(sprint(it, msgstr)));
- }
- else if(sourcemsgstr != msgstr) // trimmed/server fixed message, sent to all players
- {
- sprint(source, sourcemsgstr);
- dedicated_print(msgstr); // send to server console too
- FOREACH_CLIENT(IS_REAL_CLIENT(it) && it != source, LAMBDA(sprint(it, msgstr)));
+ FOREACH_CLIENT(!IS_PLAYER(it) && IS_REAL_CLIENT(it) && it != source, sprint(it, msgstr));
}
else
- bprint(msgstr); // entirely normal message, sent to all players -- bprint sends to server console too.
+ {
+ if (source) {
+ sprint(source, sourcemsgstr);
+ dedicated_print(msgstr); // send to server console too
+ MX_Say(strcat(playername(source), "^7: ", msgin));
+ }
+ FOREACH_CLIENT(IS_REAL_CLIENT(it) && it != source, sprint(it, msgstr));
+ }
}
return ret;
if (command != command2) return;
// if we're banned, don't even parse the command
- if (Ban_MaybeEnforceBanOnce(self)) return;
+ if (Ban_MaybeEnforceBanOnce(this)) return;
float argc = tokenize_console(command);
{
if (argc == 1)
{
- sprint(self, "\nClient networked commands:\n");
+ sprint(this, "\nClient networked commands:\n");
ClientCommand_macro_help();
- sprint(self, "\nCommon networked commands:\n");
- CommonCommand_macro_help(self);
+ sprint(this, "\nCommon networked commands:\n");
+ CommonCommand_macro_help(this);
- sprint(self, "\nUsage:^3 cmd COMMAND...^7, where possible commands are listed above.\n");
- sprint(self, "For help about a specific command, type cmd help COMMAND\n");
+ sprint(this, "\nUsage:^3 cmd COMMAND...^7, where possible commands are listed above.\n");
+ sprint(this, "For help about a specific command, type cmd help COMMAND\n");
return;
}
- else if (CommonCommand_macro_usage(argc, self)) // Instead of trying to call a command, we're going to see detailed information about it
+ else if (CommonCommand_macro_usage(argc, this)) // Instead of trying to call a command, we're going to see detailed information about it
{
return;
}
{
return; // handled by server/cheats.qc
}
- else if (CommonCommand_macro_command(argc, self, command))
+ else if (CommonCommand_macro_command(argc, this, command))
{
return; // handled by server/command/common.qc
}
}
else
{
- clientcommand(self, command);
+ clientcommand(this, command);
}
}
int n = 0;
FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it), LAMBDA(
if (it.caplayer) it.caplayer = 0;
- WITH(entity, self, it, PutObserverInServer());
+ WITHSELF(it, PutObserverInServer());
++n;
));
if (n) bprint(strcat("Successfully forced all (", ftos(n), ") players to spectate", (reason ? strcat(" for reason: '", reason, "'") : ""), ".\n"));
if (!IS_SPEC(client) && !IS_OBSERVER(client))
{
if (client.caplayer) client.caplayer = 0;
- WITH(entity, self, client, PutObserverInServer());
+ WITHSELF(client, PutObserverInServer());
successful = strcat(successful, (successful ? ", " : ""), client.netname);
}
return;
}
- WITH(entity, self, client, playerdemo_open_read(argv(next_token)));
+ WITHSELF(client, playerdemo_open_read(argv(next_token)));
return;
}
return;
}
- WITH(entity, self, client, playerdemo_open_write(argv(next_token)));
+ WITHSELF(client, playerdemo_open_write(argv(next_token)));
return;
}
MUTATOR_CALLHOOK(reset_map_global);
- FOREACH_ENTITY_ORDERED(IS_NOT_A_CLIENT(it), LAMBDA(
+ FOREACH_ENTITY_ORDERED(IS_NOT_A_CLIENT(it), {
if (it.reset)
{
- WITH(entity, self, it, it.reset(it));
+ WITHSELF(it, it.reset(it));
continue;
}
if (it.team_saved) it.team = it.team_saved;
if (it.flags & FL_PROJECTILE) remove(it); // remove any projectiles left
- ));
+ });
// Waypoints and assault start come LAST
- FOREACH_ENTITY_ORDERED(IS_NOT_A_CLIENT(it), LAMBDA(
- if (it.reset2) WITH(entity, self, it, it.reset2());
- ));
+ FOREACH_ENTITY_ORDERED(IS_NOT_A_CLIENT(it), {
+ if (it.reset2) WITHSELF(it, it.reset2());
+ });
- FOREACH_CLIENT(IS_PLAYER(it) && STAT(FROZEN, it), LAMBDA(WITH(entity, self, it, Unfreeze(it))));
+ FOREACH_CLIENT(IS_PLAYER(it) && STAT(FROZEN, it), LAMBDA(WITHSELF(it, Unfreeze(it))));
// Moving the player reset code here since the player-reset depends
// on spawnpoint entities which have to be reset first --blub
WepSet weaponsInMap;
#define weapons _STAT(WEAPONS)
-#define weaponsinmap _STAT(WEAPONSINMAP)
.float respawn_countdown; // next number to count
float game_starttime; //point in time when the countdown to game start is over
float round_starttime; //point in time when the countdown to round start is over
-.float stat_game_starttime = _STAT(GAMESTARTTIME);
-.float stat_round_starttime = _STAT(ROUNDSTARTTIME);
void W_Porto_Remove (entity p);
.string message2;
-.bool stat_allow_oldvortexbeam = _STAT(ALLOW_OLDVORTEXBEAM);
-
// reset to 0 on weapon switch
// may be useful to all weapons
.float bulletcounter;
.float damage_dealt_total = _STAT(DAMAGE_DEALT_TOTAL);
-.float stat_leadlimit = _STAT(LEADLIMIT);
-
bool radar_showennemies;
#ifdef PROFILING
targ.iceblock = ice;
targ.revival_time = 0;
- WITH(entity, self, ice, Ice_Think());
+ WITHSELF(ice, Ice_Think());
RemoveGrapplingHook(targ);
*/
void dynlight_think()
{
+ SELFPARAM();
if(!self.owner)
remove(self);
self.nextthink = time + 0.1;
}
-void dynlight_find_aiment()
+void dynlight_find_aiment(entity this)
{
entity targ;
if (!self.target)
self.think = dynlight_think;
self.nextthink = time + 0.1;
}
-void dynlight_find_path()
+void dynlight_find_path(entity this)
{
entity targ;
if (!self.target)
self.think = train_next;
self.nextthink = time + 0.1;
}
-void dynlight_find_target()
+void dynlight_find_target(entity this)
{
entity targ;
if (!self.target)
}
void dynlight_use()
{
+ SELFPARAM();
if (self.light_lev == 0)
self.light_lev = self.lefty;
else
g_clientmodel_setcolormaptoactivator();
}
-void g_model_dropbyspawnflags()
-{SELFPARAM();
+void g_model_dropbyspawnflags(entity this)
+{
if((self.spawnflags & 3) == 1) // ALIGN_ORIGIN
{
traceline(self.origin, self.origin - '0 0 4096', MOVE_NOMONSTERS, self);
}
}
-void g_clientmodel_dropbyspawnflags()
-{SELFPARAM();
+void g_clientmodel_dropbyspawnflags(entity this)
+{
vector o0;
o0 = self.origin;
- g_model_dropbyspawnflags();
+ g_model_dropbyspawnflags(self);
if(self.origin != o0)
self.SendFlags |= 2;
}
{
int d = autocvar_loddebug;
if(d == 1)
- self.modelindex = self.lodmodelindex0;
- else if(d == 2 || !self.lodmodelindex2)
- self.modelindex = self.lodmodelindex1;
+ this.modelindex = this.lodmodelindex0;
+ else if(d == 2 || !this.lodmodelindex2)
+ this.modelindex = this.lodmodelindex1;
else // if(d == 3)
- self.modelindex = self.lodmodelindex2;
+ this.modelindex = this.lodmodelindex2;
return true;
}
// TODO csqc network this so it only gets sent once
- vector near_point = NearestPointOnBox(self, other.origin);
- if(vdist(near_point - other.origin, <, self.loddistance1))
- self.modelindex = self.lodmodelindex0;
- else if(!self.lodmodelindex2 || vdist(near_point - other.origin, <, self.loddistance2))
- self.modelindex = self.lodmodelindex1;
+ vector near_point = NearestPointOnBox(this, other.origin);
+ if(vdist(near_point - other.origin, <, this.loddistance1))
+ this.modelindex = this.lodmodelindex0;
+ else if(!this.lodmodelindex2 || vdist(near_point - other.origin, <, this.loddistance2))
+ this.modelindex = this.lodmodelindex1;
else
- self.modelindex = self.lodmodelindex2;
+ this.modelindex = this.lodmodelindex2;
return true;
}
void LOD_uncustomize()
{SELFPARAM();
- self.modelindex = self.lodmodelindex0;
+ this.modelindex = this.lodmodelindex0;
}
-void LODmodel_attach()
-{SELFPARAM();
+void LODmodel_attach(entity this)
+{
entity e;
- if(!self.loddistance1)
- self.loddistance1 = 1000;
- if(!self.loddistance2)
- self.loddistance2 = 2000;
- self.lodmodelindex0 = self.modelindex;
+ if(!this.loddistance1)
+ this.loddistance1 = 1000;
+ if(!this.loddistance2)
+ this.loddistance2 = 2000;
+ this.lodmodelindex0 = this.modelindex;
- if(self.lodtarget1 != "")
+ if(this.lodtarget1 != "")
{
- e = find(world, targetname, self.lodtarget1);
+ e = find(world, targetname, this.lodtarget1);
if(e)
{
- self.lodmodel1 = e.model;
+ this.lodmodel1 = e.model;
remove(e);
}
}
- if(self.lodtarget2 != "")
+ if(this.lodtarget2 != "")
{
- e = find(world, targetname, self.lodtarget2);
+ e = find(world, targetname, this.lodtarget2);
if(e)
{
- self.lodmodel2 = e.model;
+ this.lodmodel2 = e.model;
remove(e);
}
}
if(autocvar_loddebug < 0)
{
- self.lodmodel1 = self.lodmodel2 = ""; // don't even initialize
+ this.lodmodel1 = this.lodmodel2 = ""; // don't even initialize
}
- if(self.lodmodel1 != "")
+ if(this.lodmodel1 != "")
{
vector mi, ma;
- mi = self.mins;
- ma = self.maxs;
+ mi = this.mins;
+ ma = this.maxs;
- precache_model(self.lodmodel1);
- _setmodel(self, self.lodmodel1);
- self.lodmodelindex1 = self.modelindex;
+ precache_model(this.lodmodel1);
+ _setmodel(this, this.lodmodel1);
+ this.lodmodelindex1 = this.modelindex;
- if(self.lodmodel2 != "")
+ if(this.lodmodel2 != "")
{
- precache_model(self.lodmodel2);
- _setmodel(self, self.lodmodel2);
- self.lodmodelindex2 = self.modelindex;
+ precache_model(this.lodmodel2);
+ _setmodel(this, this.lodmodel2);
+ this.lodmodelindex2 = this.modelindex;
}
- self.modelindex = self.lodmodelindex0;
- setsize(self, mi, ma);
+ this.modelindex = this.lodmodelindex0;
+ setsize(this, mi, ma);
}
- if(self.lodmodelindex1)
- if (!self.SendEntity)
- SetCustomizer(self, LOD_customize, LOD_uncustomize);
+ if(this.lodmodelindex1)
+ if (!this.SendEntity)
+ SetCustomizer(this, LOD_customize, LOD_uncustomize);
}
void ApplyMinMaxScaleAngles(entity e)
void LOD_uncustomize();
-void LODmodel_attach();
+void LODmodel_attach(entity this);
void ApplyMinMaxScaleAngles(entity e);
delta = 3 / maxclients;
if(delta < sys_frametime)
delta = 0;
- self.nextthink = time + delta;
+ this.nextthink = time + delta;
- e = edict_num(self.cnt + 1);
+ e = edict_num(this.cnt + 1);
if(IS_REAL_CLIENT(e))
{
WriteHeader(MSG_BROADCAST, TE_CSQC_PINGPLREPORT);
- WriteByte(MSG_BROADCAST, self.cnt);
+ WriteByte(MSG_BROADCAST, this.cnt);
WriteShort(MSG_BROADCAST, max(1, e.ping));
WriteByte(MSG_BROADCAST, ceil(e.ping_packetloss * 255));
WriteByte(MSG_BROADCAST, ceil(e.ping_movementloss * 255));
else
{
WriteHeader(MSG_BROADCAST, TE_CSQC_PINGPLREPORT);
- WriteByte(MSG_BROADCAST, self.cnt);
+ WriteByte(MSG_BROADCAST, this.cnt);
WriteShort(MSG_BROADCAST, 0);
WriteByte(MSG_BROADCAST, 0);
WriteByte(MSG_BROADCAST, 0);
}
- self.cnt = (self.cnt + 1) % maxclients;
+ this.cnt = (this.cnt + 1) % maxclients;
}
void PingPLReport_Spawn()
{
BADCVAR("sv_autotaunt");
BADCVAR("sv_curl_defaulturl");
BADCVAR("sv_defaultcharacter");
+ BADCVAR("sv_defaultcharacterskin");
BADCVAR("sv_defaultplayercolors");
BADCVAR("sv_defaultplayermodel");
BADCVAR("sv_defaultplayerskin");
bool RandomSeed_Send(entity this, entity to, int sf)
{
WriteHeader(MSG_ENTITY, ENT_CLIENT_RANDOMSEED);
- WriteShort(MSG_ENTITY, self.cnt);
+ WriteShort(MSG_ENTITY, this.cnt);
return true;
}
void RandomSeed_Think()
{SELFPARAM();
- self.cnt = bound(0, floor(random() * 65536), 65535);
- self.nextthink = time + 5;
+ this.cnt = bound(0, floor(random() * 65536), 65535);
+ this.nextthink = time + 5;
- self.SendFlags |= 1;
+ this.SendFlags |= 1;
}
void RandomSeed_Spawn()
{SELFPARAM();
randomseed.think = RandomSeed_Think;
Net_LinkEntity(randomseed, false, 0, RandomSeed_Send);
- WITH(entity, self, randomseed, randomseed.think()); // sets random seed and nextthink
+ WITHSELF(randomseed, randomseed.think()); // sets random seed and nextthink
}
spawnfunc(__init_dedicated_server)
MapInfo_Shutdown();
}
+void SetLimits(int fraglimit_override, int leadlimit_override, float timelimit_override, float qualifying_override)
+{
+ if(!autocvar_g_campaign)
+ {
+ if(fraglimit_override >= 0) cvar_set("fraglimit", ftos(fraglimit_override));
+ if(timelimit_override >= 0) cvar_set("timelimit", ftos(timelimit_override));
+ if(leadlimit_override >= 0) cvar_set("leadlimit", ftos(leadlimit_override));
+ if(qualifying_override >= 0) cvar_set("g_race_qualifying_timelimit", ftos(qualifying_override));
+ }
+ limits_are_set = true;
+}
+
void Map_MarkAsRecent(string m);
float world_already_spawned;
void Nagger_Init();
{
server_is_dedicated = boolean(stof(cvar_defstring("is_dedicated")));
+ bool wantrestart = false;
{
- bool wantrestart = false;
-
if (!server_is_dedicated)
{
// force unloading of server pk3 files when starting a listen server
readlevelcvars();
GrappleHookInit();
+ if(!limits_are_set)
+ SetLimits(autocvar_fraglimit_override, autocvar_leadlimit_override, autocvar_timelimit_override, -1);
+
+ if(warmup_limit == 0)
+ warmup_limit = (autocvar_timelimit > 0) ? autocvar_timelimit * 60 : autocvar_timelimit;
+
player_count = 0;
bot_waypoints_for_items = autocvar_g_waypoints_for_items;
if(bot_waypoints_for_items == 1)
CheatInit();
- localcmd("\n_sv_hook_gamestart ", GetGametype(), "\n");
+ if (!wantrestart) localcmd("\n_sv_hook_gamestart ", GetGametype(), "\n");
// fill sv_curl_serverpackages from .serverpackage files
if (autocvar_sv_curl_serverpackages_auto)
bprint(it.netname, " ^7wins.\n");
));
- entity oldself = self;
- target_music_kill();
- self = oldself;
+ WITHSELF(NULL, target_music_kill());
if(autocvar_g_campaign)
CampaignPreIntermission();
if (gameover) // someone else quit the game already
return;
- if(!IS_DEAD(self))
- self.play_time += frametime;
+ if(!IS_DEAD(this))
+ this.play_time += frametime;
// fixme: don't check players; instead check spawnfunc_dom_team and spawnfunc_ctf_team entities
// (div0: and that in CheckRules_World please)
const int WINNING_NEVER = 2; // no winner, enter overtime if time limit is reached
const int WINNING_STARTSUDDENDEATHOVERTIME = 3; // no winner, enter suddendeath overtime NOW
+bool limits_are_set = false;
+void SetLimits(int fraglimit_override, int leadlimit_override, float timelimit_override, float qualifying_override);
+
float WinningCondition_Scores(float limit, float leadlimit);
void SetWinners(.float field, float value);
void CheckRules_Player();
--- /dev/null
+#include "matrix.qh"
+
+#include "cl_player.qh"
+
+var void MX_Handle(int buf, string ancestor)
+{
+ string type = json_get(buf, strcat(ancestor, ".type"));
+ switch (type) {
+ case "m.room.message": {
+ string msgtype = json_get(buf, strcat(ancestor, ".content.msgtype"));
+ switch (msgtype) {
+ case "m.text": {
+ string sender = json_get(buf, strcat(ancestor, ".sender"));
+ string body = json_get(buf, strcat(ancestor, ".content.body"));
+ if (sender != matrix_user && body) Say(NULL, false, NULL, body, false);
+ break;
+ }
+ }
+ break;
+ }
+ }
+}
--- /dev/null
+#pragma once
builtin_remove(e);
}
-void InitializeEntity(entity e, void() func, float order)
+void InitializeEntity(entity e, void(entity this) func, float order)
{
entity prev, cur;
}
}
void InitializeEntitiesRun()
-{SELFPARAM();
+{
entity startoflist = initialize_entity_first;
initialize_entity_first = NULL;
remove = remove_except_protected;
e.initialize_entity_order = 0;
entity next = e.initialize_entity_next;
e.initialize_entity_next = NULL;
- var void() func = e.initialize_entity;
+ var void(entity this) func = e.initialize_entity;
e.initialize_entity = func_null;
if (e.classname == "initialize_entity")
{
//dprint("Delayed initialization: ", e.classname, "\n");
if (func)
{
- WITH(entity, self, e, func());
+ WITHSELF(e, func(e));
}
else
{
}
// deferred dropping
-void DropToFloor_Handler()
-{SELFPARAM();
+void DropToFloor_Handler(entity this)
+{
builtin_droptofloor();
self.dropped_origin = self.origin;
}
warmup_stage = cvar("g_warmup");
warmup_limit = cvar("g_warmup_limit");
- if(warmup_limit == 0)
- warmup_limit = (autocvar_timelimit > 0) ? autocvar_timelimit * 60 : autocvar_timelimit;
g_warmup_allguns = cvar("g_warmup_allguns");
g_warmup_allow_timeout = cvar("g_warmup_allow_timeout");
const float INITPRIO_LINKDOORS = 91;
const float INITPRIO_LAST = 99;
-.void() initialize_entity;
+.void(entity this) initialize_entity;
.float initialize_entity_order;
.entity initialize_entity_next;
entity initialize_entity_first;
float sound_allowed(float dest, entity e);
-void InitializeEntity(entity e, void() func, float order);
+void InitializeEntity(entity e, void(entity this) func, float order);
void SetCustomizer(entity e, float() customizer, void() uncustomizer);
* called when a vehicle initializes
* return true to remove the vehicle
*/
-MUTATOR_HOOKABLE(VehicleSpawn, EV_NO_ARGS);
+#define EV_VehicleSpawn(i, o) \
+ /**/ i(entity, __self) \
+ /**/
+MUTATOR_HOOKABLE(VehicleSpawn, EV_VehicleSpawn);
/**
* called when a player enters a vehicle
{
if (e.classname == "target_objective_decrease")
{
- WITH(entity, self, e, target_objective_decrease_activate());
+ WITHSELF(e, target_objective_decrease_activate());
}
}
}
}
-void assault_setenemytoobjective()
-{SELFPARAM();
+void assault_setenemytoobjective(entity this)
+{
entity objective;
for(objective = world; (objective = find(objective, targetname, self.target)); )
{
}
}
-void target_objective_decrease_findtarget()
+void target_objective_decrease_findtarget(entity this)
{
- assault_setenemytoobjective();
+ assault_setenemytoobjective(this);
}
void target_assault_roundend_reset(entity this)
self.winning = 1; // round has been won by attackers
}
-void assault_roundstart_use()
-{SELFPARAM();
+void assault_roundstart_use(entity this)
+{
activator = self;
SUB_UseTargets();
it.team = NUM_TEAM_1;
// Dubbles as teamchange
- WITH(entity, self, it, turret_respawn());
+ WITHSELF(it, turret_respawn());
));
}
+void assault_roundstart_use_self()
+{
+ SELFPARAM();
+ assault_roundstart_use(this);
+}
void assault_wall_think()
{SELFPARAM();
//bprint("ASSAULT: new round\n");
// Eject players from vehicles
- FOREACH_CLIENT(IS_PLAYER(it) && it.vehicle, LAMBDA(WITH(entity, self, it, vehicles_exit(VHEF_RELEASE))));
+ FOREACH_CLIENT(IS_PLAYER(it) && it.vehicle, WITHSELF(it, vehicles_exit(VHEF_RELEASE)));
FOREACH_ENTITY_FLAGS(vehicle_flags, VHF_ISVEHICLE, LAMBDA(
setself(it);
}
else
{
- WITH(entity, self, ent, assault_new_round());
+ WITHSELF(ent, assault_new_round());
}
}
}
assault_attacker_team = NUM_TEAM_1;
self.classname = "target_assault_roundstart";
- self.use = assault_roundstart_use;
- self.reset2 = assault_roundstart_use;
+ self.use = assault_roundstart_use_self;
+ self.reset2 = assault_roundstart_use_self;
InitializeEntity(self, assault_roundstart_use, INITPRIO_FINDTARGET);
}
EliminatedPlayers_Init(ca_isEliminated);
ActivateTeamplay();
- SetLimits(autocvar_g_ca_point_limit, autocvar_g_ca_point_leadlimit, -1, -1);
+ SetLimits(autocvar_g_ca_point_limit, autocvar_g_ca_point_leadlimit, autocvar_timelimit_override, -1);
if (autocvar_g_ca_team_spawns)
have_team_spawns = -1; // request team spawns
{
TRANSMUTE(Player, it);
it.caplayer = 1;
- WITH(entity, self, it, PutClientInServer());
+ WITHSELF(it, PutClientInServer());
}
});
return true;
MUTATOR_HOOKFUNCTION(ca, MakePlayerObserver)
{
SELFPARAM();
- if (this.caplayer == 1)
+ if (!IS_DEAD(this))
ca_LastPlayerForTeam_Notify();
if (this.killindicator_teamchange == -2)
this.caplayer = 0;
ctf_Initialize();
ActivateTeamplay();
- SetLimits(autocvar_capturelimit_override, autocvar_captureleadlimit_override, -1, -1);
+ SetLimits(autocvar_capturelimit_override, autocvar_captureleadlimit_override, autocvar_timelimit_override, -1);
have_team_spawns = -1; // request team spawns
}
ctf_RespawnFlag(this);
}
-void ctf_DelayedFlagSetup() // called after a flag is placed on a map by ctf_FlagSetup()
-{SELFPARAM();
+void ctf_DelayedFlagSetup(entity this) // called after a flag is placed on a map by ctf_FlagSetup()
+{
// bot waypoints
waypoint_spawnforitem_force(self, self.origin);
self.nearestwaypointtimeout = 0; // activate waypointing again
this.netname = teamname;
this.cnt = teamcolor;
this.spawnfunc_checked = true;
- WITH(entity, self, this, spawnfunc_ctf_team(this));
+ WITHSELF(this, spawnfunc_ctf_team(this));
}
-void ctf_DelayedInit() // Do this check with a delay so we can wait for teams to be set up.
+void ctf_DelayedInit(entity this) // Do this check with a delay so we can wait for teams to be set up.
{
ctf_teams = 2;
g_race_qualifying = true;
independent_players = 1;
- SetLimits(0, 0, -1, -1);
+ SetLimits(0, 0, autocvar_timelimit_override, -1);
cts_Initialize();
}
fraglimit_override = autocvar_g_domination_roundbased_point_limit;
ActivateTeamplay();
- SetLimits(fraglimit_override, autocvar_g_domination_point_leadlimit, -1, -1);
+ SetLimits(fraglimit_override, autocvar_g_domination_point_leadlimit, autocvar_timelimit_override, -1);
have_team_spawns = -1; // request team spawns
}
dom_spawnteam("", 0, "models/domination/dom_unclaimed.md3", 0, SND_Null, "", "");
}
-void dom_DelayedInit() // Do this check with a delay so we can wait for teams to be set up.
+void dom_DelayedInit(entity this) // Do this check with a delay so we can wait for teams to be set up.
{
// if no teams are found, spawn defaults
if(find(world, classname, "dom_team") == world || autocvar_g_domination_teams_override >= 2)
freezetag_Initialize();
ActivateTeamplay();
- SetLimits(autocvar_g_freezetag_point_limit, autocvar_g_freezetag_point_leadlimit, -1, -1);
+ SetLimits(autocvar_g_freezetag_point_limit, autocvar_g_freezetag_point_leadlimit, autocvar_timelimit_override, -1);
if (autocvar_g_freezetag_team_spawns)
have_team_spawns = -1; // request team spawns
if(round_handler_CountdownRunning())
{
if(STAT(FROZEN, frag_target))
- WITH(entity, self, frag_target, freezetag_Unfreeze(world));
+ WITHSELF(frag_target, freezetag_Unfreeze(world));
freezetag_count_alive_players();
return 1; // let the player die so that he can respawn whenever he wants
}
freezetag_LastPlayerForTeam_Notify();
}
else
- WITH(entity, self, frag_target, freezetag_Unfreeze(world)); // remove ice
+ WITHSELF(frag_target, freezetag_Unfreeze(world)); // remove ice
frag_target.health = 0; // Unfreeze resets health
frag_target.freezetag_frozen_timeout = -2; // freeze on respawn
return 1;
if(STAT(FROZEN, frag_target))
return 1;
- WITH(entity, self, frag_target, freezetag_Freeze(frag_attacker));
+ WITHSELF(frag_target, freezetag_Freeze(frag_attacker));
freezetag_LastPlayerForTeam_Notify();
if(frag_attacker == frag_target || frag_attacker == world)
cvar_settemp("g_monsters", "1");
- SetLimits(autocvar_g_invasion_point_limit, -1, -1, -1);
+ SetLimits(autocvar_g_invasion_point_limit, autocvar_leadlimit_override, autocvar_timelimit_override, -1);
if (autocvar_g_invasion_teams >= 2)
{
ActivateTeamplay();
ScoreRules_basics_end();
}
-void invasion_DelayedInit() // Do this check with a delay so we can wait for teams to be set up.
+void invasion_DelayedInit(entity this) // Do this check with a delay so we can wait for teams to be set up.
{
if(autocvar_g_invasion_teams)
invasion_teams = bound(2, autocvar_g_invasion_teams, 4);
}
void ka_TouchEvent();
-void ka_RespawnBall() // runs whenever the ball needs to be relocated
-{SELFPARAM();
+void ka_RespawnBall(entity this) // runs whenever the ball needs to be relocated
+{
if(gameover) { return; }
vector oldballorigin = self.origin;
self.angles = '0 0 0';
self.effects = autocvar_g_keepawayball_effects;
self.touch = ka_TouchEvent;
- self.think = ka_RespawnBall;
+ setthink(self, ka_RespawnBall);
self.nextthink = time + autocvar_g_keepawayball_respawntime;
Send_Effect(EFFECT_ELECTRO_COMBO, oldballorigin, '0 0 0', 1);
if(!self) { return; }
if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT)
{ // The ball fell off the map, respawn it since players can't get to it
- ka_RespawnBall();
+ ka_RespawnBall(self);
return;
}
if(IS_DEAD(other)) { return; }
ball.movetype = MOVETYPE_BOUNCE;
ball.wait = time + 1;
ball.touch = ka_TouchEvent;
- ball.think = ka_RespawnBall;
+ setthink(ball, ka_RespawnBall);
ball.nextthink = time + autocvar_g_keepawayball_respawntime;
ball.takedamage = DAMAGE_YES;
ball.effects &= ~EF_NODRAW;
if(time < game_starttime)
{
- this.think = ka_RespawnBall;
+ setthink(this, ka_RespawnBall);
this.touch = func_null;
this.nextthink = game_starttime;
}
else
- ka_RespawnBall();
+ ka_RespawnBall(this);
}
kh_Initialize();
ActivateTeamplay();
- SetLimits(autocvar_g_keyhunt_point_limit, autocvar_g_keyhunt_point_leadlimit, -1, -1);
+ SetLimits(autocvar_g_keyhunt_point_limit, autocvar_g_keyhunt_point_leadlimit, autocvar_timelimit_override, -1);
if (autocvar_g_keyhunt_team_spawns)
have_team_spawns = -1; // request team spawns
}
error("This is a game type and it cannot be added at runtime.");
lms_Initialize();
- SetLimits(((!autocvar_g_lms_lives_override) ? -1 : autocvar_g_lms_lives_override), 0, -1, -1);
+ SetLimits(((!autocvar_g_lms_lives_override) ? -1 : autocvar_g_lms_lives_override), 0, autocvar_timelimit_override, -1);
}
MUTATOR_ONROLLBACK_OR_REMOVE
MUTATOR_HOOKFUNCTION(lms, PlayerPreThink)
{SELFPARAM();
- if(self.deadflag == DEAD_DYING)
- self.deadflag = DEAD_RESPAWNING;
+ if(this.deadflag == DEAD_DYING)
+ this.deadflag = DEAD_RESPAWNING;
return false;
}
{
if(!g_race_qualifying)
{
- ret_float = WinningCondition_QualifyingThenRace(checkrules_fraglimit);
+ ret_float = WinningCondition_Race(checkrules_fraglimit);
return true;
}
else if(g_race_qualifying == 2)
qualifying_override = autocvar_g_race_qualifying_timelimit_override;
fraglimit_override = autocvar_g_race_laps_limit;
leadlimit_override = 0; // currently not supported by race
- timelimit_override = -1; // use default if we don't set it below
+ timelimit_override = autocvar_timelimit_override;
- // we need to find out the correct value for g_race_qualifying
float want_qualifying = ((qualifying_override >= 0) ? qualifying_override : autocvar_g_race_qualifying_timelimit) > 0;
if(autocvar_g_campaign)
g_race_qualifying = 1;
independent_players = 1;
}
- else if(!autocvar_g_campaign && want_qualifying)
+ else if(want_qualifying)
{
g_race_qualifying = 2;
independent_players = 1;
- race_fraglimit = (race_fraglimit >= 0) ? fraglimit_override : autocvar_fraglimit;
- race_leadlimit = (race_leadlimit >= 0) ? leadlimit_override : autocvar_leadlimit;
- race_timelimit = (race_timelimit >= 0) ? timelimit_override : autocvar_timelimit;
+ race_fraglimit = (fraglimit_override >= 0) ? fraglimit_override : autocvar_fraglimit;
+ race_leadlimit = (leadlimit_override >= 0) ? leadlimit_override : autocvar_leadlimit;
+ race_timelimit = (timelimit_override >= 0) ? timelimit_override : autocvar_timelimit;
+ qualifying_override = (qualifying_override >= 0) ? qualifying_override : autocvar_g_race_qualifying_timelimit;
fraglimit_override = 0;
leadlimit_override = 0;
- timelimit_override = autocvar_g_race_qualifying_timelimit;
+ timelimit_override = qualifying_override;
}
else
g_race_qualifying = 0;
-
SetLimits(fraglimit_override, leadlimit_override, timelimit_override, qualifying_override);
}
int autocvar_g_tdm_point_limit;
int autocvar_g_tdm_point_leadlimit;
bool autocvar_g_tdm_team_spawns;
-void tdm_DelayedInit();
+void tdm_DelayedInit(entity this);
REGISTER_MUTATOR(tdm, false)
{
InitializeEntity(world, tdm_DelayedInit, INITPRIO_GAMETYPE);
ActivateTeamplay();
- SetLimits(autocvar_g_tdm_point_limit, autocvar_g_tdm_point_leadlimit, -1, -1);
+ SetLimits(autocvar_g_tdm_point_limit, autocvar_g_tdm_point_leadlimit, autocvar_timelimit_override, -1);
if (autocvar_g_tdm_team_spawns)
have_team_spawns = -1; // request team spawns
}
this.netname = teamname;
this.cnt = teamcolor;
this.spawnfunc_checked = true;
- WITH(entity, self, this, spawnfunc_tdm_team(this));
+ WITHSELF(this, spawnfunc_tdm_team(this));
}
-void tdm_DelayedInit()
+void tdm_DelayedInit(entity this)
{
// if no teams are found, spawn defaults
if(find(world, classname, "tdm_team") == world)
}
void playerdemo_write()
{SELFPARAM();
- if(self.playerdemo_mode != PLAYERDEMO_MODE_WRITING)
+ if(this.playerdemo_mode != PLAYERDEMO_MODE_WRITING)
return;
- fputs(self.playerdemo_fh, strcat(ftos(time - self.playerdemo_starttime), "\n"));
+ fputs(this.playerdemo_fh, strcat(ftos(time - this.playerdemo_starttime), "\n"));
PLAYERDEMO_FIELDS(playerdemo_write_)
}
void playerdemo_read_originvector(.vector f, string name)
PLAYERDEMO_FIELDS(playerdemo_read_)
{
time = this.playerdemo_time;
- WITH(entity, self, this, PlayerPreThink());
+ WITHSELF(this, PlayerPreThink());
// not running physics though... this is just so we can run weapon stuff
- WITH(entity, self, this, PlayerPostThink());
+ WITHSELF(this, PlayerPostThink());
}
this.playerdemo_time = stof(fgets(this.playerdemo_fh));
if(this.playerdemo_time == 0)
return false;
}
-float have_verified;
-void trigger_race_checkpoint_verify()
-{SELFPARAM();
- entity cp;
- float i, p;
- float qual;
-
- if(have_verified)
- return;
- have_verified = 1;
+void trigger_race_checkpoint_verify(entity this)
+{
+ static bool have_verified;
+ if (have_verified) return;
+ have_verified = true;
- qual = g_race_qualifying;
+ bool qual = g_race_qualifying;
- setself(spawn());
- TRANSMUTE(Player, self);
+ int pl_race_checkpoint = 0;
+ int pl_race_place = 0;
- if(g_race)
- {
- for(i = 0; i <= race_highest_checkpoint; ++i)
- {
- self.race_checkpoint = race_NextCheckpoint(i);
+ if (g_race) {
+ for (int i = 0; i <= race_highest_checkpoint; ++i) {
+ pl_race_checkpoint = race_NextCheckpoint(i);
// race only (middle of the race)
- g_race_qualifying = 0;
- self.race_place = 0;
- if(!Spawn_FilterOutBadSpots(findchain(classname, "info_player_deathmatch"), 0, false))
- error(strcat("Checkpoint ", ftos(i), " misses a spawnpoint with race_place==", ftos(self.race_place), " (used for respawning in race) - bailing out"));
+ g_race_qualifying = false;
+ pl_race_place = 0;
+ if (!Spawn_FilterOutBadSpots(findchain(classname, "info_player_deathmatch"), 0, false)) {
+ error(strcat("Checkpoint ", ftos(i), " misses a spawnpoint with race_place==", ftos(pl_race_place), " (used for respawning in race) - bailing out"));
+ }
- if(i == 0)
- {
+ if (i == 0) {
// qualifying only
g_race_qualifying = 1;
- self.race_place = race_lowest_place_spawn;
- if(!Spawn_FilterOutBadSpots(findchain(classname, "info_player_deathmatch"), 0, false))
- error(strcat("Checkpoint ", ftos(i), " misses a spawnpoint with race_place==", ftos(self.race_place), " (used for qualifying) - bailing out"));
+ pl_race_place = race_lowest_place_spawn;
+ if (!Spawn_FilterOutBadSpots(findchain(classname, "info_player_deathmatch"), 0, false)) {
+ error(strcat("Checkpoint ", ftos(i), " misses a spawnpoint with race_place==", ftos(pl_race_place), " (used for qualifying) - bailing out"));
+ }
// race only (initial spawn)
g_race_qualifying = 0;
- for(p = 1; p <= race_highest_place_spawn; ++p)
- {
- self.race_place = p;
- if(!Spawn_FilterOutBadSpots(findchain(classname, "info_player_deathmatch"), 0, false))
- error(strcat("Checkpoint ", ftos(i), " misses a spawnpoint with race_place==", ftos(self.race_place), " (used for initially spawning in race) - bailing out"));
+ for (int p = 1; p <= race_highest_place_spawn; ++p) {
+ pl_race_place = p;
+ if (!Spawn_FilterOutBadSpots(findchain(classname, "info_player_deathmatch"), 0, false)) {
+ error(strcat("Checkpoint ", ftos(i), " misses a spawnpoint with race_place==", ftos(pl_race_place), " (used for initially spawning in race) - bailing out"));
+ }
}
}
}
- }
- else if(!defrag_ents)
- {
+ } else if (!defrag_ents) {
// qualifying only
- self.race_checkpoint = race_NextCheckpoint(0);
+ pl_race_checkpoint = race_NextCheckpoint(0);
g_race_qualifying = 1;
- self.race_place = race_lowest_place_spawn;
- if(!Spawn_FilterOutBadSpots(findchain(classname, "info_player_deathmatch"), 0, false))
- error(strcat("Checkpoint 0 misses a spawnpoint with race_place==", ftos(self.race_place), " (used for qualifying) - bailing out"));
- }
- else
- {
- self.race_checkpoint = race_NextCheckpoint(0);
+ pl_race_place = race_lowest_place_spawn;
+ if (!Spawn_FilterOutBadSpots(findchain(classname, "info_player_deathmatch"), 0, false)) {
+ error(strcat("Checkpoint 0 misses a spawnpoint with race_place==", ftos(pl_race_place), " (used for qualifying) - bailing out"));
+ }
+ } else {
+ pl_race_checkpoint = race_NextCheckpoint(0);
g_race_qualifying = 1;
- self.race_place = 0; // there's only one spawn on defrag maps
+ pl_race_place = 0; // there's only one spawn on defrag maps
// check if a defragcp file already exists, then read it and apply the checkpoint order
float fh;
string l;
defragcpexists = fh = fopen(strcat("maps/", GetMapname(), ".defragcp"), FILE_READ);
- if(fh >= 0)
- {
- while((l = fgets(fh)))
- {
+ if (fh >= 0) {
+ while ((l = fgets(fh))) {
len = tokenize_console(l);
- if(len != 2)
- {
+ if (len != 2) {
defragcpexists = -1; // something's wrong in the defrag cp file, set defragcpexists to -1 so that it will be rewritten when someone finishes
continue;
}
- for(cp = world; (cp = find(cp, classname, "target_checkpoint"));)
- if(argv(0) == cp.targetname)
+ for (entity cp = world; (cp = find(cp, classname, "target_checkpoint"));) {
+ if (argv(0) == cp.targetname) {
cp.race_checkpoint = stof(argv(1));
+ }
+ }
}
fclose(fh);
}
g_race_qualifying = qual;
- if(race_timed_checkpoint)
- {
- if(defrag_ents)
- {
- for(cp = world; (cp = find(cp, classname, "target_startTimer"));)
+ if (race_timed_checkpoint) {
+ if (defrag_ents) {
+ for (entity cp = world; (cp = find(cp, classname, "target_startTimer"));) {
WaypointSprite_UpdateSprites(cp.sprite, WP_RaceStart, WP_Null, WP_Null);
- for(cp = world; (cp = find(cp, classname, "target_stopTimer"));)
+ }
+ for (entity cp = world; (cp = find(cp, classname, "target_stopTimer"));) {
WaypointSprite_UpdateSprites(cp.sprite, WP_RaceFinish, WP_Null, WP_Null);
-
- for(cp = world; (cp = find(cp, classname, "target_checkpoint"));)
- {
- if(cp.race_checkpoint == -2) // something's wrong with the defrag cp file or it has not been written yet, set defragcpexists to -1 so that it will be rewritten when someone finishes
+ }
+ for (entity cp = world; (cp = find(cp, classname, "target_checkpoint"));) {
+ if (cp.race_checkpoint == -2) { // something's wrong with the defrag cp file or it has not been written yet, set defragcpexists to -1 so that it will be rewritten when someone finishes
defragcpexists = -1;
+ }
}
-
- if(defragcpexists != -1)
- {
+ if (defragcpexists != -1) {
float largest_cp_id = 0;
- for(cp = world; (cp = find(cp, classname, "target_checkpoint"));)
- if(cp.race_checkpoint > largest_cp_id)
+ for (entity cp = world; (cp = find(cp, classname, "target_checkpoint"));) {
+ if (cp.race_checkpoint > largest_cp_id) {
largest_cp_id = cp.race_checkpoint;
- for(cp = world; (cp = find(cp, classname, "target_stopTimer"));)
+ }
+ }
+ for (entity cp = world; (cp = find(cp, classname, "target_stopTimer"));) {
cp.race_checkpoint = largest_cp_id + 1; // finish line
+ }
race_highest_checkpoint = largest_cp_id + 1;
race_timed_checkpoint = largest_cp_id + 1;
- }
- else
- {
- for(cp = world; (cp = find(cp, classname, "target_stopTimer"));)
+ } else {
+ for (entity cp = world; (cp = find(cp, classname, "target_stopTimer"));) {
cp.race_checkpoint = 255; // finish line
+ }
race_highest_checkpoint = 255;
race_timed_checkpoint = 255;
}
- }
- else
- {
- for(cp = world; (cp = find(cp, classname, "trigger_race_checkpoint")); )
- if(cp.sprite)
- {
- if(cp.race_checkpoint == 0)
+ } else {
+ for (entity cp = world; (cp = find(cp, classname, "trigger_race_checkpoint")); ) {
+ if (cp.sprite) {
+ if (cp.race_checkpoint == 0) {
WaypointSprite_UpdateSprites(cp.sprite, WP_RaceStart, WP_Null, WP_Null);
- else if(cp.race_checkpoint == race_timed_checkpoint)
+ } else if (cp.race_checkpoint == race_timed_checkpoint) {
WaypointSprite_UpdateSprites(cp.sprite, WP_RaceFinish, WP_Null, WP_Null);
+ }
}
+ }
}
}
- if(defrag_ents)
- {
- entity trigger, targ;
- for(trigger = world; (trigger = find(trigger, classname, "trigger_multiple")); )
- for(targ = world; (targ = find(targ, targetname, trigger.target)); )
- if (targ.classname == "target_checkpoint" || targ.classname == "target_startTimer" || targ.classname == "target_stopTimer")
- {
+ if (defrag_ents) {
+ for (entity trigger = world; (trigger = find(trigger, classname, "trigger_multiple")); ) {
+ for (entity targ = world; (targ = find(targ, targetname, trigger.target)); ) {
+ if (targ.classname == "target_checkpoint" || targ.classname == "target_startTimer" || targ.classname == "target_stopTimer") {
trigger.wait = 0;
trigger.delay = 0;
targ.wait = 0;
//setorigin(targ, trigger.origin);
//remove(trigger);
}
+ }
+ }
}
- remove(self);
- setself(this);
}
vector trigger_race_checkpoint_spawn_evalfunc(entity player, entity spot, vector current)
FOREACH_CLIENT(true, LAMBDA(
float p = it.race_place;
- WITH(entity, self, it, race_PreparePlayer());
+ WITHSELF(it, race_PreparePlayer());
it.race_place = p;
));
}
void spawnpoint_think()
{
SELFPARAM();
- self.nextthink = time + 0.1;
- if(self.origin != self.spawnpoint_prevorigin)
+ this.nextthink = time + 0.1;
+ if(this.origin != this.spawnpoint_prevorigin)
{
- self.spawnpoint_prevorigin = self.origin;
- self.SendFlags |= 1;
+ this.spawnpoint_prevorigin = this.origin;
+ this.SendFlags |= 1;
}
}
++found;
if(ent.spawn_evalfunc)
{
- WITH(entity, self, ent, {
- spawn_score = ent.spawn_evalfunc(this, spot, spawn_score);
- });
+ WITHSELF(ent, spawn_score = ent.spawn_evalfunc(this, spot, spawn_score));
if(spawn_score.x < 0)
return spawn_score;
}
void CreatureFrame_All()
{
- FOREACH_ENTITY_FLOAT(damagedbycontents, true, LAMBDA(
- if(it.movetype == MOVETYPE_NOCLIP) continue;
+ FOREACH_ENTITY_FLOAT(damagedbycontents, true, {
+ if (it.movetype == MOVETYPE_NOCLIP) continue;
CreatureFrame_Liquids(it);
CreatureFrame_FallDamage(it);
it.oldvelocity = it.velocity;
- ));
+ });
}
void Pause_TryPause(bool ispaused)
void StartFrame()
{
// TODO: if move is more than 50ms, split it into two moves (this matches QWSV behavior and the client prediction)
- FOREACH_ENTITY_CLASS(STR_PLAYER, IS_NOT_A_CLIENT(it), PM_Main(it));
- FOREACH_ENTITY_CLASS(STR_PLAYER, IS_NOT_A_CLIENT(it), WITH(entity, self, it, PlayerPreThink()));
+ FOREACH_ENTITY_CLASS(STR_PLAYER, IS_FAKE_CLIENT(it), PM_Main(it));
+ FOREACH_ENTITY_CLASS(STR_PLAYER, IS_FAKE_CLIENT(it), WITHSELF(it, PlayerPreThink()));
execute_next_frame();
if (autocvar_sv_autopause && !server_is_dedicated) Pause_TryPause(true);
}
#endif
- FOREACH_ENTITY_FLOAT(csqcprojectile_clientanimate, true, LAMBDA(CSQCProjectile_Check(it)));
+ FOREACH_ENTITY_FLOAT(csqcprojectile_clientanimate, true, CSQCProjectile_Check(it));
- if(RedirectionThink())
- return;
+ if (RedirectionThink()) return;
UncustomizeEntitiesRun();
InitializeEntitiesRun();
WarpZone_StartFrame();
sys_frametime = autocvar_sys_ticrate * autocvar_slowmo;
- if(sys_frametime <= 0)
- sys_frametime = 1.0 / 60.0; // somewhat safe fallback
+ if (sys_frametime <= 0) sys_frametime = 1.0 / 60.0; // somewhat safe fallback
if (timeout_status == TIMEOUT_LEADTIME) // just before the timeout (when timeout_status will be TIMEOUT_ACTIVE)
orig_slowmo = autocvar_slowmo; // slowmo will be restored after the timeout
// detect when the pre-game countdown (if any) has ended and the game has started
game_delay = (time < game_starttime);
- if(autocvar_sv_eventlog && game_delay_last && !game_delay)
+ if (autocvar_sv_eventlog && game_delay_last && !game_delay)
GameLogEcho(":startdelay_ended");
game_delay_last = game_delay;
CreatureFrame_All();
CheckRules_World();
- if(warmup_stage && !gameover && warmup_limit > 0 && time >= warmup_limit)
- {
+ if (warmup_stage && !gameover && warmup_limit > 0 && time >= warmup_limit) {
ReadyRestart();
return;
}
anticheat_startframe();
MUTATOR_CALLHOOK(SV_StartFrame);
- FOREACH_CLIENT(true, LAMBDA(GlobalStats_update(it)));
- FOREACH_ENTITY_CLASS(STR_PLAYER, IS_NOT_A_CLIENT(it), WITH(entity, self, it, PlayerPostThink()));
+ FOREACH_CLIENT(true, GlobalStats_update(it));
+ FOREACH_ENTITY_CLASS(STR_PLAYER, IS_FAKE_CLIENT(it), WITHSELF(it, PlayerPostThink()));
}
.vector originjitter;
.float delay;
// weapon remove ent from df
-void target_init_verify()
+void target_init_verify(entity this)
{
entity trigger, targ;
for(trigger = world; (trigger = find(trigger, classname, "trigger_multiple")); )
}
// weapon give ent from defrag
-void target_give_init()
-{SELFPARAM();
+void target_give_init(entity this)
+{
entity targ;
for (targ = world; (targ = find(targ, targetname, self.target)); ) {
if (targ.classname == "weapon_rocketlauncher" || targ.classname == "weapon_devastator") {
GameLogEcho(strcat(":team:", ftos(player_id), ":", ftos(team_number), ":", ftos(type)));
}
-void default_delayedinit()
+void default_delayedinit(entity this)
{
if(!scores_initialized)
ScoreRules_generic();
cvar_set("teamplay", "2"); // DP needs this for sending proper getstatus replies.
}
-void SetLimits(int fraglimit_override, int leadlimit_override, float timelimit_override, float qualifying_override)
-{
- // enforce the server's universal frag/time limits
- // set to -1 to not change value
- if(!autocvar_g_campaign)
- {
- if(fraglimit_override >= 0)
- cvar_set("fraglimit", ftos(fraglimit_override));
- if(timelimit_override >= 0)
- cvar_set("timelimit", ftos(timelimit_override));
- if(leadlimit_override >= 0)
- cvar_set("leadlimit", ftos(leadlimit_override));
- if(qualifying_override >= 0)
- cvar_set("g_race_qualifying_timelimit", ftos(qualifying_override));
- }
-}
-
void InitGameplayMode()
{
VoteReset();
MapInfo_ClearTemps();
- // set both here, gamemode can override it later
- SetLimits(autocvar_fraglimit_override, autocvar_leadlimit_override, autocvar_timelimit_override, -1);
gamemode_name = MapInfo_Type_ToText(MapInfo_LoadedGametype);
cache_mutatormsg = strzone("");
void LogTeamchange(float player_id, float team_number, float type);
-void default_delayedinit();
+void default_delayedinit(entity this);
void ActivateTeamplay();
-void SetLimits(int fraglimit_override, int leadlimit_override, float timelimit_override, float qualifying_override);
-
void InitGameplayMode();
string GetClientVersionMessage();
#include "tests.qh"
-void test_weapons_hurt() {
- SELFPARAM();
+void test_weapons_hurt(entity this)
+{
EXPECT_NE(100, this.health);
remove(this.enemy);
remove(this);
noref entity v = it = new(vehicle);
Vehicle veh = VEH_BUMBLEBEE;
it.active = ACTIVE_NOT;
- WITH(entity, self, it, vehicle_initialize(veh, false); it.nextthink = time);
+ vehicle_initialize(it, veh, false);
+ it.nextthink = time;
SUCCEED();
}
}
else
{
- WITH(entity, self, cl, f = wpn.wr_checkammo1(wpn) + wpn.wr_checkammo2(wpn));
+ WITHSELF(cl, f = wpn.wr_checkammo1(wpn) + wpn.wr_checkammo2(wpn));
// always allow selecting the Mine Layer if we placed mines, so that we can detonate them
if(wpn == WEP_MINE_LAYER)
fireBullet_last_hit = world;
}
-void fireBullet(vector start, vector dir, float spread, float max_solid_penetration, float damage, float force, float dtype, int tracereffects)
-{SELFPARAM();
+void fireBullet(entity this, vector start, vector dir, float spread, float max_solid_penetration, float damage, float force, float dtype, int tracereffects)
+{
vector end;
dir = normalize(dir + randomvec() * spread);
else
fireBullet_trace_callback_eff = EFFECT_BULLET;
- float lag = ANTILAG_LATENCY(self);
+ float lag = ANTILAG_LATENCY(this);
if(lag < 0.001)
lag = 0;
- if (!IS_REAL_CLIENT(self))
+ if (!IS_REAL_CLIENT(this))
lag = 0;
- if(autocvar_g_antilag == 0 || self.cvar_cl_noantilag)
+ if(autocvar_g_antilag == 0 || this.cvar_cl_noantilag)
lag = 0; // only do hitscan, but no antilag
if(lag)
{
- FOREACH_CLIENT(IS_PLAYER(it) && it != self, antilag_takeback(it, CS(it), time - lag));
+ FOREACH_CLIENT(IS_PLAYER(it) && it != this, antilag_takeback(it, CS(it), time - lag));
FOREACH_ENTITY_FLAGS(flags, FL_MONSTER, {
- if (it != self)
+ if (it != this)
antilag_takeback(it, it, time - lag);
});
}
// change shooter to SOLID_BBOX so the shot can hit corpses
- int oldsolid = self.dphitcontentsmask;
- if(self)
- self.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY | DPCONTENTS_CORPSE;
+ int oldsolid = this.dphitcontentsmask;
+ if(this)
+ this.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY | DPCONTENTS_CORPSE;
- WarpZone_trace_forent = self;
+ WarpZone_trace_forent = this;
for (;;)
{
is_weapclip = true;
if(!hit || hit.solid == SOLID_BSP || hit.solid == SOLID_SLIDEBOX)
- Damage_DamageInfo(start, damage * solid_penetration_left, 0, 0, max(1, force) * dir * solid_penetration_left, dtype, hit.species, self);
+ Damage_DamageInfo(start, damage * solid_penetration_left, 0, 0, max(1, force) * dir * solid_penetration_left, dtype, hit.species, this);
if (hit && hit != WarpZone_trace_forent && hit != fireBullet_last_hit) // Avoid self-damage (except after going through a warp); avoid hitting the same entity twice (engine bug).
{
fireBullet_last_hit = hit;
yoda = 0;
- MUTATOR_CALLHOOK(FireBullet_Hit, self, hit, start, end, damage);
+ MUTATOR_CALLHOOK(FireBullet_Hit, this, hit, start, end, damage);
damage = frag_damage;
- float g = accuracy_isgooddamage(self, hit);
- Damage(hit, self, self, damage * solid_penetration_left, dtype, start, force * dir * solid_penetration_left);
+ float g = accuracy_isgooddamage(this, hit);
+ Damage(hit, this, this, damage * solid_penetration_left, dtype, start, force * dir * solid_penetration_left);
// calculate hits for ballistic weapons
if(g)
{
// do not exceed 100%
float added_damage = min(damage - total_damage, damage * solid_penetration_left);
total_damage += damage * solid_penetration_left;
- accuracy_add(self, PS(self).m_weapon.m_id, 0, added_damage);
+ accuracy_add(this, PS(this).m_weapon.m_id, 0, added_damage);
}
}
// Only show effect when going through a player (invisible otherwise)
if (hit && (hit.solid != SOLID_BSP))
if(vdist(trace_endpos - start, >, 4))
- trailparticles(self, fireBullet_trace_callback_eff, start, trace_endpos);
+ trailparticles(this, fireBullet_trace_callback_eff, start, trace_endpos);
start = trace_endpos;
if(hit.solid == SOLID_BSP)
- Damage_DamageInfo(start, 0, 0, 0, max(1, force) * normalize(dir) * -solid_penetration_left, dtype, 0, self);
+ Damage_DamageInfo(start, 0, 0, 0, max(1, force) * normalize(dir) * -solid_penetration_left, dtype, 0, this);
}
if(lag)
{
- FOREACH_CLIENT(IS_PLAYER(it) && it != self, antilag_restore(it, CS(it)));
+ FOREACH_CLIENT(IS_PLAYER(it) && it != this, antilag_restore(it, CS(it)));
FOREACH_ENTITY_FLAGS(flags, FL_MONSTER, {
- if (it != self)
+ if (it != this)
antilag_restore(it, it);
});
}
// restore shooter solid type
- if(self)
- self.dphitcontentsmask = oldsolid;
+ if(this)
+ this.dphitcontentsmask = oldsolid;
}
entity fireBullet_trace_callback_eff;
entity fireBullet_last_hit;
void fireBullet_trace_callback(vector start, vector hit, vector end);
-void fireBullet(vector start, vector dir, float spread, float max_solid_penetration, float damage, float force, float dtype, int tracereffects);
+void fireBullet(entity this, vector start, vector dir, float spread, float max_solid_penetration, float damage, float force, float dtype, int tracereffects);
remove(this);
return;
}
- if (IS_DEAD(self.owner))
+ if (IS_DEAD(this.owner))
{
// owner died; disappear
this.model = "";
remove(this);
return;
}
- if (IS_DEAD(self.owner))
+ if (IS_DEAD(this.owner))
{
this.model = "";
return;
SELFPARAM();
if ((actor.items & IT_UNLIMITED_WEAPON_AMMO)) return true;
bool ammo = false;
- if (secondary) WITH(entity, self, actor, ammo = thiswep.wr_checkammo2(thiswep));
- else WITH(entity, self, actor, ammo = thiswep.wr_checkammo1(thiswep));
+ if (secondary) WITHSELF(actor, ammo = thiswep.wr_checkammo2(thiswep));
+ else WITHSELF(actor, ammo = thiswep.wr_checkammo1(thiswep));
if (ammo) return true;
// always keep the Mine Layer if we placed mines, so that we can detonate them
if (thiswep == WEP_MINE_LAYER)
// check if the other firing mode has enough ammo
bool ammo_other = false;
- if (secondary) WITH(entity, self, actor, ammo_other = thiswep.wr_checkammo1(thiswep));
- else WITH(entity, self, actor, ammo_other = thiswep.wr_checkammo2(thiswep));
+ if (secondary) WITHSELF(actor, ammo_other = thiswep.wr_checkammo1(thiswep));
+ else WITHSELF(actor, ammo_other = thiswep.wr_checkammo2(thiswep));
if (ammo_other)
{
if (time - actor.prevwarntime > 1)
SELFPARAM();
Weapon w = Weapons_from(weapon_type);
weapon_dropevent_item = weapon_item;
- WITH(entity, self, player, w.event(w));
+ WITHSELF(player, w.event(w));
}
sv_logscores_bots 1
g_weaponarena all
g_weaponarena_random 2
+g_playerstats_gamereport_uri ""
// Start!